diff options
Diffstat (limited to 'src')
| -rwxr-xr-x | src/server/authserver/Realms/RealmList.cpp | 18 | ||||
| -rw-r--r-- | src/server/authserver/authserver.conf.dist | 8 | ||||
| -rw-r--r-- | src/server/game/Battlegrounds/ArenaTeamMgr.cpp | 8 | ||||
| -rwxr-xr-x | src/server/game/Chat/Commands/Level3.cpp | 12 | ||||
| -rwxr-xr-x | src/server/game/Handlers/MailHandler.cpp | 2 | ||||
| -rwxr-xr-x | src/server/game/Tickets/TicketMgr.cpp | 4 | ||||
| -rw-r--r-- | src/server/shared/Database/Implementation/CharacterDatabase.cpp | 2 | ||||
| -rwxr-xr-x | src/server/shared/Database/Implementation/LoginDatabase.cpp | 2 | ||||
| -rwxr-xr-x | src/server/shared/Database/Implementation/LoginDatabase.h | 2 | ||||
| -rwxr-xr-x | src/server/shared/Database/PreparedStatement.cpp | 46 | ||||
| -rwxr-xr-x | src/server/shared/Logging/Log.h | 2 |
11 files changed, 71 insertions, 35 deletions
diff --git a/src/server/authserver/Realms/RealmList.cpp b/src/server/authserver/Realms/RealmList.cpp index f856156825d..d988b940809 100755 --- a/src/server/authserver/Realms/RealmList.cpp +++ b/src/server/authserver/Realms/RealmList.cpp @@ -70,7 +70,7 @@ void RealmList::UpdateRealms(bool init) { sLog->outDetail("Updating Realm List..."); - PreparedStatement *stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_REALMLIST); + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_REALMLIST); PreparedQueryResult result = LoginDatabase.Query(stmt); // Circle through results and add them to the realm map @@ -79,16 +79,16 @@ void RealmList::UpdateRealms(bool init) do { Field* fields = result->Fetch(); - uint32 realmId = fields[0].GetUInt32(); - const std::string& name = fields[1].GetString(); + uint32 realmId = fields[0].GetUInt32(); + const std::string& name = fields[1].GetString(); const std::string& address = fields[2].GetString(); - uint16 port = fields[3].GetUInt16(); - uint8 icon = fields[4].GetUInt8(); - RealmFlags flag = RealmFlags(fields[5].GetUInt8()); - uint8 timezone = fields[6].GetUInt8(); + uint16 port = fields[3].GetUInt16(); + uint8 icon = fields[4].GetUInt8(); + RealmFlags flag = RealmFlags(fields[5].GetUInt8()); + uint8 timezone = fields[6].GetUInt8(); uint8 allowedSecurityLevel = fields[7].GetUInt8(); - float pop = fields[8].GetFloat(); - uint32 build = fields[9].GetUInt32(); + float pop = fields[8].GetFloat(); + uint32 build = fields[9].GetUInt32(); UpdateRealm(realmId, name, address, port, icon, flag, timezone, (allowedSecurityLevel <= SEC_ADMINISTRATOR ? AccountTypes(allowedSecurityLevel) : SEC_ADMINISTRATOR), pop, build); diff --git a/src/server/authserver/authserver.conf.dist b/src/server/authserver/authserver.conf.dist index 86423d53e18..e9ed4bd752d 100644 --- a/src/server/authserver/authserver.conf.dist +++ b/src/server/authserver/authserver.conf.dist @@ -111,6 +111,14 @@ DebugLogMask = 64 SQLDriverLogFile = "" # +# SQLDriverQueryLogging +# Description: Log SQL queries to the SQLDriverLogFile and console. +# Default: 0 - (Disabled, Query errors only) +# 1 - (Enabled, Full query logging - may have performance impact) + +SQLDriverQueryLogging = 0 + +# # LogTimestamp # Description: Append timestamp to the server log file name. # Logname_YYYY-MM-DD_HH-MM-SS.Ext for Logname.Ext diff --git a/src/server/game/Battlegrounds/ArenaTeamMgr.cpp b/src/server/game/Battlegrounds/ArenaTeamMgr.cpp index ab451a38fa8..1c24dfc061d 100644 --- a/src/server/game/Battlegrounds/ArenaTeamMgr.cpp +++ b/src/server/game/Battlegrounds/ArenaTeamMgr.cpp @@ -94,10 +94,10 @@ void ArenaTeamMgr::LoadArenaTeams() // Clean out the trash before loading anything CharacterDatabase.Execute("DELETE FROM arena_team_member WHERE arenaTeamId NOT IN (SELECT arenaTeamId FROM arena_team)"); // One-time query - // 0 1 2 3 4 5 6 7 8 - QueryResult result = CharacterDatabase.Query("SELECT arena_team.arenaTeamId, name, captainGuid, type, backgroundColor, emblemStyle, emblemColor, borderStyle, borderColor, " - // 9 10 11 12 13 14 - "rating, weekGames, weekWins, seasonGames, seasonWins, rank FROM arena_team ORDER BY arena_team.arenaTeamId ASC"); + // 0 1 2 3 4 5 6 7 8 + QueryResult result = CharacterDatabase.Query("SELECT arenaTeamId, name, captainGuid, type, backgroundColor, emblemStyle, emblemColor, borderStyle, borderColor, " + // 9 10 11 12 13 14 + "rating, weekGames, weekWins, seasonGames, seasonWins, rank FROM arena_team ORDER BY arenaTeamId ASC"); if (!result) { diff --git a/src/server/game/Chat/Commands/Level3.cpp b/src/server/game/Chat/Commands/Level3.cpp index a88bf06898c..d3417705867 100755 --- a/src/server/game/Chat/Commands/Level3.cpp +++ b/src/server/game/Chat/Commands/Level3.cpp @@ -427,7 +427,7 @@ bool ChatHandler::HandleListItemCommand(const char *args) result = CharacterDatabase.Query(stmt); if (result) - inv_count = (*result)[0].GetUInt32(); + inv_count = (*result)[0].GetUInt64(); stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_INVENTORY_ITEM_BY_ENTRY); stmt->setUInt32(0, item_id); @@ -476,7 +476,7 @@ bool ChatHandler::HandleListItemCommand(const char *args) result = CharacterDatabase.Query(stmt); if (result) - mail_count = (*result)[0].GetUInt32(); + mail_count = (*result)[0].GetUInt64(); if (count > 0) { @@ -523,7 +523,7 @@ bool ChatHandler::HandleListItemCommand(const char *args) result = CharacterDatabase.Query(stmt); if (result) - auc_count = (*result)[0].GetUInt32(); + auc_count = (*result)[0].GetUInt64(); if (count > 0) { @@ -560,7 +560,7 @@ bool ChatHandler::HandleListItemCommand(const char *args) result = CharacterDatabase.Query(stmt); if (result) - guild_count = (*result)[0].GetUInt32(); + guild_count = (*result)[0].GetUInt64(); stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUILD_BANK_ITEM_BY_ENTRY); stmt->setUInt32(0, item_id); @@ -3302,7 +3302,7 @@ bool ChatHandler::HandleBanListCharacterCommand(const char *args) bool ChatHandler::HandleBanListAccountCommand(const char *args) { - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_OLD_BANS); + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_EXPIRED_IP_BANS); LoginDatabase.Execute(stmt); char* cFilter = strtok((char*)args, " "); @@ -3410,7 +3410,7 @@ bool ChatHandler::HandleBanListHelper(PreparedQueryResult result) bool ChatHandler::HandleBanListIPCommand(const char *args) { - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_OLD_IP_BANS); + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_EXPIRED_IP_BANS); LoginDatabase.Execute(stmt); char* cFilter = strtok((char*)args, " "); diff --git a/src/server/game/Handlers/MailHandler.cpp b/src/server/game/Handlers/MailHandler.cpp index 187b12d5d2e..c30cbaa622e 100755 --- a/src/server/game/Handlers/MailHandler.cpp +++ b/src/server/game/Handlers/MailHandler.cpp @@ -138,7 +138,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data) if (result) { Field* fields = result->Fetch(); - mails_count = fields[0].GetUInt32(); + mails_count = fields[0].GetUInt64(); } stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_LEVEL); diff --git a/src/server/game/Tickets/TicketMgr.cpp b/src/server/game/Tickets/TicketMgr.cpp index 930bf0d3372..68e28014319 100755 --- a/src/server/game/Tickets/TicketMgr.cpp +++ b/src/server/game/Tickets/TicketMgr.cpp @@ -65,6 +65,8 @@ GmTicket::~GmTicket() { } bool GmTicket::LoadFromDB(Field* fields) { + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 + // ticketId, guid, name, message, createTime, mapId, posX, posY, posZ, lastModifiedTime, closedBy, assignedTo, comment, completed, escalated, viewed uint8 index = 0; _id = fields[ index].GetUInt32(); _playerGuid = MAKE_NEW_GUID(fields[++index].GetUInt32(), 0, HIGHGUID_PLAYER); @@ -87,6 +89,8 @@ bool GmTicket::LoadFromDB(Field* fields) void GmTicket::SaveToDB(SQLTransaction& trans) const { + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 + // ticketId, guid, name, message, createTime, mapId, posX, posY, posZ, lastModifiedTime, closedBy, assignedTo, comment, completed, escalated, viewed uint8 index = 0; PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_GM_TICKET); stmt->setUInt32( index, _id); diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.cpp b/src/server/shared/Database/Implementation/CharacterDatabase.cpp index 9d29aa6f9a9..22de70b993b 100644 --- a/src/server/shared/Database/Implementation/CharacterDatabase.cpp +++ b/src/server/shared/Database/Implementation/CharacterDatabase.cpp @@ -245,7 +245,7 @@ void CharacterDatabaseConnection::DoPrepareStatements() // Account data PREPARE_STATEMENT(CHAR_SEL_ACCOUNT_DATA, "SELECT type, time, data FROM account_data WHERE accountId = ?", CONNECTION_SYNCH) - PREPARE_STATEMENT(CHAR_REP_ACCOUNT_DATA, "REPLACE INTO account_data(accountId, type, time, data) VALUES (?, ?, ?, ?)", CONNECTION_ASYNC) + PREPARE_STATEMENT(CHAR_REP_ACCOUNT_DATA, "REPLACE INTO account_data (accountId, type, time, data) VALUES (?, ?, ?, ?)", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_DEL_ACCOUNT_DATA, "DELETE FROM account_data WHERE accountId = ?", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_SEL_PLAYER_ACCOUNT_DATA, "SELECT type, time, data FROM character_account_data WHERE guid = ?", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_REP_PLAYER_ACCOUNT_DATA, "REPLACE INTO character_account_data(guid, type, time, data) VALUES (?, ?, ?, ?)", CONNECTION_ASYNC) diff --git a/src/server/shared/Database/Implementation/LoginDatabase.cpp b/src/server/shared/Database/Implementation/LoginDatabase.cpp index df92c6fa77c..70d874be31d 100755 --- a/src/server/shared/Database/Implementation/LoginDatabase.cpp +++ b/src/server/shared/Database/Implementation/LoginDatabase.cpp @@ -56,8 +56,6 @@ void LoginDatabaseConnection::DoPrepareStatements() PREPARE_STATEMENT(LOGIN_SEL_SUM_REALM_CHARACTERS, "SELECT SUM(numchars) FROM realmcharacters WHERE acctid = ?", CONNECTION_ASYNC); PREPARE_STATEMENT(LOGIN_INS_ACCOUNT, "INSERT INTO account(username, sha_pass_hash, joindate) VALUES(?, ?, NOW())", CONNECTION_ASYNC); PREPARE_STATEMENT(LOGIN_INS_REALM_CHARACTERS_INIT, "INSERT INTO realmcharacters (realmid, acctid, numchars) SELECT realmlist.id, account.id, 0 FROM realmlist, account LEFT JOIN realmcharacters ON acctid=account.id WHERE acctid IS NULL", CONNECTION_ASYNC); - PREPARE_STATEMENT(LOGIN_DEL_OLD_BANS, "DELETE FROM ip_banned WHERE unbandate <= UNIX_TIMESTAMP() AND unbandate<>bandate", CONNECTION_ASYNC); - PREPARE_STATEMENT(LOGIN_DEL_OLD_IP_BANS, "DELETE FROM ip_banned WHERE unbandate <= UNIX_TIMESTAMP() AND unbandate<>bandate", CONNECTION_ASYNC); PREPARE_STATEMENT(LOGIN_UPD_EXPANSION, "UPDATE account SET expansion = ? WHERE id = ?", CONNECTION_ASYNC); PREPARE_STATEMENT(LOGIN_UPD_ACCOUNT_LOCK, "UPDATE account SET locked = ? WHERE id = ?", CONNECTION_ASYNC); PREPARE_STATEMENT(LOGIN_INS_LOG, "INSERT INTO logs (time, realm, type, string) VALUES (UNIX_TIMESTAMP(), ? , ?, ?)", CONNECTION_ASYNC); diff --git a/src/server/shared/Database/Implementation/LoginDatabase.h b/src/server/shared/Database/Implementation/LoginDatabase.h index 4ad9ac1a251..2b9d94cbceb 100755 --- a/src/server/shared/Database/Implementation/LoginDatabase.h +++ b/src/server/shared/Database/Implementation/LoginDatabase.h @@ -76,8 +76,6 @@ enum LoginDatabaseStatements LOGIN_SEL_SUM_REALM_CHARACTERS, LOGIN_INS_ACCOUNT, LOGIN_INS_REALM_CHARACTERS_INIT, - LOGIN_DEL_OLD_BANS, - LOGIN_DEL_OLD_IP_BANS, LOGIN_UPD_EXPANSION, LOGIN_UPD_ACCOUNT_LOCK, LOGIN_INS_LOG, diff --git a/src/server/shared/Database/PreparedStatement.cpp b/src/server/shared/Database/PreparedStatement.cpp index dd1b85f70a6..db26dabaee7 100755 --- a/src/server/shared/Database/PreparedStatement.cpp +++ b/src/server/shared/Database/PreparedStatement.cpp @@ -42,12 +42,20 @@ void PreparedStatement::BindParameters() m_stmt->setBool(i, statement_data[i].data.boolean); break; case TYPE_UI8: + m_stmt->setUInt8(i, statement_data[i].data.ui8); + break; case TYPE_UI16: + m_stmt->setUInt16(i, statement_data[i].data.ui16); + break; case TYPE_UI32: m_stmt->setUInt32(i, statement_data[i].data.ui32); break; case TYPE_I8: + m_stmt->setInt8(i, statement_data[i].data.i8); + break; case TYPE_I16: + m_stmt->setInt16(i, statement_data[i].data.i16); + break; case TYPE_I32: m_stmt->setInt32(i, statement_data[i].data.i32); break; @@ -89,7 +97,7 @@ void PreparedStatement::setUInt8(const uint8 index, const uint8 value) if (index >= statement_data.size()) statement_data.resize(index+1); - statement_data[index].data.ui32 = value; + statement_data[index].data.ui8 = value; statement_data[index].type = TYPE_UI8; } @@ -98,7 +106,7 @@ void PreparedStatement::setUInt16(const uint8 index, const uint16 value) if (index >= statement_data.size()) statement_data.resize(index+1); - statement_data[index].data.ui32 = value; + statement_data[index].data.ui16 = value; statement_data[index].type = TYPE_UI16; } @@ -125,7 +133,7 @@ void PreparedStatement::setInt8(const uint8 index, const int8 value) if (index >= statement_data.size()) statement_data.resize(index+1); - statement_data[index].data.i32 = value; + statement_data[index].data.i8 = value; statement_data[index].type = TYPE_I8; } @@ -134,7 +142,7 @@ void PreparedStatement::setInt16(const uint8 index, const int16 value) if (index >= statement_data.size()) statement_data.resize(index+1); - statement_data[index].data.i32 = value; + statement_data[index].data.i16 = value; statement_data[index].type = TYPE_I16; } @@ -235,17 +243,23 @@ bool MySQLPreparedStatement::CheckValidIndex(uint8 index) void MySQLPreparedStatement::setBool(const uint8 index, const bool value) { - setUInt32(index, value); + setUInt8(index, value ? 1 : 0); } void MySQLPreparedStatement::setUInt8(const uint8 index, const uint8 value) { - setUInt32(index, value); + CheckValidIndex(index); + m_paramsSet[index] = true; + MYSQL_BIND* param = &m_bind[index]; + setValue(param, MYSQL_TYPE_TINY, &value, sizeof(uint8), true); } void MySQLPreparedStatement::setUInt16(const uint8 index, const uint16 value) { - setUInt32(index, value); + CheckValidIndex(index); + m_paramsSet[index] = true; + MYSQL_BIND* param = &m_bind[index]; + setValue(param, MYSQL_TYPE_SHORT, &value, sizeof(uint16), true); } void MySQLPreparedStatement::setUInt32(const uint8 index, const uint32 value) @@ -266,12 +280,18 @@ void MySQLPreparedStatement::setUInt64(const uint8 index, const uint64 value) void MySQLPreparedStatement::setInt8(const uint8 index, const int8 value) { - setInt32(index, value); + CheckValidIndex(index); + m_paramsSet[index] = true; + MYSQL_BIND* param = &m_bind[index]; + setValue(param, MYSQL_TYPE_TINY, &value, sizeof(int8), false); } void MySQLPreparedStatement::setInt16(const uint8 index, const int16 value) { - setInt32(index, value); + CheckValidIndex(index); + m_paramsSet[index] = true; + MYSQL_BIND* param = &m_bind[index]; + setValue(param, MYSQL_TYPE_SHORT, &value, sizeof(int16), false); } void MySQLPreparedStatement::setInt32(const uint8 index, const int32 value) @@ -353,12 +373,20 @@ std::string MySQLPreparedStatement::getQueryString(const char *query) replace << (m_stmt->statement_data[i].data.boolean ? '1' : '0'); break; case TYPE_UI8: + replace << uint16(m_stmt->statement_data[i].data.ui8); // stringstream will append a character with that code instead of numeric representation + break; case TYPE_UI16: + replace << m_stmt->statement_data[i].data.ui16; + break; case TYPE_UI32: replace << m_stmt->statement_data[i].data.ui32; break; case TYPE_I8: + replace << int16(m_stmt->statement_data[i].data.i8); // stringstream will append a character with that code instead of numeric representation + break; case TYPE_I16: + replace << m_stmt->statement_data[i].data.i16; + break; case TYPE_I32: replace << m_stmt->statement_data[i].data.i32; break; diff --git a/src/server/shared/Logging/Log.h b/src/server/shared/Logging/Log.h index 9ee9d83ad3f..296c13d86c9 100755 --- a/src/server/shared/Logging/Log.h +++ b/src/server/shared/Logging/Log.h @@ -31,7 +31,7 @@ enum DebugLogFilters LOG_FILTER_PETS = 0x00000002, LOG_FILTER_VEHICLES = 0x00000004, LOG_FILTER_TSCR = 0x00000008, // C++ AI, instance scripts, etc. - LOG_FILTER_DATABASE_AI = 0x08000010, // SmartAI, EventAI, CreatureAI + LOG_FILTER_DATABASE_AI = 0x00000010, // SmartAI, EventAI, CreatureAI LOG_FILTER_MAPSCRIPTS = 0x00000020, LOG_FILTER_NETWORKIO = 0x00000040, // Anything packet/netcode related LOG_FILTER_SPELLS_AURAS = 0x00000080, |
