From e8e89f58fb800014f53341f12505f60ee2b5fb6f Mon Sep 17 00:00:00 2001 From: Shauren Date: Sat, 27 Jul 2019 01:00:37 +0200 Subject: Core/DBLayer: Prevent using prepared statements on wrong database --- src/server/database/Database/PreparedStatement.cpp | 36 +++++++++++----------- 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'src/server/database/Database/PreparedStatement.cpp') diff --git a/src/server/database/Database/PreparedStatement.cpp b/src/server/database/Database/PreparedStatement.cpp index c9da6452bf8..371543453da 100644 --- a/src/server/database/Database/PreparedStatement.cpp +++ b/src/server/database/Database/PreparedStatement.cpp @@ -26,13 +26,13 @@ #include #include -PreparedStatement::PreparedStatement(uint32 index) : +PreparedStatementBase::PreparedStatementBase(uint32 index) : m_stmt(NULL), m_index(index) { } -PreparedStatement::~PreparedStatement() { } +PreparedStatementBase::~PreparedStatementBase() { } -void PreparedStatement::BindParameters() +void PreparedStatementBase::BindParameters() { ASSERT(m_stmt); @@ -92,7 +92,7 @@ void PreparedStatement::BindParameters() } //- Bind to buffer -void PreparedStatement::setBool(const uint8 index, const bool value) +void PreparedStatementBase::setBool(const uint8 index, const bool value) { if (index >= statement_data.size()) statement_data.resize(index+1); @@ -101,7 +101,7 @@ void PreparedStatement::setBool(const uint8 index, const bool value) statement_data[index].type = TYPE_BOOL; } -void PreparedStatement::setUInt8(const uint8 index, const uint8 value) +void PreparedStatementBase::setUInt8(const uint8 index, const uint8 value) { if (index >= statement_data.size()) statement_data.resize(index+1); @@ -110,7 +110,7 @@ void PreparedStatement::setUInt8(const uint8 index, const uint8 value) statement_data[index].type = TYPE_UI8; } -void PreparedStatement::setUInt16(const uint8 index, const uint16 value) +void PreparedStatementBase::setUInt16(const uint8 index, const uint16 value) { if (index >= statement_data.size()) statement_data.resize(index+1); @@ -119,7 +119,7 @@ void PreparedStatement::setUInt16(const uint8 index, const uint16 value) statement_data[index].type = TYPE_UI16; } -void PreparedStatement::setUInt32(const uint8 index, const uint32 value) +void PreparedStatementBase::setUInt32(const uint8 index, const uint32 value) { if (index >= statement_data.size()) statement_data.resize(index+1); @@ -128,7 +128,7 @@ void PreparedStatement::setUInt32(const uint8 index, const uint32 value) statement_data[index].type = TYPE_UI32; } -void PreparedStatement::setUInt64(const uint8 index, const uint64 value) +void PreparedStatementBase::setUInt64(const uint8 index, const uint64 value) { if (index >= statement_data.size()) statement_data.resize(index+1); @@ -137,7 +137,7 @@ void PreparedStatement::setUInt64(const uint8 index, const uint64 value) statement_data[index].type = TYPE_UI64; } -void PreparedStatement::setInt8(const uint8 index, const int8 value) +void PreparedStatementBase::setInt8(const uint8 index, const int8 value) { if (index >= statement_data.size()) statement_data.resize(index+1); @@ -146,7 +146,7 @@ void PreparedStatement::setInt8(const uint8 index, const int8 value) statement_data[index].type = TYPE_I8; } -void PreparedStatement::setInt16(const uint8 index, const int16 value) +void PreparedStatementBase::setInt16(const uint8 index, const int16 value) { if (index >= statement_data.size()) statement_data.resize(index+1); @@ -155,7 +155,7 @@ void PreparedStatement::setInt16(const uint8 index, const int16 value) statement_data[index].type = TYPE_I16; } -void PreparedStatement::setInt32(const uint8 index, const int32 value) +void PreparedStatementBase::setInt32(const uint8 index, const int32 value) { if (index >= statement_data.size()) statement_data.resize(index+1); @@ -164,7 +164,7 @@ void PreparedStatement::setInt32(const uint8 index, const int32 value) statement_data[index].type = TYPE_I32; } -void PreparedStatement::setInt64(const uint8 index, const int64 value) +void PreparedStatementBase::setInt64(const uint8 index, const int64 value) { if (index >= statement_data.size()) statement_data.resize(index+1); @@ -173,7 +173,7 @@ void PreparedStatement::setInt64(const uint8 index, const int64 value) statement_data[index].type = TYPE_I64; } -void PreparedStatement::setFloat(const uint8 index, const float value) +void PreparedStatementBase::setFloat(const uint8 index, const float value) { if (index >= statement_data.size()) statement_data.resize(index+1); @@ -182,7 +182,7 @@ void PreparedStatement::setFloat(const uint8 index, const float value) statement_data[index].type = TYPE_FLOAT; } -void PreparedStatement::setDouble(const uint8 index, const double value) +void PreparedStatementBase::setDouble(const uint8 index, const double value) { if (index >= statement_data.size()) statement_data.resize(index+1); @@ -191,7 +191,7 @@ void PreparedStatement::setDouble(const uint8 index, const double value) statement_data[index].type = TYPE_DOUBLE; } -void PreparedStatement::setString(const uint8 index, const std::string& value) +void PreparedStatementBase::setString(const uint8 index, const std::string& value) { if (index >= statement_data.size()) statement_data.resize(index+1); @@ -201,7 +201,7 @@ void PreparedStatement::setString(const uint8 index, const std::string& value) statement_data[index].type = TYPE_STRING; } -void PreparedStatement::setBinary(const uint8 index, const std::vector& value) +void PreparedStatementBase::setBinary(const uint8 index, const std::vector& value) { if (index >= statement_data.size()) statement_data.resize(index + 1); @@ -210,7 +210,7 @@ void PreparedStatement::setBinary(const uint8 index, const std::vector& v statement_data[index].type = TYPE_BINARY; } -void PreparedStatement::setNull(const uint8 index) +void PreparedStatementBase::setNull(const uint8 index) { if (index >= statement_data.size()) statement_data.resize(index+1); @@ -472,7 +472,7 @@ std::string MySQLPreparedStatement::getQueryString(std::string const& sqlPattern } //- Execution -PreparedStatementTask::PreparedStatementTask(PreparedStatement* stmt, bool async) : +PreparedStatementTask::PreparedStatementTask(PreparedStatementBase* stmt, bool async) : m_stmt(stmt), m_result(nullptr) { m_has_result = async; // If it's async, then there's a result -- cgit v1.2.3