From 35bd94de7efe7002c8796fbc77ae69861e214cb4 Mon Sep 17 00:00:00 2001 From: Relintai Date: Tue, 1 Dec 2020 14:56:05 +0100 Subject: [PATCH] Renamed the database classes to be inline with the new naming scheme. --- database/mysql/mysql_connection.cpp | 1 - database/mysql/mysql_database.cpp | 1 + .../mysql/{mysql_connection.h => mysql_database.h} | 10 +++++----- database/postgres/pgsql_connection.cpp | 1 - database/postgres/pgsql_database.cpp | 1 + .../{pgsql_connection.h => pgsql_database.h} | 10 +++++----- database/sqlite/sqlite3_connection.cpp | 1 - database/sqlite/sqlite3_database.cpp | 1 + .../{sqlite3_connection.h => sqlite3_database.h} | 10 +++++----- main.cpp | 12 ++++++------ 10 files changed, 24 insertions(+), 24 deletions(-) delete mode 100644 database/mysql/mysql_connection.cpp create mode 100644 database/mysql/mysql_database.cpp rename database/mysql/{mysql_connection.h => mysql_database.h} (71%) delete mode 100644 database/postgres/pgsql_connection.cpp create mode 100644 database/postgres/pgsql_database.cpp rename database/postgres/{pgsql_connection.h => pgsql_database.h} (71%) delete mode 100644 database/sqlite/sqlite3_connection.cpp create mode 100644 database/sqlite/sqlite3_database.cpp rename database/sqlite/{sqlite3_connection.h => sqlite3_database.h} (77%) diff --git a/database/mysql/mysql_connection.cpp b/database/mysql/mysql_connection.cpp deleted file mode 100644 index 1f787d1..0000000 --- a/database/mysql/mysql_connection.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "mysql_connection.h" \ No newline at end of file diff --git a/database/mysql/mysql_database.cpp b/database/mysql/mysql_database.cpp new file mode 100644 index 0000000..ca5e482 --- /dev/null +++ b/database/mysql/mysql_database.cpp @@ -0,0 +1 @@ +#include "mysql_database.h" \ No newline at end of file diff --git a/database/mysql/mysql_connection.h b/database/mysql/mysql_database.h similarity index 71% rename from database/mysql/mysql_connection.h rename to database/mysql/mysql_database.h index 2580187..ea6fe77 100644 --- a/database/mysql/mysql_connection.h +++ b/database/mysql/mysql_database.h @@ -12,24 +12,24 @@ #include -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; } diff --git a/database/postgres/pgsql_connection.cpp b/database/postgres/pgsql_connection.cpp deleted file mode 100644 index a033fd5..0000000 --- a/database/postgres/pgsql_connection.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "pgsql_connection.h" \ No newline at end of file diff --git a/database/postgres/pgsql_database.cpp b/database/postgres/pgsql_database.cpp new file mode 100644 index 0000000..f8bf373 --- /dev/null +++ b/database/postgres/pgsql_database.cpp @@ -0,0 +1 @@ +#include "pgsql_database.h" \ No newline at end of file diff --git a/database/postgres/pgsql_connection.h b/database/postgres/pgsql_database.h similarity index 71% rename from database/postgres/pgsql_connection.h rename to database/postgres/pgsql_database.h index 0cea512..7ad3043 100644 --- a/database/postgres/pgsql_connection.h +++ b/database/postgres/pgsql_database.h @@ -12,24 +12,24 @@ #include -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); } diff --git a/database/sqlite/sqlite3_connection.cpp b/database/sqlite/sqlite3_connection.cpp deleted file mode 100644 index 3a8aced..0000000 --- a/database/sqlite/sqlite3_connection.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "sqlite3_connection.h" \ No newline at end of file diff --git a/database/sqlite/sqlite3_database.cpp b/database/sqlite/sqlite3_database.cpp new file mode 100644 index 0000000..8cf1588 --- /dev/null +++ b/database/sqlite/sqlite3_database.cpp @@ -0,0 +1 @@ +#include "sqlite3_database.h" \ No newline at end of file diff --git a/database/sqlite/sqlite3_connection.h b/database/sqlite/sqlite3_database.h similarity index 77% rename from database/sqlite/sqlite3_connection.h rename to database/sqlite/sqlite3_database.h index cfce88e..845cab4 100644 --- a/database/sqlite/sqlite3_connection.h +++ b/database/sqlite/sqlite3_database.h @@ -14,21 +14,21 @@ #include -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); } diff --git a/main.cpp b/main.cpp index 521a826..23df9f3 100644 --- a/main.cpp +++ b/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);