diff options
| author | Shauren <shauren.trinity@gmail.com> | 2015-08-27 00:54:49 +0200 |
|---|---|---|
| committer | jackpoz <giacomopoz@gmail.com> | 2015-09-27 17:08:50 +0200 |
| commit | 25c03039768fefa79dd75d491997c28e451a09a7 (patch) | |
| tree | e6066aa550a2f5564bc235f1696113b133a03b29 /src/server/database/Database/Implementation | |
| parent | d2076ef8b09f6a59aaa634cc754b805d637ffc8a (diff) | |
Core/DBLayer: Added compile time validation for prepared statement indexes passed to DatabaseWorkerPool::GetPreparedStatement turning mistakes like the one fixed in 0327927fa61434d432f9749fd9242ae5dce9a5cd into compiler errors.
(cherry picked from commit 7c75160f590812f0c5d70fd9c68441068e2ded48)
Conflicts:
src/server/database/Database/Implementation/HotfixDatabase.h
src/server/shared/DataStores/DB2StorageLoader.cpp
src/server/shared/DataStores/DB2StorageLoader.h
src/server/shared/DataStores/DB2Store.h
Diffstat (limited to 'src/server/database/Database/Implementation')
3 files changed, 45 insertions, 39 deletions
diff --git a/src/server/database/Database/Implementation/CharacterDatabase.h b/src/server/database/Database/Implementation/CharacterDatabase.h index a7ab5d00cb3..5ebafe0d0f8 100644 --- a/src/server/database/Database/Implementation/CharacterDatabase.h +++ b/src/server/database/Database/Implementation/CharacterDatabase.h @@ -21,19 +21,6 @@ #include "DatabaseWorkerPool.h" #include "MySQLConnection.h" -class CharacterDatabaseConnection : public MySQLConnection -{ - public: - //- Constructors for sync and async connections - CharacterDatabaseConnection(MySQLConnectionInfo& connInfo) : MySQLConnection(connInfo) { } - CharacterDatabaseConnection(ProducerConsumerQueue<SQLOperation*>* q, MySQLConnectionInfo& connInfo) : MySQLConnection(q, connInfo) { } - - //- Loads database type specific prepared statements - void DoPrepareStatements() override; -}; - -typedef DatabaseWorkerPool<CharacterDatabaseConnection> CharacterDatabaseWorkerPool; - enum CharacterDatabaseStatements { /* Naming standard for defines: @@ -546,4 +533,19 @@ enum CharacterDatabaseStatements MAX_CHARACTERDATABASE_STATEMENTS }; +class CharacterDatabaseConnection : public MySQLConnection +{ +public: + typedef CharacterDatabaseStatements Statements; + + //- Constructors for sync and async connections + CharacterDatabaseConnection(MySQLConnectionInfo& connInfo) : MySQLConnection(connInfo) { } + CharacterDatabaseConnection(ProducerConsumerQueue<SQLOperation*>* q, MySQLConnectionInfo& connInfo) : MySQLConnection(q, connInfo) { } + + //- Loads database type specific prepared statements + void DoPrepareStatements() override; +}; + +typedef DatabaseWorkerPool<CharacterDatabaseConnection> CharacterDatabaseWorkerPool; + #endif diff --git a/src/server/database/Database/Implementation/LoginDatabase.h b/src/server/database/Database/Implementation/LoginDatabase.h index 7f6cffa520f..79b7a53cb6e 100644 --- a/src/server/database/Database/Implementation/LoginDatabase.h +++ b/src/server/database/Database/Implementation/LoginDatabase.h @@ -21,19 +21,6 @@ #include "DatabaseWorkerPool.h" #include "MySQLConnection.h" -class LoginDatabaseConnection : public MySQLConnection -{ - public: - //- Constructors for sync and async connections - LoginDatabaseConnection(MySQLConnectionInfo& connInfo) : MySQLConnection(connInfo) { } - LoginDatabaseConnection(ProducerConsumerQueue<SQLOperation*>* q, MySQLConnectionInfo& connInfo) : MySQLConnection(q, connInfo) { } - - //- Loads database type specific prepared statements - void DoPrepareStatements() override; -}; - -typedef DatabaseWorkerPool<LoginDatabaseConnection> LoginDatabaseWorkerPool; - enum LoginDatabaseStatements { /* Naming standard for defines: @@ -133,4 +120,19 @@ enum LoginDatabaseStatements MAX_LOGINDATABASE_STATEMENTS }; +class LoginDatabaseConnection : public MySQLConnection +{ +public: + typedef LoginDatabaseStatements Statements; + + //- Constructors for sync and async connections + LoginDatabaseConnection(MySQLConnectionInfo& connInfo) : MySQLConnection(connInfo) { } + LoginDatabaseConnection(ProducerConsumerQueue<SQLOperation*>* q, MySQLConnectionInfo& connInfo) : MySQLConnection(q, connInfo) { } + + //- Loads database type specific prepared statements + void DoPrepareStatements() override; +}; + +typedef DatabaseWorkerPool<LoginDatabaseConnection> LoginDatabaseWorkerPool; + #endif diff --git a/src/server/database/Database/Implementation/WorldDatabase.h b/src/server/database/Database/Implementation/WorldDatabase.h index 36fd6fbb186..c5475835fbd 100644 --- a/src/server/database/Database/Implementation/WorldDatabase.h +++ b/src/server/database/Database/Implementation/WorldDatabase.h @@ -21,19 +21,6 @@ #include "DatabaseWorkerPool.h" #include "MySQLConnection.h" -class WorldDatabaseConnection : public MySQLConnection -{ - public: - //- Constructors for sync and async connections - WorldDatabaseConnection(MySQLConnectionInfo& connInfo) : MySQLConnection(connInfo) { } - WorldDatabaseConnection(ProducerConsumerQueue<SQLOperation*>* q, MySQLConnectionInfo& connInfo) : MySQLConnection(q, connInfo) { } - - //- Loads database type specific prepared statements - void DoPrepareStatements() override; -}; - -typedef DatabaseWorkerPool<WorldDatabaseConnection> WorldDatabaseWorkerPool; - enum WorldDatabaseStatements { /* Naming standard for defines: @@ -116,4 +103,19 @@ enum WorldDatabaseStatements MAX_WORLDDATABASE_STATEMENTS }; +class WorldDatabaseConnection : public MySQLConnection +{ +public: + typedef WorldDatabaseStatements Statements; + + //- Constructors for sync and async connections + WorldDatabaseConnection(MySQLConnectionInfo& connInfo) : MySQLConnection(connInfo) { } + WorldDatabaseConnection(ProducerConsumerQueue<SQLOperation*>* q, MySQLConnectionInfo& connInfo) : MySQLConnection(q, connInfo) { } + + //- Loads database type specific prepared statements + void DoPrepareStatements() override; +}; + +typedef DatabaseWorkerPool<WorldDatabaseConnection> WorldDatabaseWorkerPool; + #endif |
