aboutsummaryrefslogtreecommitdiff
path: root/src/server/database/Database/Implementation
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2020-07-13 21:30:33 +0200
committerShauren <shauren.trinity@gmail.com>2020-07-13 21:30:33 +0200
commit2ff1fd0e950970e973c26eda96abb60ac52c2538 (patch)
tree6b06fc09c5cee6d80651b78071f6abe1db95dff9 /src/server/database/Database/Implementation
parent49a99811de2c94a26b415efc0a322dfb33eefe62 (diff)
Core/DataStores: Replace harcoded prepared statement offsets with named constants
Diffstat (limited to 'src/server/database/Database/Implementation')
-rw-r--r--src/server/database/Database/Implementation/HotfixDatabase.cpp4
-rw-r--r--src/server/database/Database/Implementation/HotfixDatabase.h3
2 files changed, 5 insertions, 2 deletions
diff --git a/src/server/database/Database/Implementation/HotfixDatabase.cpp b/src/server/database/Database/Implementation/HotfixDatabase.cpp
index b4a3a5ae12e..098f3679a23 100644
--- a/src/server/database/Database/Implementation/HotfixDatabase.cpp
+++ b/src/server/database/Database/Implementation/HotfixDatabase.cpp
@@ -23,12 +23,12 @@
// Force max id statements to appear exactly right after normal data fetch statement
#define PREPARE_MAX_ID_STMT(stmtBase, sql, con) \
- static_assert(stmtBase + 1 == stmtBase##_MAX_ID, "Invalid prepared statement index for " #stmtBase "_MAX_ID"); \
+ static_assert(stmtBase + HOTFIX_MAX_ID_STMT_OFFSET == stmtBase##_MAX_ID, "Invalid prepared statement index for " #stmtBase "_MAX_ID"); \
PrepareStatement(stmtBase##_MAX_ID, sql, con);
// Force locale statements to be right after max id fetch statement
#define PREPARE_LOCALE_STMT(stmtBase, sql, con) \
- static_assert(stmtBase + 2 == stmtBase##_LOCALE, "Invalid prepared statement index for " #stmtBase "_LOCALE"); \
+ static_assert(stmtBase + HOTFIX_LOCALE_STMT_OFFSET == stmtBase##_LOCALE, "Invalid prepared statement index for " #stmtBase "_LOCALE"); \
PrepareStatement(stmtBase##_LOCALE, sql, con);
void HotfixDatabaseConnection::DoPrepareStatements()
diff --git a/src/server/database/Database/Implementation/HotfixDatabase.h b/src/server/database/Database/Implementation/HotfixDatabase.h
index df374496edb..57e797b2251 100644
--- a/src/server/database/Database/Implementation/HotfixDatabase.h
+++ b/src/server/database/Database/Implementation/HotfixDatabase.h
@@ -858,6 +858,9 @@ enum HotfixDatabaseStatements : uint32
MAX_HOTFIXDATABASE_STATEMENTS
};
+uint32 constexpr HOTFIX_MAX_ID_STMT_OFFSET = 1;
+uint32 constexpr HOTFIX_LOCALE_STMT_OFFSET = 2;
+
class TC_DATABASE_API HotfixDatabaseConnection : public MySQLConnection
{
public: