Now the database backends will actually compile their .cpp files. Also small cleanups.

This commit is contained in:
Relintai 2020-12-01 15:28:59 +01:00
parent d713aeab8e
commit 4add0d14ea
10 changed files with 64 additions and 46 deletions

View File

@ -133,6 +133,7 @@ env_base.Append(CXX=["-o3"])
#env_base.Append(CXX=["-g2"])
env = env_base.Clone()
Export("env")
for d in database_list:
tmppath = "./database/" + d
@ -188,11 +189,9 @@ for m in module_list:
sys.path.remove(tmppath)
sys.modules.pop("detect")
Export("env")
SConscript("core/SCsub")
env.prg_sources = ["rdn_application.cpp"]
env.prg_sources = [ "rdn_application.cpp" ]
libapp = env.add_library("application", env.prg_sources)
env.Prepend(LIBS=[libapp])

View File

@ -1,6 +1,7 @@
#!/usr/bin/env python
Import("env_db")
Import("env")
env_db.core_sources = []
@ -8,4 +9,4 @@ env_db.add_source_files(env_db.core_sources, "*.cpp")
# Build it all as a library
lib = env_db.add_library("database_mysql", env_db.core_sources)
env_db.Prepend(LIBS=[lib])
env.Prepend(LIBS=[lib])

View File

@ -1 +1,15 @@
#include "mysql_database.h"
#include "mysql_database.h"
#include "core/database_manager.h"
Database *MysqlDatabase::_creation_func() {
return new MysqlDatabase();
}
void MysqlDatabase::_register() {
DatabaseManager::_register_db_creation_func("mysql", MysqlDatabase::_creation_func);
}
void MysqlDatabase::_unregister() {
DatabaseManager::_unregister_db_creation_func("mysql");
}

View File

@ -2,7 +2,6 @@
#define MYSQL_CONNECTION
#include "core/database.h"
#include "core/database_manager.h"
//Brynet has it aswell, and because of using namespace it is defined here aswell
//later this will be fixed better
@ -14,17 +13,9 @@
class MysqlDatabase : public Database {
public:
static Database *_creation_func() {
return new MysqlDatabase();
}
static void _register() {
DatabaseManager::_register_db_creation_func("mysql", MysqlDatabase::_creation_func);
}
static void _unregister() {
DatabaseManager::_unregister_db_creation_func("mysql");
}
static Database *_creation_func();
static void _register();
static void _unregister();
MysqlDatabase() : Database() {
mysql = new MYSQL();

View File

@ -1,6 +1,7 @@
#!/usr/bin/env python
Import("env_db")
Import("env")
env_db.core_sources = []
@ -8,4 +9,4 @@ env_db.add_source_files(env_db.core_sources, "*.cpp")
# Build it all as a library
lib = env_db.add_library("database_pgsql", env_db.core_sources)
env_db.Prepend(LIBS=[lib])
env.Prepend(LIBS=[lib])

View File

@ -1 +1,15 @@
#include "pgsql_database.h"
#include "pgsql_database.h"
#include "core/database_manager.h"
Database *PGSQLDatabase::_creation_func() {
return new PGSQLDatabase();
}
void PGSQLDatabase::_register() {
DatabaseManager::_register_db_creation_func("pgsql", PGSQLDatabase::_creation_func);
}
void PGSQLDatabase::_unregister() {
DatabaseManager::_unregister_db_creation_func("pgsql");
}

View File

@ -2,7 +2,6 @@
#define PGSQL_CONNECTION
#include "core/database.h"
#include "core/database_manager.h"
//Brynet has it aswell, and because of using namespace it is defined here aswell
//later this will be fixed better
@ -14,19 +13,12 @@
class PGSQLDatabase : public Database {
public:
static Database *_creation_func() {
return new PGSQLDatabase();
}
static Database *_creation_func();
static void _register();
static void _unregister();
static void _register() {
DatabaseManager::_register_db_creation_func("pgsql", PGSQLDatabase::_creation_func);
}
static void _unregister() {
DatabaseManager::_unregister_db_creation_func("pgsql");
}
PGSQLDatabase() : Database() {
PGSQLDatabase() :
Database() {
conn = PQconnectStart("");
}
~PGSQLDatabase() {

View File

@ -1,6 +1,7 @@
#!/usr/bin/env python
Import("env_db")
Import("env")
env_db.core_sources = []
@ -8,4 +9,4 @@ env_db.add_source_files(env_db.core_sources, "*.cpp")
# Build it all as a library
lib = env_db.add_library("database_pgsql", env_db.core_sources)
env_db.Prepend(LIBS=[lib])
env.Prepend(LIBS=[lib])

View File

@ -1 +1,15 @@
#include "sqlite3_database.h"
#include "sqlite3_database.h"
#include "core/database_manager.h"
Database *SQLite3Database::_creation_func() {
return new SQLite3Database();
}
void SQLite3Database::_register() {
DatabaseManager::_register_db_creation_func("sqlite", SQLite3Database::_creation_func);
}
void SQLite3Database::_unregister() {
DatabaseManager::_unregister_db_creation_func("sqlite");
}

View File

@ -2,7 +2,6 @@
#define SQLITE3_CONNECTION
#include "core/database.h"
#include "core/database_manager.h"
//Brynet has it aswell, and because of using namespace it is defined here aswell
//later this will be fixed better
@ -16,17 +15,9 @@
class SQLite3Database : public Database {
public:
static Database *_creation_func() {
return new SQLite3Database();
}
static void _register() {
DatabaseManager::_register_db_creation_func("sqlite", SQLite3Database::_creation_func);
}
static void _unregister() {
DatabaseManager::_unregister_db_creation_func("sqlite");
}
static Database *_creation_func();
static void _register();
static void _unregister();
SQLite3Database() :
Database() {