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>
|
||||
|
||||
class MysqlConnection : public Database {
|
||||
class MysqlDatabase : public Database {
|
||||
public:
|
||||
static Database *_creation_func() {
|
||||
return new MysqlConnection();
|
||||
return new MysqlDatabase();
|
||||
}
|
||||
|
||||
static void _register() {
|
||||
DatabaseManager::_register_db_creation_func("mysql", MysqlConnection::_creation_func);
|
||||
DatabaseManager::_register_db_creation_func("mysql", MysqlDatabase::_creation_func);
|
||||
}
|
||||
|
||||
static void _unregister() {
|
||||
DatabaseManager::_unregister_db_creation_func("mysql");
|
||||
}
|
||||
|
||||
MysqlConnection() : Database() {
|
||||
MysqlDatabase() : Database() {
|
||||
mysql = new MYSQL();
|
||||
}
|
||||
~MysqlConnection() {
|
||||
~MysqlDatabase() {
|
||||
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>
|
||||
|
||||
class PGSQLConnection : public Database {
|
||||
class PGSQLDatabase : public Database {
|
||||
public:
|
||||
static Database *_creation_func() {
|
||||
return new PGSQLConnection();
|
||||
return new PGSQLDatabase();
|
||||
}
|
||||
|
||||
static void _register() {
|
||||
DatabaseManager::_register_db_creation_func("pgsql", PGSQLConnection::_creation_func);
|
||||
DatabaseManager::_register_db_creation_func("pgsql", PGSQLDatabase::_creation_func);
|
||||
}
|
||||
|
||||
static void _unregister() {
|
||||
DatabaseManager::_unregister_db_creation_func("pgsql");
|
||||
}
|
||||
|
||||
PGSQLConnection() : Database() {
|
||||
PGSQLDatabase() : Database() {
|
||||
conn = PQconnectStart("");
|
||||
}
|
||||
~PGSQLConnection() {
|
||||
~PGSQLDatabase() {
|
||||
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>
|
||||
|
||||
class SQLite3Connection : public Database {
|
||||
class SQLite3Database : public Database {
|
||||
public:
|
||||
static Database *_creation_func() {
|
||||
return new SQLite3Connection();
|
||||
return new SQLite3Database();
|
||||
}
|
||||
|
||||
static void _register() {
|
||||
DatabaseManager::_register_db_creation_func("sqlite", SQLite3Connection::_creation_func);
|
||||
DatabaseManager::_register_db_creation_func("sqlite", SQLite3Database::_creation_func);
|
||||
}
|
||||
|
||||
static void _unregister() {
|
||||
DatabaseManager::_unregister_db_creation_func("sqlite");
|
||||
}
|
||||
|
||||
SQLite3Connection() :
|
||||
SQLite3Database() :
|
||||
Database() {
|
||||
|
||||
int ret = sqlite3_config(SQLITE_CONFIG_MULTITHREAD);
|
||||
@ -39,7 +39,7 @@ public:
|
||||
ret = sqlite3_open("", &conn);
|
||||
}
|
||||
|
||||
~SQLite3Connection() {
|
||||
~SQLite3Database() {
|
||||
sqlite3_close(conn);
|
||||
}
|
||||
|
12
main.cpp
12
main.cpp
@ -12,15 +12,15 @@
|
||||
#include "core/database_manager.h"
|
||||
|
||||
#if MYSQL_PRESENT
|
||||
#include "database/mysql/mysql_connection.h"
|
||||
#include "database/mysql/mysql_database.h"
|
||||
#endif
|
||||
|
||||
#if PGSQL_PRESENT
|
||||
#include "database/postgres/pgsql_connection.h"
|
||||
#include "database/postgres/pgsql_database.h"
|
||||
#endif
|
||||
|
||||
#if SQLITE_PRESENT
|
||||
#include "database/sqlite/sqlite3_connection.h"
|
||||
#include "database/sqlite/sqlite3_database.h"
|
||||
#endif
|
||||
|
||||
#define MAIN_CLASS RDNApplication
|
||||
@ -29,17 +29,17 @@ int main(int argc, char **argv) {
|
||||
|
||||
#if MYSQL_PRESENT
|
||||
printf("mysql present\n");
|
||||
MysqlConnection::_register();
|
||||
MysqlDatabase::_register();
|
||||
#endif
|
||||
|
||||
#if PGSQL_PRESENT
|
||||
printf("pgsql present\n");
|
||||
PGSQLConnection::_register();
|
||||
PGSQLDatabase::_register();
|
||||
#endif
|
||||
|
||||
#if SQLITE_PRESENT
|
||||
printf("sqlite present\n");
|
||||
SQLite3Connection::_register();
|
||||
SQLite3Database::_register();
|
||||
#endif
|
||||
|
||||
FileCache *file_cache = new FileCache(true);
|
||||
|
Loading…
Reference in New Issue
Block a user