mirror of
https://github.com/Relintai/rcpp_framework.git
synced 2024-11-10 00:52:11 +01:00
Moved the db initialization code to a new header.
This commit is contained in:
parent
be8aac25aa
commit
d713aeab8e
30
database/db_init.h
Normal file
30
database/db_init.h
Normal file
@ -0,0 +1,30 @@
|
||||
#ifndef DB_INIT_H
|
||||
#define DB_INIT_H
|
||||
|
||||
#if MYSQL_PRESENT
|
||||
#include "mysql/mysql_database.h"
|
||||
#endif
|
||||
|
||||
#if PGSQL_PRESENT
|
||||
#include "postgres/pgsql_database.h"
|
||||
#endif
|
||||
|
||||
#if SQLITE_PRESENT
|
||||
#include "sqlite/sqlite3_database.h"
|
||||
#endif
|
||||
|
||||
void initialize_database_backends() {
|
||||
#if MYSQL_PRESENT
|
||||
MysqlDatabase::_register();
|
||||
#endif
|
||||
|
||||
#if PGSQL_PRESENT
|
||||
PGSQLDatabase::_register();
|
||||
#endif
|
||||
|
||||
#if SQLITE_PRESENT
|
||||
SQLite3Database::_register();
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
25
main.cpp
25
main.cpp
@ -11,33 +11,12 @@
|
||||
|
||||
#include "core/database_manager.h"
|
||||
|
||||
#if MYSQL_PRESENT
|
||||
#include "database/mysql/mysql_database.h"
|
||||
#endif
|
||||
|
||||
#if PGSQL_PRESENT
|
||||
#include "database/postgres/pgsql_database.h"
|
||||
#endif
|
||||
|
||||
#if SQLITE_PRESENT
|
||||
#include "database/sqlite/sqlite3_database.h"
|
||||
#endif
|
||||
#include "database/db_init.h"
|
||||
|
||||
#define MAIN_CLASS RDNApplication
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
|
||||
#if MYSQL_PRESENT
|
||||
MysqlDatabase::_register();
|
||||
#endif
|
||||
|
||||
#if PGSQL_PRESENT
|
||||
PGSQLDatabase::_register();
|
||||
#endif
|
||||
|
||||
#if SQLITE_PRESENT
|
||||
SQLite3Database::_register();
|
||||
#endif
|
||||
initialize_database_backends();
|
||||
|
||||
FileCache *file_cache = new FileCache(true);
|
||||
file_cache->wwwroot = "./www";
|
||||
|
Loading…
Reference in New Issue
Block a user