mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-30 21:57:01 +01:00
Core: Removed more operator workarounds for ACE_Singleton (missed previously because of inconsistent naming)
--HG-- branch : trunk
This commit is contained in:
@@ -64,7 +64,7 @@ class DatabaseWorkerPool
|
||||
|
||||
~DatabaseWorkerPool()
|
||||
{
|
||||
sLog.outSQLDriver("~DatabaseWorkerPool for '%s'.", m_connectionInfo.database.c_str());
|
||||
sLog->outSQLDriver("~DatabaseWorkerPool for '%s'.", m_connectionInfo.database.c_str());
|
||||
mysql_library_end();
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ class DatabaseWorkerPool
|
||||
{
|
||||
m_connectionInfo = MySQLConnectionInfo(infoString);
|
||||
|
||||
sLog.outSQLDriver("Opening databasepool '%s'. Async threads: %u, synch threads: %u", m_connectionInfo.database.c_str(), async_threads, synch_threads);
|
||||
sLog->outSQLDriver("Opening databasepool '%s'. Async threads: %u, synch threads: %u", m_connectionInfo.database.c_str(), async_threads, synch_threads);
|
||||
|
||||
/// Open asynchronous connections (delayed operations)
|
||||
m_connections[IDX_ASYNC].resize(async_threads);
|
||||
@@ -94,13 +94,13 @@ class DatabaseWorkerPool
|
||||
++m_connectionCount[IDX_SYNCH];
|
||||
}
|
||||
|
||||
sLog.outSQLDriver("Databasepool opened succesfuly. %u total connections running.", (m_connectionCount[IDX_SYNCH] + m_connectionCount[IDX_ASYNC]));
|
||||
sLog->outSQLDriver("Databasepool opened succesfuly. %u total connections running.", (m_connectionCount[IDX_SYNCH] + m_connectionCount[IDX_ASYNC]));
|
||||
return true;
|
||||
}
|
||||
|
||||
void Close()
|
||||
{
|
||||
sLog.outSQLDriver("Closing down databasepool '%s'.", m_connectionInfo.database.c_str());
|
||||
sLog->outSQLDriver("Closing down databasepool '%s'.", m_connectionInfo.database.c_str());
|
||||
|
||||
/// Shuts down delaythreads for this connection pool.
|
||||
m_queue->queue()->deactivate();
|
||||
@@ -118,7 +118,7 @@ class DatabaseWorkerPool
|
||||
--m_connectionCount[IDX_ASYNC];
|
||||
}
|
||||
|
||||
sLog.outSQLDriver("Asynchronous connections on databasepool '%s' terminated. Proceeding with synchronous connections.", m_connectionInfo.database.c_str());
|
||||
sLog->outSQLDriver("Asynchronous connections on databasepool '%s' terminated. Proceeding with synchronous connections.", m_connectionInfo.database.c_str());
|
||||
|
||||
/// Shut down the synchronous connections
|
||||
for (uint8 i = 0; i < m_connectionCount[IDX_SYNCH]; ++i)
|
||||
@@ -130,7 +130,7 @@ class DatabaseWorkerPool
|
||||
--m_connectionCount[IDX_SYNCH];
|
||||
}
|
||||
|
||||
sLog.outSQLDriver("All connections on databasepool %s closed.", m_connectionInfo.database.c_str());
|
||||
sLog->outSQLDriver("All connections on databasepool %s closed.", m_connectionInfo.database.c_str());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -335,15 +335,15 @@ class DatabaseWorkerPool
|
||||
//! were appended to the transaction will be respected during execution.
|
||||
void CommitTransaction(SQLTransaction transaction)
|
||||
{
|
||||
if (sLog.GetSQLDriverQueryLogging())
|
||||
if (sLog->GetSQLDriverQueryLogging())
|
||||
{
|
||||
switch (transaction->GetSize())
|
||||
{
|
||||
case 0:
|
||||
sLog.outSQLDriver("Transaction contains 0 queries. Not executing.");
|
||||
sLog->outSQLDriver("Transaction contains 0 queries. Not executing.");
|
||||
return;
|
||||
case 1:
|
||||
sLog.outSQLDriver("Warning: Transaction only holds 1 query, consider removing Transaction context in code.");
|
||||
sLog->outSQLDriver("Warning: Transaction only holds 1 query, consider removing Transaction context in code.");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -43,7 +43,7 @@ class Field
|
||||
#ifdef TRINITY_DEBUG
|
||||
if (!IsNumeric())
|
||||
{
|
||||
sLog.outSQLDriver("Error: GetUInt8() on non-numeric field.");
|
||||
sLog->outSQLDriver("Error: GetUInt8() on non-numeric field.");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@@ -60,7 +60,7 @@ class Field
|
||||
#ifdef TRINITY_DEBUG
|
||||
if (!IsNumeric())
|
||||
{
|
||||
sLog.outSQLDriver("Error: GeInt8() on non-numeric field.");
|
||||
sLog->outSQLDriver("Error: GeInt8() on non-numeric field.");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@@ -77,7 +77,7 @@ class Field
|
||||
#ifdef TRINITY_DEBUG
|
||||
if (!IsNumeric())
|
||||
{
|
||||
sLog.outSQLDriver("Error: GetUInt16() on non-numeric field.");
|
||||
sLog->outSQLDriver("Error: GetUInt16() on non-numeric field.");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@@ -94,7 +94,7 @@ class Field
|
||||
#ifdef TRINITY_DEBUG
|
||||
if (!IsNumeric())
|
||||
{
|
||||
sLog.outSQLDriver("Error: GetInt16() on non-numeric field.");
|
||||
sLog->outSQLDriver("Error: GetInt16() on non-numeric field.");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@@ -111,7 +111,7 @@ class Field
|
||||
#ifdef TRINITY_DEBUG
|
||||
if (!IsNumeric())
|
||||
{
|
||||
sLog.outSQLDriver("Error: GetUInt32() on non-numeric field.");
|
||||
sLog->outSQLDriver("Error: GetUInt32() on non-numeric field.");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@@ -128,7 +128,7 @@ class Field
|
||||
#ifdef TRINITY_DEBUG
|
||||
if (!IsNumeric())
|
||||
{
|
||||
sLog.outSQLDriver("Error: GetInt32() on non-numeric field.");
|
||||
sLog->outSQLDriver("Error: GetInt32() on non-numeric field.");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@@ -145,7 +145,7 @@ class Field
|
||||
#ifdef TRINITY_DEBUG
|
||||
if (!IsNumeric())
|
||||
{
|
||||
sLog.outSQLDriver("Error: GetUInt64() on non-numeric field.");
|
||||
sLog->outSQLDriver("Error: GetUInt64() on non-numeric field.");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@@ -162,7 +162,7 @@ class Field
|
||||
#ifdef TRINITY_DEBUG
|
||||
if (!IsNumeric())
|
||||
{
|
||||
sLog.outSQLDriver("Error: GetInt64() on non-numeric field.");
|
||||
sLog->outSQLDriver("Error: GetInt64() on non-numeric field.");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@@ -179,7 +179,7 @@ class Field
|
||||
#ifdef TRINITY_DEBUG
|
||||
if (!IsNumeric())
|
||||
{
|
||||
sLog.outSQLDriver("Error: GetFloat() on non-numeric field.");
|
||||
sLog->outSQLDriver("Error: GetFloat() on non-numeric field.");
|
||||
return 0.0f;
|
||||
}
|
||||
#endif
|
||||
@@ -196,7 +196,7 @@ class Field
|
||||
#ifdef TRINITY_DEBUG
|
||||
if (!IsNumeric())
|
||||
{
|
||||
sLog.outSQLDriver("Error: GetDouble() on non-numeric field.");
|
||||
sLog->outSQLDriver("Error: GetDouble() on non-numeric field.");
|
||||
return 0.0f;
|
||||
}
|
||||
#endif
|
||||
@@ -213,7 +213,7 @@ class Field
|
||||
#ifdef TRINITY_DEBUG
|
||||
if (IsNumeric())
|
||||
{
|
||||
sLog.outSQLDriver("Error: GetCString() on numeric field.");
|
||||
sLog->outSQLDriver("Error: GetCString() on numeric field.");
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
@@ -311,7 +311,7 @@ class Field
|
||||
MYSQL_TYPE_SET:
|
||||
*/
|
||||
default:
|
||||
sLog.outSQLDriver("SQL::SizeForType(): invalid field type %u", uint32(field->type));
|
||||
sLog->outSQLDriver("SQL::SizeForType(): invalid field type %u", uint32(field->type));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ MySQLConnection::~MySQLConnection()
|
||||
{
|
||||
ASSERT (m_Mysql); /// MySQL context must be present at this point
|
||||
|
||||
sLog.outSQLDriver("MySQLConnection::~MySQLConnection()");
|
||||
sLog->outSQLDriver("MySQLConnection::~MySQLConnection()");
|
||||
for (size_t i = 0; i < m_stmts.size(); ++i)
|
||||
delete m_stmts[i];
|
||||
|
||||
@@ -76,7 +76,7 @@ bool MySQLConnection::Open()
|
||||
mysqlInit = mysql_init(NULL);
|
||||
if (!mysqlInit)
|
||||
{
|
||||
sLog.outError("Could not initialize Mysql connection to database `%s`", m_connectionInfo.database.c_str());
|
||||
sLog->outError("Could not initialize Mysql connection to database `%s`", m_connectionInfo.database.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -120,13 +120,13 @@ bool MySQLConnection::Open()
|
||||
{
|
||||
if (!m_reconnecting)
|
||||
{
|
||||
sLog.outSQLDriver("MySQL client library: %s", mysql_get_client_info());
|
||||
sLog.outSQLDriver("MySQL server ver: %s ", mysql_get_server_info(m_Mysql));
|
||||
sLog->outSQLDriver("MySQL client library: %s", mysql_get_client_info());
|
||||
sLog->outSQLDriver("MySQL server ver: %s ", mysql_get_server_info(m_Mysql));
|
||||
if (mysql_get_server_version(m_Mysql) != mysql_get_client_version())
|
||||
sLog.outSQLDriver("[WARNING] MySQL client/server version mismatch; may conflict with behaviour of prepared statements.");
|
||||
sLog->outSQLDriver("[WARNING] MySQL client/server version mismatch; may conflict with behaviour of prepared statements.");
|
||||
}
|
||||
|
||||
sLog.outDetail("Connected to MySQL database at %s", m_connectionInfo.host.c_str());
|
||||
sLog->outDetail("Connected to MySQL database at %s", m_connectionInfo.host.c_str());
|
||||
mysql_autocommit(m_Mysql, 1);
|
||||
|
||||
// set connection properties to UTF8 to properly handle locales for different
|
||||
@@ -136,7 +136,7 @@ bool MySQLConnection::Open()
|
||||
}
|
||||
else
|
||||
{
|
||||
sLog.outError("Could not connect to MySQL database at %s: %s\n", m_connectionInfo.host.c_str(), mysql_error(mysqlInit));
|
||||
sLog->outError("Could not connect to MySQL database at %s: %s\n", m_connectionInfo.host.c_str(), mysql_error(mysqlInit));
|
||||
mysql_close(mysqlInit);
|
||||
return false;
|
||||
}
|
||||
@@ -149,24 +149,24 @@ bool MySQLConnection::Execute(const char* sql)
|
||||
|
||||
{
|
||||
uint32 _s = 0;
|
||||
if (sLog.GetSQLDriverQueryLogging())
|
||||
if (sLog->GetSQLDriverQueryLogging())
|
||||
_s = getMSTime();
|
||||
|
||||
if (mysql_query(m_Mysql, sql))
|
||||
{
|
||||
uint32 lErrno = mysql_errno(m_Mysql);
|
||||
|
||||
sLog.outSQLDriver("SQL: %s", sql);
|
||||
sLog.outSQLDriver("ERROR: [%u] %s", lErrno, mysql_error(m_Mysql));
|
||||
sLog->outSQLDriver("SQL: %s", sql);
|
||||
sLog->outSQLDriver("ERROR: [%u] %s", lErrno, mysql_error(m_Mysql));
|
||||
|
||||
if (_HandleMySQLErrno(lErrno)) // If it returns true, an error was handled succesfuly (ie reconnection)
|
||||
return Execute(sql); // Try again
|
||||
|
||||
return false;
|
||||
}
|
||||
else if (sLog.GetSQLDriverQueryLogging())
|
||||
else if (sLog->GetSQLDriverQueryLogging())
|
||||
{
|
||||
sLog.outSQLDriver("[%u ms] SQL: %s", getMSTimeDiff(_s, getMSTime()), sql);
|
||||
sLog->outSQLDriver("[%u ms] SQL: %s", getMSTimeDiff(_s, getMSTime()), sql);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -191,13 +191,13 @@ bool MySQLConnection::Execute(PreparedStatement* stmt)
|
||||
MYSQL_BIND* msql_BIND = m_mStmt->GetBind();
|
||||
|
||||
uint32 _s = 0;
|
||||
if (sLog.GetSQLDriverQueryLogging())
|
||||
if (sLog->GetSQLDriverQueryLogging())
|
||||
_s = getMSTime();
|
||||
|
||||
if (mysql_stmt_bind_param(msql_STMT, msql_BIND))
|
||||
{
|
||||
uint32 lErrno = mysql_errno(m_Mysql);
|
||||
sLog.outSQLDriver("[ERROR]: PreparedStatement (id: %u, database: `%s`) error binding params: [%u] %s",
|
||||
sLog->outSQLDriver("[ERROR]: PreparedStatement (id: %u, database: `%s`) error binding params: [%u] %s",
|
||||
index, m_connectionInfo.database.c_str(), lErrno, mysql_stmt_error(msql_STMT));
|
||||
|
||||
if (_HandleMySQLErrno(lErrno)) // If it returns true, an error was handled succesfuly (ie reconnection)
|
||||
@@ -210,7 +210,7 @@ bool MySQLConnection::Execute(PreparedStatement* stmt)
|
||||
if (mysql_stmt_execute(msql_STMT))
|
||||
{
|
||||
uint32 lErrno = mysql_errno(m_Mysql);
|
||||
sLog.outSQLDriver("[ERROR]: PreparedStatement (id: %u, database: `%s`) error executing: [%u] %s",
|
||||
sLog->outSQLDriver("[ERROR]: PreparedStatement (id: %u, database: `%s`) error executing: [%u] %s",
|
||||
index, m_connectionInfo.database.c_str(), lErrno, mysql_stmt_error(msql_STMT));
|
||||
|
||||
if (_HandleMySQLErrno(lErrno)) // If it returns true, an error was handled succesfuly (ie reconnection)
|
||||
@@ -220,8 +220,8 @@ bool MySQLConnection::Execute(PreparedStatement* stmt)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (sLog.GetSQLDriverQueryLogging())
|
||||
sLog.outSQLDriver("[%u ms] Prepared SQL: %u on database `%s`",
|
||||
if (sLog->GetSQLDriverQueryLogging())
|
||||
sLog->outSQLDriver("[%u ms] Prepared SQL: %u on database `%s`",
|
||||
getMSTimeDiff(_s, getMSTime()), index, m_connectionInfo.database.c_str());
|
||||
|
||||
m_mStmt->ClearParameters();
|
||||
@@ -247,13 +247,13 @@ bool MySQLConnection::_Query(PreparedStatement* stmt, MYSQL_RES **pResult, uint6
|
||||
MYSQL_BIND* msql_BIND = m_mStmt->GetBind();
|
||||
|
||||
uint32 _s = 0;
|
||||
if (sLog.GetSQLDriverQueryLogging())
|
||||
if (sLog->GetSQLDriverQueryLogging())
|
||||
_s = getMSTime();
|
||||
|
||||
if (mysql_stmt_bind_param(msql_STMT, msql_BIND))
|
||||
{
|
||||
uint32 lErrno = mysql_errno(m_Mysql);
|
||||
sLog.outSQLDriver("[ERROR]: PreparedStatement (id: %u, database: `%s`) error binding params: [%u] %s",
|
||||
sLog->outSQLDriver("[ERROR]: PreparedStatement (id: %u, database: `%s`) error binding params: [%u] %s",
|
||||
index, m_connectionInfo.database.c_str(), lErrno, mysql_stmt_error(msql_STMT));
|
||||
|
||||
if (_HandleMySQLErrno(lErrno)) // If it returns true, an error was handled succesfuly (ie reconnection)
|
||||
@@ -266,7 +266,7 @@ bool MySQLConnection::_Query(PreparedStatement* stmt, MYSQL_RES **pResult, uint6
|
||||
if (mysql_stmt_execute(msql_STMT))
|
||||
{
|
||||
uint32 lErrno = mysql_errno(m_Mysql);
|
||||
sLog.outSQLDriver("[ERROR]: PreparedStatement (id: %u, database: `%s`) error executing: [%u] %s",
|
||||
sLog->outSQLDriver("[ERROR]: PreparedStatement (id: %u, database: `%s`) error executing: [%u] %s",
|
||||
index, m_connectionInfo.database.c_str(), lErrno, mysql_stmt_error(msql_STMT));
|
||||
|
||||
if (_HandleMySQLErrno(lErrno)) // If it returns true, an error was handled succesfuly (ie reconnection)
|
||||
@@ -276,8 +276,8 @@ bool MySQLConnection::_Query(PreparedStatement* stmt, MYSQL_RES **pResult, uint6
|
||||
return false;
|
||||
}
|
||||
|
||||
if (sLog.GetSQLDriverQueryLogging())
|
||||
sLog.outSQLDriver("[%u ms] Prepared SQL: %u on database `%s`",
|
||||
if (sLog->GetSQLDriverQueryLogging())
|
||||
sLog->outSQLDriver("[%u ms] Prepared SQL: %u on database `%s`",
|
||||
getMSTimeDiff(_s, getMSTime()), index, m_connectionInfo.database.c_str());
|
||||
|
||||
m_mStmt->ClearParameters();
|
||||
@@ -314,23 +314,23 @@ bool MySQLConnection::_Query(const char *sql, MYSQL_RES **pResult, MYSQL_FIELD *
|
||||
|
||||
{
|
||||
uint32 _s = 0;
|
||||
if (sLog.GetSQLDriverQueryLogging())
|
||||
if (sLog->GetSQLDriverQueryLogging())
|
||||
_s = getMSTime();
|
||||
|
||||
if (mysql_query(m_Mysql, sql))
|
||||
{
|
||||
uint32 lErrno = mysql_errno(m_Mysql);
|
||||
sLog.outSQLDriver("SQL: %s", sql);
|
||||
sLog.outSQLDriver("ERROR: [%u] %s", lErrno, mysql_error(m_Mysql));
|
||||
sLog->outSQLDriver("SQL: %s", sql);
|
||||
sLog->outSQLDriver("ERROR: [%u] %s", lErrno, mysql_error(m_Mysql));
|
||||
|
||||
if (_HandleMySQLErrno(lErrno)) // If it returns true, an error was handled succesfuly (ie reconnection)
|
||||
return _Query(sql, pResult, pFields, pRowCount, pFieldCount); // We try again
|
||||
|
||||
return false;
|
||||
}
|
||||
else if (sLog.GetSQLDriverQueryLogging())
|
||||
else if (sLog->GetSQLDriverQueryLogging())
|
||||
{
|
||||
sLog.outSQLDriver("[%u ms] SQL: %s", getMSTimeDiff(_s,getMSTime()), sql);
|
||||
sLog->outSQLDriver("[%u ms] SQL: %s", getMSTimeDiff(_s,getMSTime()), sql);
|
||||
}
|
||||
|
||||
*pResult = mysql_store_result(m_Mysql);
|
||||
@@ -372,7 +372,7 @@ MySQLPreparedStatement* MySQLConnection::GetPreparedStatement(uint32 index)
|
||||
ASSERT(index < m_stmts.size());
|
||||
MySQLPreparedStatement* ret = m_stmts[index];
|
||||
if (!ret)
|
||||
sLog.outSQLDriver("ERROR: Could not fetch prepared statement %u on database `%s`, connection type: %s.",
|
||||
sLog->outSQLDriver("ERROR: Could not fetch prepared statement %u on database `%s`, connection type: %s.",
|
||||
index, m_connectionInfo.database.c_str(), (m_connectionFlags & CONNECTION_ASYNC) ? "asynchronous" : "synchronous");
|
||||
|
||||
return ret;
|
||||
@@ -396,15 +396,15 @@ void MySQLConnection::PrepareStatement(uint32 index, const char* sql, bool async
|
||||
MYSQL_STMT * stmt = mysql_stmt_init(m_Mysql);
|
||||
if (!stmt)
|
||||
{
|
||||
sLog.outSQLDriver("[ERROR]: In mysql_stmt_init() id: %u, sql: \"%s\"", index, sql);
|
||||
sLog.outSQLDriver("[ERROR]: %s", mysql_error(m_Mysql));
|
||||
sLog->outSQLDriver("[ERROR]: In mysql_stmt_init() id: %u, sql: \"%s\"", index, sql);
|
||||
sLog->outSQLDriver("[ERROR]: %s", mysql_error(m_Mysql));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (mysql_stmt_prepare(stmt, sql, static_cast<unsigned long>(strlen(sql))))
|
||||
{
|
||||
sLog.outSQLDriver("[ERROR]: In mysql_stmt_prepare() id: %u, sql: \"%s\"", index, sql);
|
||||
sLog.outSQLDriver("[ERROR]: %s", mysql_stmt_error(stmt));
|
||||
sLog->outSQLDriver("[ERROR]: In mysql_stmt_prepare() id: %u, sql: \"%s\"", index, sql);
|
||||
sLog->outSQLDriver("[ERROR]: %s", mysql_stmt_error(stmt));
|
||||
mysql_stmt_close(stmt);
|
||||
exit(1);
|
||||
}
|
||||
@@ -431,7 +431,7 @@ PreparedResultSet* MySQLConnection::Query(PreparedStatement* stmt)
|
||||
|
||||
bool MySQLConnection::_HandleMySQLErrno(uint32 errNo)
|
||||
{
|
||||
sLog.outDebug("%s", __FUNCTION__);
|
||||
sLog->outDebug("%s", __FUNCTION__);
|
||||
|
||||
switch (errNo)
|
||||
{
|
||||
@@ -445,9 +445,9 @@ bool MySQLConnection::_HandleMySQLErrno(uint32 errNo)
|
||||
mysql_close(GetHandle());
|
||||
if (this->Open()) // Don't remove 'this' pointer unless you want to skip loading all prepared statements....
|
||||
{
|
||||
sLog.outSQLDriver("Connection to the MySQL server is active.");
|
||||
sLog->outSQLDriver("Connection to the MySQL server is active.");
|
||||
if (oldThreadId != mysql_thread_id(GetHandle()))
|
||||
sLog.outSQLDriver("Succesfuly reconnected to %s @%s:%s (%s).",
|
||||
sLog->outSQLDriver("Succesfuly reconnected to %s @%s:%s (%s).",
|
||||
m_connectionInfo.database.c_str(), m_connectionInfo.host.c_str(), m_connectionInfo.port_or_socket.c_str(),
|
||||
(m_connectionFlags & CONNECTION_ASYNC) ? "asynchronous" : "synchronous");
|
||||
|
||||
@@ -466,7 +466,7 @@ bool MySQLConnection::_HandleMySQLErrno(uint32 errNo)
|
||||
return false;
|
||||
|
||||
default:
|
||||
sLog.outSQLDriver("Unhandled MySQL errno %u. Unexpected behaviour possible.", errNo);
|
||||
sLog->outSQLDriver("Unhandled MySQL errno %u. Unexpected behaviour possible.", errNo);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ void PreparedStatement::BindParameters()
|
||||
}
|
||||
#ifdef _DEBUG
|
||||
if (i < m_stmt->m_paramCount)
|
||||
sLog.outSQLDriver("[WARNING]: BindParameters() for statement %u did not bind all allocated parameters", m_index);
|
||||
sLog->outSQLDriver("[WARNING]: BindParameters() for statement %u did not bind all allocated parameters", m_index);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -224,7 +224,7 @@ bool MySQLPreparedStatement::CheckValidIndex(uint8 index)
|
||||
return false;
|
||||
|
||||
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);
|
||||
sLog->outSQLDriver("[WARNING] Prepared Statement (id: %u) trying to bind value on already bound index (%u).", m_stmt->m_index, index);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ bool SQLQueryHolder::SetQuery(size_t index, const char *sql)
|
||||
{
|
||||
if (m_queries.size() <= index)
|
||||
{
|
||||
sLog.outError("Query index (%zu) out of range (size: %u) for query: %s", index, (uint32)m_queries.size(), sql);
|
||||
sLog->outError("Query index (%zu) out of range (size: %u) for query: %s", index, (uint32)m_queries.size(), sql);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ bool SQLQueryHolder::SetPQuery(size_t index, const char *format, ...)
|
||||
{
|
||||
if (!format)
|
||||
{
|
||||
sLog.outError("Query (index: %zu) is empty.",index);
|
||||
sLog->outError("Query (index: %zu) is empty.",index);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ bool SQLQueryHolder::SetPQuery(size_t index, const char *format, ...)
|
||||
|
||||
if (res == -1)
|
||||
{
|
||||
sLog.outError("SQL Query truncated (and not execute) for format: %s",format);
|
||||
sLog->outError("SQL Query truncated (and not execute) for format: %s",format);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ bool SQLQueryHolder::SetPreparedQuery(size_t index, PreparedStatement* stmt)
|
||||
{
|
||||
if (m_queries.size() <= index)
|
||||
{
|
||||
sLog.outError("Query index (%zu) out of range (size: %u) for prepared statement", index, (uint32)m_queries.size());
|
||||
sLog->outError("Query index (%zu) out of range (size: %u) for prepared statement", index, (uint32)m_queries.size());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ m_length(NULL)
|
||||
//- This is where we store the (entire) resultset
|
||||
if (mysql_stmt_store_result(m_stmt))
|
||||
{
|
||||
sLog.outSQLDriver("%s:mysql_stmt_store_result, cannot bind result from MySQL server. Error: %s", __FUNCTION__, mysql_stmt_error(m_stmt));
|
||||
sLog->outSQLDriver("%s:mysql_stmt_store_result, cannot bind result from MySQL server. Error: %s", __FUNCTION__, mysql_stmt_error(m_stmt));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ m_length(NULL)
|
||||
//- This is where we bind the bind the buffer to the statement
|
||||
if (mysql_stmt_bind_result(m_stmt, m_rBind))
|
||||
{
|
||||
sLog.outSQLDriver("%s:mysql_stmt_bind_result, cannot bind result from MySQL server. Error: %s", __FUNCTION__, mysql_stmt_error(m_stmt));
|
||||
sLog->outSQLDriver("%s:mysql_stmt_bind_result, cannot bind result from MySQL server. Error: %s", __FUNCTION__, mysql_stmt_error(m_stmt));
|
||||
delete[] m_rBind;
|
||||
delete[] m_isNull;
|
||||
delete[] m_length;
|
||||
|
||||
@@ -124,7 +124,7 @@ void SQLStorageLoaderBase<T>::Load(SQLStorage &store)
|
||||
QueryResult result = WorldDatabase.PQuery("SELECT MAX(%s) FROM %s", store.entry_field, store.table);
|
||||
if(!result)
|
||||
{
|
||||
sLog.outError("Error loading %s table (not exist?)\n", store.table);
|
||||
sLog->outError("Error loading %s table (not exist?)\n", store.table);
|
||||
exit(1); // Stop server at loading non exited table or not accessable table
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ void SQLStorageLoaderBase<T>::Load(SQLStorage &store)
|
||||
|
||||
if(!result)
|
||||
{
|
||||
sLog.outError("%s table is empty!\n", store.table);
|
||||
sLog->outError("%s table is empty!\n", store.table);
|
||||
store.RecordCount = 0;
|
||||
return;
|
||||
}
|
||||
@@ -154,7 +154,7 @@ void SQLStorageLoaderBase<T>::Load(SQLStorage &store)
|
||||
if(store.iNumFields != result->GetFieldCount())
|
||||
{
|
||||
store.RecordCount = 0;
|
||||
sLog.outError("Error in %s table, probably sql file format was updated (there should be %d fields in sql).\n", store.table, store.iNumFields);
|
||||
sLog->outError("Error in %s table, probably sql file format was updated (there should be %d fields in sql).\n", store.table, store.iNumFields);
|
||||
exit(1); // Stop server at loading broken or non-compatible table.
|
||||
}
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ bool TransactionTask::Execute()
|
||||
ASSERT(stmt);
|
||||
if (!m_conn->Execute(stmt))
|
||||
{
|
||||
sLog.outSQLDriver("[Warning] Transaction aborted. %u queries not executed.", (uint32)queries.size());
|
||||
sLog->outSQLDriver("[Warning] Transaction aborted. %u queries not executed.", (uint32)queries.size());
|
||||
m_conn->RollbackTransaction();
|
||||
return false;
|
||||
}
|
||||
@@ -96,7 +96,7 @@ bool TransactionTask::Execute()
|
||||
ASSERT(sql);
|
||||
if (!m_conn->Execute(sql))
|
||||
{
|
||||
sLog.outSQLDriver("[Warning] Transaction aborted. %u queries not executed.", (uint32)queries.size());
|
||||
sLog->outSQLDriver("[Warning] Transaction aborted. %u queries not executed.", (uint32)queries.size());
|
||||
m_conn->RollbackTransaction();
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user