Core/DBLayer: Correctly print relevant mysql prepared statement creation error to give the end-user an idea of what exactly went wrong (missing SQL updates are the culprit of creation failure 99% of the time)

--HG--
branch : trunk
This commit is contained in:
Machiavelli
2010-09-20 20:53:32 +02:00
parent a509976369
commit ce2d4e9a20

View File

@@ -319,15 +319,15 @@ void MySQLConnection::PrepareStatement(uint32 index, const char* sql)
{
sLog.outSQLDriver("[ERROR]: In mysql_stmt_init() id: %u, sql: \"%s\"", index, sql);
sLog.outSQLDriver("[ERROR]: %s", mysql_error(m_Mysql));
ASSERT(false);
exit(1);
}
if (mysql_stmt_prepare(stmt, sql, static_cast<unsigned long>(strlen(sql))))
{
mysql_stmt_close(stmt);
sLog.outSQLDriver("[ERROR]: In mysql_stmt_prepare() id: %u, sql: \"%s\"", index, sql);
sLog.outSQLDriver("[ERROR]: %s", mysql_error(m_Mysql));
ASSERT(false);
sLog.outSQLDriver("[ERROR]: %s", mysql_stmt_error(stmt));
mysql_stmt_close(stmt);
exit(1);
}
MySQLPreparedStatement* mStmt = new MySQLPreparedStatement(stmt);