Refactoring project layout

This commit is contained in:
stephb9959
2021-10-21 21:52:39 -07:00
parent 0f26f359dd
commit c577a4d23a
82 changed files with 5198 additions and 4202 deletions

View File

@@ -7,57 +7,23 @@
//
#include "StorageService.h"
#include "Daemon.h"
#include "Poco/Util/Application.h"
#include "framework/Utils.h"
#include "framework/MicroService.h"
namespace OpenWifi {
class Storage *Storage::instance_ = nullptr;
std::string Storage::ConvertParams(const std::string & S) const {
std::string R;
R.reserve(S.size()*2+1);
if(dbType_==pgsql) {
auto Idx=1;
for(auto const & i:S)
{
if(i=='?') {
R += '$';
R.append(std::to_string(Idx++));
} else {
R += i;
}
}
} else {
R = S;
}
return R;
}
int Storage::Start() {
std::lock_guard Guard(Mutex_);
Logger_.setLevel(Poco::Message::PRIO_NOTICE);
Logger_.notice("Starting.");
std::string DBType = Daemon()->ConfigGetString("storage.type");
if (DBType == "sqlite") {
Setup_SQLite();
} else if (DBType == "postgresql") {
Setup_PostgreSQL();
} else if (DBType == "mysql") {
Setup_MySQL();
}
StorageClass::Start();
Create_Tables();
return 0;
}
void Storage::Stop() {
Logger_.notice("Stopping.");
StorageClass::Stop();
}
}
// namespace