From 492fd80b0621728889c6013682d07b420778ef9a Mon Sep 17 00:00:00 2001 From: Shauren Date: Wed, 11 Jul 2012 19:26:26 +0200 Subject: Core/Misc * Cleaned up packet manipulation methods, no need to keep duplicate sets of functions doing the same * Added a very basic ObjectGuid structure for easier (and endian-safe) method of accessing individual guid bytes --- src/server/shared/Database/PreparedStatement.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/server/shared/Database/PreparedStatement.cpp') diff --git a/src/server/shared/Database/PreparedStatement.cpp b/src/server/shared/Database/PreparedStatement.cpp index 58aa2bd3aa0..ae69fc5f913 100755 --- a/src/server/shared/Database/PreparedStatement.cpp +++ b/src/server/shared/Database/PreparedStatement.cpp @@ -230,11 +230,16 @@ void MySQLPreparedStatement::ClearParameters() } } +static bool ParementerIndexAssertFail(uint32 stmtIndex, uint8 index, uint32 paramCount) +{ + sLog->outError("Attempted to bind parameter %u%s on a PreparedStatement %u (statement has only %u parameters)", uint32(index) + 1, (index == 1 ? "st" : (index == 2 ? "nd" : (index == 3 ? "rd" : "nd"))), stmtIndex, paramCount); + return false; +} + //- Bind on mysql level bool MySQLPreparedStatement::CheckValidIndex(uint8 index) { - if (index >= m_paramCount) - return false; + ASSERT(index < m_paramCount || ParementerIndexAssertFail(m_stmt->m_index, index, m_paramCount)); if (m_paramsSet[index]) sLog->outSQLDriver("[WARNING] Prepared Statement (id: %u) trying to bind value on already bound index (%u).", m_stmt->m_index, index); -- cgit v1.2.3