stuff-from-scratch/src/database/DatabaseManager.cpp

37 lines
578 B
C++
Raw Normal View History

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