mirror of
https://github.com/Relintai/rcpp_framework.git
synced 2024-11-14 04:57:21 +01:00
Renamed the database classes to be inline with the new naming scheme.
This commit is contained in:
parent
e3338f9d3b
commit
35bd94de7e
@ -1 +0,0 @@
|
|||||||
#include "mysql_connection.h"
|
|
1
database/mysql/mysql_database.cpp
Normal file
1
database/mysql/mysql_database.cpp
Normal file
@ -0,0 +1 @@
|
|||||||
|
#include "mysql_database.h"
|
@ -12,24 +12,24 @@
|
|||||||
|
|
||||||
#include <mysql.h>
|
#include <mysql.h>
|
||||||
|
|
||||||
class MysqlConnection : public Database {
|
class MysqlDatabase : public Database {
|
||||||
public:
|
public:
|
||||||
static Database *_creation_func() {
|
static Database *_creation_func() {
|
||||||
return new MysqlConnection();
|
return new MysqlDatabase();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _register() {
|
static void _register() {
|
||||||
DatabaseManager::_register_db_creation_func("mysql", MysqlConnection::_creation_func);
|
DatabaseManager::_register_db_creation_func("mysql", MysqlDatabase::_creation_func);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _unregister() {
|
static void _unregister() {
|
||||||
DatabaseManager::_unregister_db_creation_func("mysql");
|
DatabaseManager::_unregister_db_creation_func("mysql");
|
||||||
}
|
}
|
||||||
|
|
||||||
MysqlConnection() : Database() {
|
MysqlDatabase() : Database() {
|
||||||
mysql = new MYSQL();
|
mysql = new MYSQL();
|
||||||
}
|
}
|
||||||
~MysqlConnection() {
|
~MysqlDatabase() {
|
||||||
delete mysql;
|
delete mysql;
|
||||||
}
|
}
|
||||||
|
|
@ -1 +0,0 @@
|
|||||||
#include "pgsql_connection.h"
|
|
1
database/postgres/pgsql_database.cpp
Normal file
1
database/postgres/pgsql_database.cpp
Normal file
@ -0,0 +1 @@
|
|||||||
|
#include "pgsql_database.h"
|
@ -12,24 +12,24 @@
|
|||||||
|
|
||||||
#include <libpq-fe.h>
|
#include <libpq-fe.h>
|
||||||
|
|
||||||
class PGSQLConnection : public Database {
|
class PGSQLDatabase : public Database {
|
||||||
public:
|
public:
|
||||||
static Database *_creation_func() {
|
static Database *_creation_func() {
|
||||||
return new PGSQLConnection();
|
return new PGSQLDatabase();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _register() {
|
static void _register() {
|
||||||
DatabaseManager::_register_db_creation_func("pgsql", PGSQLConnection::_creation_func);
|
DatabaseManager::_register_db_creation_func("pgsql", PGSQLDatabase::_creation_func);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _unregister() {
|
static void _unregister() {
|
||||||
DatabaseManager::_unregister_db_creation_func("pgsql");
|
DatabaseManager::_unregister_db_creation_func("pgsql");
|
||||||
}
|
}
|
||||||
|
|
||||||
PGSQLConnection() : Database() {
|
PGSQLDatabase() : Database() {
|
||||||
conn = PQconnectStart("");
|
conn = PQconnectStart("");
|
||||||
}
|
}
|
||||||
~PGSQLConnection() {
|
~PGSQLDatabase() {
|
||||||
PQfinish(conn);
|
PQfinish(conn);
|
||||||
}
|
}
|
||||||
|
|
@ -1 +0,0 @@
|
|||||||
#include "sqlite3_connection.h"
|
|
1
database/sqlite/sqlite3_database.cpp
Normal file
1
database/sqlite/sqlite3_database.cpp
Normal file
@ -0,0 +1 @@
|
|||||||
|
#include "sqlite3_database.h"
|
@ -14,21 +14,21 @@
|
|||||||
|
|
||||||
#include <sqlite3.h>
|
#include <sqlite3.h>
|
||||||
|
|
||||||
class SQLite3Connection : public Database {
|
class SQLite3Database : public Database {
|
||||||
public:
|
public:
|
||||||
static Database *_creation_func() {
|
static Database *_creation_func() {
|
||||||
return new SQLite3Connection();
|
return new SQLite3Database();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _register() {
|
static void _register() {
|
||||||
DatabaseManager::_register_db_creation_func("sqlite", SQLite3Connection::_creation_func);
|
DatabaseManager::_register_db_creation_func("sqlite", SQLite3Database::_creation_func);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _unregister() {
|
static void _unregister() {
|
||||||
DatabaseManager::_unregister_db_creation_func("sqlite");
|
DatabaseManager::_unregister_db_creation_func("sqlite");
|
||||||
}
|
}
|
||||||
|
|
||||||
SQLite3Connection() :
|
SQLite3Database() :
|
||||||
Database() {
|
Database() {
|
||||||
|
|
||||||
int ret = sqlite3_config(SQLITE_CONFIG_MULTITHREAD);
|
int ret = sqlite3_config(SQLITE_CONFIG_MULTITHREAD);
|
||||||
@ -39,7 +39,7 @@ public:
|
|||||||
ret = sqlite3_open("", &conn);
|
ret = sqlite3_open("", &conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
~SQLite3Connection() {
|
~SQLite3Database() {
|
||||||
sqlite3_close(conn);
|
sqlite3_close(conn);
|
||||||
}
|
}
|
||||||
|
|
12
main.cpp
12
main.cpp
@ -12,15 +12,15 @@
|
|||||||
#include "core/database_manager.h"
|
#include "core/database_manager.h"
|
||||||
|
|
||||||
#if MYSQL_PRESENT
|
#if MYSQL_PRESENT
|
||||||
#include "database/mysql/mysql_connection.h"
|
#include "database/mysql/mysql_database.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if PGSQL_PRESENT
|
#if PGSQL_PRESENT
|
||||||
#include "database/postgres/pgsql_connection.h"
|
#include "database/postgres/pgsql_database.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if SQLITE_PRESENT
|
#if SQLITE_PRESENT
|
||||||
#include "database/sqlite/sqlite3_connection.h"
|
#include "database/sqlite/sqlite3_database.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MAIN_CLASS RDNApplication
|
#define MAIN_CLASS RDNApplication
|
||||||
@ -29,17 +29,17 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
#if MYSQL_PRESENT
|
#if MYSQL_PRESENT
|
||||||
printf("mysql present\n");
|
printf("mysql present\n");
|
||||||
MysqlConnection::_register();
|
MysqlDatabase::_register();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if PGSQL_PRESENT
|
#if PGSQL_PRESENT
|
||||||
printf("pgsql present\n");
|
printf("pgsql present\n");
|
||||||
PGSQLConnection::_register();
|
PGSQLDatabase::_register();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if SQLITE_PRESENT
|
#if SQLITE_PRESENT
|
||||||
printf("sqlite present\n");
|
printf("sqlite present\n");
|
||||||
SQLite3Connection::_register();
|
SQLite3Database::_register();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
FileCache *file_cache = new FileCache(true);
|
FileCache *file_cache = new FileCache(true);
|
||||||
|
Loading…
Reference in New Issue
Block a user