Add a ddb (default database) member to DatabaseManager.

This commit is contained in:
Relintai 2021-05-01 21:53:21 +02:00
parent 06ef029280
commit c7ae476853
2 changed files with 10 additions and 0 deletions

View File

@ -12,8 +12,15 @@ uint32_t DatabaseManager::create_database(const std::string &name) {
return -1;
}
printf("Database %s successfully created!\n", name.c_str());
databases.push_back(db);
if (ddb == nullptr) {
printf("Database %s has been set as the default database!\n", name.c_str());
ddb = db;
}
return databases.size() - 1;
}
@ -53,6 +60,8 @@ Database *DatabaseManager::_create_database(const std::string &name) {
DatabaseManager::DatabaseManager() {
_instance = this;
ddb = nullptr;
}
DatabaseManager::~DatabaseManager() {

View File

@ -10,6 +10,7 @@
class DatabaseManager {
public:
std::vector<Database *> databases;
Database *ddb;
void load();