stuff-from-scratch/src/database/DatabaseManager.cpp
2022-12-01 10:52:48 +00:00

41 lines
712 B
C++

#include "DatabaseManager.h"
DatabaseManager::DatabaseManager()
: mDatabase(),
mDatabaseInterface()
{
}
DatabaseManager::~DatabaseManager()
{
}
std::unique_ptr<DatabaseManager> DatabaseManager::Create()
{
return std::make_unique<DatabaseManager>();
}
void DatabaseManager::openDatabase(const Path& path)
{
mDatabase = Database::Create();
mDatabase->setPath(path);
mDatabaseInterface = SqliteInterface::Create();
mDatabaseInterface->open(mDatabase.get());
}
void DatabaseManager::run(const std::string& statement)
{
mDatabaseInterface->run(statement);
}
void DatabaseManager::onShutDown()
{
if(mDatabaseInterface)
{
mDatabaseInterface->close();
}
}