2020-05-02 07:31:03 +00:00
|
|
|
#include "DatabaseManager.h"
|
|
|
|
|
|
|
|
DatabaseManager::DatabaseManager()
|
2021-03-29 20:31:24 +00:00
|
|
|
: mDatabase(),
|
|
|
|
mDatabaseInterface()
|
2020-05-02 07:31:03 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
DatabaseManager::~DatabaseManager()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2021-03-29 20:31:24 +00:00
|
|
|
std::unique_ptr<DatabaseManager> DatabaseManager::Create()
|
2020-05-02 07:31:03 +00:00
|
|
|
{
|
2021-03-29 20:31:24 +00:00
|
|
|
return std::make_unique<DatabaseManager>();
|
2020-05-02 07:31:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void DatabaseManager::CreateDatabase(const std::string& path)
|
|
|
|
{
|
2021-03-29 20:31:24 +00:00
|
|
|
mDatabase = Database::Create();
|
|
|
|
mDatabase->SetPath(path);
|
2020-05-02 07:31:03 +00:00
|
|
|
|
2021-03-29 20:31:24 +00:00
|
|
|
mDatabaseInterface = SqliteInterface::Create();
|
|
|
|
mDatabaseInterface->Open(mDatabase);
|
2020-05-02 07:31:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DatabaseManager::OnShutDown()
|
|
|
|
{
|
2021-03-29 20:31:24 +00:00
|
|
|
if(mDatabaseInterface)
|
|
|
|
{
|
|
|
|
mDatabaseInterface->Close();
|
|
|
|
}
|
2020-05-02 07:31:03 +00:00
|
|
|
}
|