Renamed the database classes to be inline with the new naming scheme.

This commit is contained in:
Relintai 2020-12-01 14:56:05 +01:00
parent e3338f9d3b
commit 35bd94de7e
10 changed files with 24 additions and 24 deletions

View File

@ -1 +0,0 @@
#include "mysql_connection.h"

View File

@ -0,0 +1 @@
#include "mysql_database.h"

View File

@ -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;
}

View File

@ -1 +0,0 @@
#include "pgsql_connection.h"

View File

@ -0,0 +1 @@
#include "pgsql_database.h"

View File

@ -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);
}

View File

@ -1 +0,0 @@
#include "sqlite3_connection.h"

View File

@ -0,0 +1 @@
#include "sqlite3_database.h"

View File

@ -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);
}

View File

@ -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);