diff options
-rw-r--r-- | cmake/options.cmake | 1 | ||||
-rw-r--r-- | cmake/showoptions.cmake | 19 | ||||
-rw-r--r-- | src/server/shared/Database/DatabaseWorkerPool.h | 2 | ||||
-rw-r--r-- | src/server/shared/Database/MySQLConnection.cpp | 14 |
4 files changed, 22 insertions, 14 deletions
diff --git a/cmake/options.cmake b/cmake/options.cmake index 00882d9bcb6..077eb17f637 100644 --- a/cmake/options.cmake +++ b/cmake/options.cmake @@ -16,4 +16,5 @@ option(USE_COREPCH "Use precompiled headers when compiling servers" option(USE_SFMT "Use SFMT as random numbergenerator" 0) option(WITH_WARNINGS "Show all warnings during compile" 0) option(WITH_COREDEBUG "Include additional debug-code in core" 0) +option(WITH_SQLDEBUG "Output SQL-queries to dedicated logfile" 0) option(WITH_SQL "Copy SQL files during installation" 0) diff --git a/cmake/showoptions.cmake b/cmake/showoptions.cmake index bb5cd1fe6b9..e8604eded46 100644 --- a/cmake/showoptions.cmake +++ b/cmake/showoptions.cmake @@ -38,12 +38,6 @@ else() message("* Build map/vmap tools : No (default)") endif() -if( WITH_SQL ) - message("* Install SQL-files : Yes") -else() - message("* Install SQL-files : No (default)") -endif() - if( USE_COREPCH ) message("* Build core w/PCH : Yes (default)") else() @@ -76,6 +70,13 @@ else() message("* Use coreside debug : No (default)") endif() +if( WITH_SQLDEBUG ) + message("* Use SQL-query logging : Yes") + add_definitions(-DSQLQUERY_LOG) +else() + message("* Use SQL-query logging : No (default)") +endif() + if( WIN32 ) if( USE_MYSQL_SOURCES ) message("* Use MySQL sourcetree : Yes (default)") @@ -84,4 +85,10 @@ if( WIN32 ) endif() endif( WIN32 ) +if( WITH_SQL ) + message("* Install SQL-files : Yes") +else() + message("* Install SQL-files : No (default)") +endif() + message("") diff --git a/src/server/shared/Database/DatabaseWorkerPool.h b/src/server/shared/Database/DatabaseWorkerPool.h index cd7974a3397..5a5ced4a504 100644 --- a/src/server/shared/Database/DatabaseWorkerPool.h +++ b/src/server/shared/Database/DatabaseWorkerPool.h @@ -250,7 +250,7 @@ class DatabaseWorkerPool void CommitTransaction(SQLTransaction transaction) { - #ifdef TRINITY_DEBUG + #ifdef SQLQUERY_LOG if (transaction->GetSize() == 0) { sLog.outSQLDriver("Transaction contains 0 queries. Not executing."); diff --git a/src/server/shared/Database/MySQLConnection.cpp b/src/server/shared/Database/MySQLConnection.cpp index 3707016765e..f34c650ce31 100644 --- a/src/server/shared/Database/MySQLConnection.cpp +++ b/src/server/shared/Database/MySQLConnection.cpp @@ -166,7 +166,7 @@ bool MySQLConnection::Execute(const char* sql) // guarded block for thread-safe mySQL request ACE_Guard<ACE_Thread_Mutex> query_connection_guard(m_Mutex); - #ifdef TRINITY_DEBUG + #ifdef SQLQUERY_LOG uint32 _s = getMSTime(); #endif if (mysql_query(m_Mysql, sql)) @@ -177,7 +177,7 @@ bool MySQLConnection::Execute(const char* sql) } else { - #ifdef TRINITY_DEBUG + #ifdef SQLQUERY_LOG sLog.outSQLDriver("[%u ms] SQL: %s", getMSTimeDiff(_s, getMSTime()), sql); #endif } @@ -206,7 +206,7 @@ bool MySQLConnection::Execute(PreparedStatement* stmt) MYSQL_STMT* msql_STMT = m_mStmt->GetSTMT(); MYSQL_BIND* msql_BIND = m_mStmt->GetBind(); - #ifdef TRINITY_DEBUG + #ifdef SQLQUERY_LOG uint32 _s = getMSTime(); #endif if (mysql_stmt_bind_param(msql_STMT, msql_BIND)) @@ -224,7 +224,7 @@ bool MySQLConnection::Execute(PreparedStatement* stmt) } else { - #ifdef TRINITY_DEBUG + #ifdef SQLQUERY_LOG sLog.outSQLDriver("[%u ms] Prepared SQL: %u", getMSTimeDiff(_s, getMSTime()), index); #endif m_mStmt->ClearParameters(); @@ -261,7 +261,7 @@ bool MySQLConnection::_Query(const char *sql, MYSQL_RES **pResult, MYSQL_FIELD * { // guarded block for thread-safe mySQL request ACE_Guard<ACE_Thread_Mutex> query_connection_guard(m_Mutex); - #ifdef TRINITY_DEBUG + #ifdef SQLQUERY_LOG uint32 _s = getMSTime(); #endif if (mysql_query(m_Mysql, sql)) @@ -272,7 +272,7 @@ bool MySQLConnection::_Query(const char *sql, MYSQL_RES **pResult, MYSQL_FIELD * } else { - #ifdef TRINITY_DEBUG + #ifdef SQLQUERY_LOG sLog.outSQLDriver("[%u ms] SQL: %s", getMSTimeDiff(_s,getMSTime()), sql); #endif } @@ -346,4 +346,4 @@ PreparedResultSet* MySQLConnection::Query(PreparedStatement* stmt) mysql_next_result(m_Mysql); } return new PreparedResultSet(stmt->m_stmt->GetSTMT()); -}
\ No newline at end of file +} |