mirror of
https://github.com/Relintai/rcpp_framework.git
synced 2025-02-20 15:14:26 +01:00
Tidy DatabaseManager's messages up.
This commit is contained in:
parent
22f2fae06d
commit
a9ccce652a
@ -8,16 +8,16 @@ uint32_t DatabaseManager::create_database(const String &name) {
|
|||||||
Database *db = _create_database(name);
|
Database *db = _create_database(name);
|
||||||
|
|
||||||
if (!db) {
|
if (!db) {
|
||||||
printf("create_database: %s, returned db is null!", name.c_str());
|
RLOG_MSG("(DatabaseManager) create_database: " + name + ", returned db is null!");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Database %s successfully created!\n", name.c_str());
|
RLOG_MSG("(DatabaseManager) Database " + name + " successfully created!");
|
||||||
|
|
||||||
databases.push_back(db);
|
databases.push_back(db);
|
||||||
|
|
||||||
if (ddb == nullptr) {
|
if (ddb == nullptr) {
|
||||||
printf("Database %s has been set as the default database!\n", name.c_str());
|
RLOG_MSG("(DatabaseManager) Database " + name + " has been set as the default database!");
|
||||||
ddb = db;
|
ddb = db;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -29,10 +29,7 @@ DatabaseManager *DatabaseManager::get_singleton() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DatabaseManager::_register_db_creation_func(const String &name, std::function<Database *()> func) {
|
void DatabaseManager::_register_db_creation_func(const String &name, std::function<Database *()> func) {
|
||||||
if (!func) {
|
ERR_FAIL_COND_MSG(!func, "_register_db_creation_func: " + name + ", func is wrong!");
|
||||||
printf("_register_db_creation_func: %s, func is wrong!", name.c_str());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_db_creation_func_map[name] = func;
|
_db_creation_func_map[name] = func;
|
||||||
}
|
}
|
||||||
@ -44,16 +41,11 @@ void DatabaseManager::_unregister_db_creation_func(const String &name) {
|
|||||||
Database *DatabaseManager::_create_database(const String &name) {
|
Database *DatabaseManager::_create_database(const String &name) {
|
||||||
std::function<Database *()> func = _db_creation_func_map[name];
|
std::function<Database *()> func = _db_creation_func_map[name];
|
||||||
|
|
||||||
if (!func) {
|
ERR_FAIL_COND_V_MSG(!func, nullptr, "_create_database: " + name + ", func is wrong!");
|
||||||
printf("_create_database: %s, func is wrong!", name.c_str());
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
Database *db = func();
|
Database *db = func();
|
||||||
|
|
||||||
if (!db) {
|
ERR_FAIL_COND_V_MSG(!db, nullptr, "_create_database: " + name + ", returned db is null!");
|
||||||
printf("_create_database: %s, returned db is null!", name.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
return db;
|
return db;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user