More SQL delimiting for modern servers (#166)

* Add delimiter to sql objects
This commit is contained in:
Tim Forbes 2020-05-01 17:02:28 -04:00 committed by Antz
parent 95056c5a29
commit bd4f8a8f40
21 changed files with 114 additions and 114 deletions

View file

@ -4153,14 +4153,14 @@ bool ChatHandler::HandleCharacterCustomizeCommand(char* args)
{ {
PSendSysMessage(LANG_CUSTOMIZE_PLAYER, GetNameLink(target).c_str()); PSendSysMessage(LANG_CUSTOMIZE_PLAYER, GetNameLink(target).c_str());
target->SetAtLoginFlag(AT_LOGIN_CUSTOMIZE); target->SetAtLoginFlag(AT_LOGIN_CUSTOMIZE);
CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '8' WHERE guid = '%u'", target->GetGUIDLow()); CharacterDatabase.PExecute("UPDATE `characters` SET `at_login` = `at_login` | '8' WHERE `guid` = '%u'", target->GetGUIDLow());
} }
else else
{ {
std::string oldNameLink = playerLink(target_name); std::string oldNameLink = playerLink(target_name);
PSendSysMessage(LANG_CUSTOMIZE_PLAYER_GUID, oldNameLink.c_str(), target_guid.GetCounter()); PSendSysMessage(LANG_CUSTOMIZE_PLAYER_GUID, oldNameLink.c_str(), target_guid.GetCounter());
CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '8' WHERE guid = '%u'", target_guid.GetCounter()); CharacterDatabase.PExecute("UPDATE `characters` SET `at_login` = `at_login` | '8' WHERE `guid` = '%u'", target_guid.GetCounter());
} }
return true; return true;

View file

@ -3146,7 +3146,7 @@ bool ChatHandler::HandleListItemCommand(char* args)
// guild bank case // guild bank case
uint32 guild_count = 0; uint32 guild_count = 0;
result = CharacterDatabase.PQuery("SELECT COUNT(item_entry) FROM guild_bank_item WHERE item_entry='%u'", item_id); result = CharacterDatabase.PQuery("SELECT COUNT(`item_entry`) FROM `guild_bank_item` WHERE `item_entry`='%u'", item_id);
if (result) if (result)
{ {
guild_count = (*result)[0].GetUInt32(); guild_count = (*result)[0].GetUInt32();

View file

@ -1115,7 +1115,7 @@ void AuctionEntry::AuctionBidWinning(Player* newbidder)
moneyDeliveryTime = time(NULL) + HOUR; moneyDeliveryTime = time(NULL) + HOUR;
CharacterDatabase.BeginTransaction(); CharacterDatabase.BeginTransaction();
CharacterDatabase.PExecute("UPDATE auction SET itemguid = 0, moneyTime = '" UI64FMTD "', buyguid = '%u', lastbid = '" UI64FMTD "' WHERE id = '%u'", (uint64)moneyDeliveryTime, bidder, bid, Id); CharacterDatabase.PExecute("UPDATE `auction` SET `itemguid` = 0, `moneyTime` = '" UI64FMTD "', `buyguid` = '%u', `lastbid` = '" UI64FMTD "' WHERE `id` = '%u'", (uint64)moneyDeliveryTime, bidder, bid, Id);
if (newbidder) if (newbidder)
{ {
newbidder->SaveInventoryAndGoldToDB(); newbidder->SaveInventoryAndGoldToDB();

View file

@ -84,7 +84,7 @@ void CalendarEvent::RemoveInviteByItr(CalendarInviteMap::iterator inviteItr)
sCalendarMgr.SendCalendarEventInviteRemove(inviteItr->second, Flags); sCalendarMgr.SendCalendarEventInviteRemove(inviteItr->second, Flags);
CharacterDatabase.PExecute("DELETE FROM calendar_invites WHERE inviteId=" UI64FMTD, inviteItr->second->InviteId); CharacterDatabase.PExecute("DELETE FROM `calendar_invites` WHERE `inviteId` = " UI64FMTD, inviteItr->second->InviteId);
delete inviteItr->second; delete inviteItr->second;
m_Invitee.erase(inviteItr); m_Invitee.erase(inviteItr);
@ -317,7 +317,7 @@ CalendarEvent* CalendarMgr::AddEvent(ObjectGuid const& guid, std::string title,
CharacterDatabase.escape_string(title); CharacterDatabase.escape_string(title);
CharacterDatabase.escape_string(description); CharacterDatabase.escape_string(description);
CharacterDatabase.PExecute("INSERT INTO calendar_events VALUES (" UI64FMTD ", %u, %u, %u, %u, %d, %u, '%s', '%s')", CharacterDatabase.PExecute("INSERT INTO `calendar_events` VALUES (" UI64FMTD ", %u, %u, %u, %u, %d, %u, '%s', '%s')",
nId, nId,
guid.GetCounter(), guid.GetCounter(),
guildId, guildId,
@ -350,7 +350,7 @@ void CalendarMgr::RemoveEvent(uint64 eventId, Player* remover)
SendCalendarEventRemovedAlert(&citr->second); SendCalendarEventRemovedAlert(&citr->second);
CharacterDatabase.PExecute("DELETE FROM calendar_events WHERE eventId=" UI64FMTD, eventId); CharacterDatabase.PExecute("DELETE FROM `calendar_events` WHERE `eventId` = " UI64FMTD, eventId);
// explicitly remove all invite and send mail to all invitee // explicitly remove all invite and send mail to all invitee
citr->second.RemoveAllInvite(remover->GetObjectGuid()); citr->second.RemoveAllInvite(remover->GetObjectGuid());
@ -413,7 +413,7 @@ CalendarInvite* CalendarMgr::AddInvite(CalendarEvent* event, ObjectGuid const& s
return NULL; return NULL;
} }
CharacterDatabase.PExecute("INSERT INTO calendar_invites VALUES (" UI64FMTD ", " UI64FMTD ", %u, %u, %u, %u, %u)", CharacterDatabase.PExecute("INSERT INTO `calendar_invites` VALUES (" UI64FMTD ", " UI64FMTD ", %u, %u, %u, %u, %u)",
invite->InviteId, invite->InviteId,
event->EventId, event->EventId,
inviteeGuid.GetCounter(), inviteeGuid.GetCounter(),
@ -584,7 +584,7 @@ void CalendarMgr::LoadCalendarsFromDB()
sLog.outString("Loading Calendar Events..."); sLog.outString("Loading Calendar Events...");
// 0 1 2 3 4 5 6 7 8 // 0 1 2 3 4 5 6 7 8
QueryResult* eventsQuery = CharacterDatabase.Query("SELECT eventId, creatorGuid, guildId, type, flags, dungeonId, eventTime, title, description FROM calendar_events ORDER BY eventId"); QueryResult* eventsQuery = CharacterDatabase.Query("SELECT `eventId`, `creatorGuid`, `guildId`, `type`, `flags`, `dungeonId`, `eventTime`, `title`, `description` FROM `calendar_events` ORDER BY `eventId`");
if (!eventsQuery) if (!eventsQuery)
{ {
BarGoLink bar(1); BarGoLink bar(1);
@ -625,7 +625,7 @@ void CalendarMgr::LoadCalendarsFromDB()
sLog.outString("Loading Calendar invites..."); sLog.outString("Loading Calendar invites...");
// 0 1 2 3 4 5 6 // 0 1 2 3 4 5 6
QueryResult* invitesQuery = CharacterDatabase.Query("SELECT inviteId, eventId, inviteeGuid, senderGuid, status, lastUpdateTime, rank FROM calendar_invites ORDER BY inviteId"); QueryResult* invitesQuery = CharacterDatabase.Query("SELECT `inviteId`, `eventId`, `inviteeGuid`, `senderGuid`, `status`, `lastUpdateTime`, `rank` FROM `calendar_invites` ORDER BY `inviteId`");
if (!invitesQuery) if (!invitesQuery)
{ {
BarGoLink bar(1); BarGoLink bar(1);
@ -666,7 +666,7 @@ void CalendarMgr::LoadCalendarsFromDB()
if (!event) if (!event)
{ {
// delete invite // delete invite
CharacterDatabase.PExecute("DELETE FROM calendar_invites WHERE inviteId =" UI64FMTD, field[0].GetUInt64()); CharacterDatabase.PExecute("DELETE FROM `calendar_invites` WHERE `inviteId` = " UI64FMTD, field[0].GetUInt64());
++deletedInvites; ++deletedInvites;
continue; continue;
} }

View file

@ -72,7 +72,7 @@ void GMTicketMgr::LoadGMTickets()
if (ticket.GetPlayerGuid()) // already exist if (ticket.GetPlayerGuid()) // already exist
{ {
CharacterDatabase.PExecute("DELETE FROM character_ticket WHERE ticket_id = '%u'", fields[4].GetUInt32()); CharacterDatabase.PExecute("DELETE FROM `character_ticket` WHERE `ticket_id` = '%u'", fields[4].GetUInt32());
continue; continue;
} }

View file

@ -132,7 +132,7 @@ class GMTicket
std::string escapedString = m_text; std::string escapedString = m_text;
CharacterDatabase.escape_string(escapedString); CharacterDatabase.escape_string(escapedString);
CharacterDatabase.PExecute("UPDATE character_ticket SET ticket_text = '%s' WHERE guid = '%u'", escapedString.c_str(), m_guid.GetCounter()); CharacterDatabase.PExecute("UPDATE `character_ticket` SET `ticket_text` = '%s' WHERE `guid` = '%u'", escapedString.c_str(), m_guid.GetCounter());
} }
void SetResponseText(const char* text) void SetResponseText(const char* text)
@ -142,14 +142,14 @@ class GMTicket
std::string escapedString = m_responseText; std::string escapedString = m_responseText;
CharacterDatabase.escape_string(escapedString); CharacterDatabase.escape_string(escapedString);
CharacterDatabase.PExecute("UPDATE character_ticket SET response_text = '%s' WHERE guid = '%u'", escapedString.c_str(), m_guid.GetCounter()); CharacterDatabase.PExecute("UPDATE `character_ticket` SET `response_text` = '%s' WHERE `guid` = '%u'", escapedString.c_str(), m_guid.GetCounter());
} }
bool HasResponse() { return !m_responseText.empty(); } bool HasResponse() { return !m_responseText.empty(); }
void DeleteFromDB() const void DeleteFromDB() const
{ {
CharacterDatabase.PExecute("DELETE FROM character_ticket WHERE guid = '%u' LIMIT 1", m_guid.GetCounter()); CharacterDatabase.PExecute("DELETE FROM `character_ticket` WHERE `guid` = '%u' LIMIT 1", m_guid.GetCounter());
} }
void SaveToDB() const void SaveToDB() const
@ -163,7 +163,7 @@ class GMTicket
std::string escapedString2 = m_responseText; std::string escapedString2 = m_responseText;
CharacterDatabase.escape_string(escapedString2); CharacterDatabase.escape_string(escapedString2);
CharacterDatabase.PExecute("INSERT INTO character_ticket (guid, ticket_text, response_text) VALUES ('%u', '%s', '%s')", m_guid.GetCounter(), escapedString.c_str(), escapedString2.c_str()); CharacterDatabase.PExecute("INSERT INTO `character_ticket` (`guid`, `ticket_text`, `response_text`) VALUES ('%u', '%s', '%s')", m_guid.GetCounter(), escapedString.c_str(), escapedString2.c_str());
CharacterDatabase.CommitTransaction(); CharacterDatabase.CommitTransaction();
} }
private: private:

View file

@ -1710,7 +1710,7 @@ uint32 Guild::GetMemberSlotWithdrawRem(uint32 LowGuid, uint8 TabId)
{ {
member.BankResetTimeTab[TabId] = curTime; member.BankResetTimeTab[TabId] = curTime;
member.BankRemSlotsTab[TabId] = GetBankSlotPerDay(member.RankId, TabId); member.BankRemSlotsTab[TabId] = GetBankSlotPerDay(member.RankId, TabId);
CharacterDatabase.PExecute("UPDATE guild_member SET BankResetTimeTab%u='%u', BankRemSlotsTab%u='%u' WHERE guildid='%u' AND guid='%u'", CharacterDatabase.PExecute("UPDATE `guild_member` SET `BankResetTimeTab%u`='%u', `BankRemSlotsTab%u`='%u' WHERE `guildid`='%u' AND `guid`='%u'",
uint32(TabId), member.BankResetTimeTab[TabId], uint32(TabId), member.BankRemSlotsTab[TabId], m_Id, LowGuid); uint32(TabId), member.BankResetTimeTab[TabId], uint32(TabId), member.BankRemSlotsTab[TabId], m_Id, LowGuid);
} }
return member.BankRemSlotsTab[TabId]; return member.BankRemSlotsTab[TabId];
@ -1736,7 +1736,7 @@ uint64 Guild::GetMemberMoneyWithdrawRem(uint32 LowGuid)
{ {
member.BankResetTimeMoney = curTime; member.BankResetTimeMoney = curTime;
member.BankRemMoney = GetBankMoneyPerDay(member.RankId); member.BankRemMoney = GetBankMoneyPerDay(member.RankId);
CharacterDatabase.PExecute("UPDATE guild_member SET BankResetTimeMoney='%u', BankRemMoney='%u' WHERE guildid='%u' AND guid='%u'", CharacterDatabase.PExecute("UPDATE `guild_member` SET `BankResetTimeMoney`='%u', `BankRemMoney`='%u' WHERE `guildid`='%u' AND `guid`='%u'",
member.BankResetTimeMoney, member.BankRemMoney, m_Id, LowGuid); member.BankResetTimeMoney, member.BankRemMoney, m_Id, LowGuid);
} }
return member.BankRemMoney; return member.BankRemMoney;

View file

@ -2795,7 +2795,7 @@ void ObjectMgr::LoadItemExpireConverts()
uint32 count = 0; uint32 count = 0;
QueryResult* result = WorldDatabase.Query("SELECT entry,item FROM item_expire_convert"); QueryResult* result = WorldDatabase.Query("SELECT `entry`,`item` FROM `item_expire_convert`");
if (!result) if (!result)
{ {
@ -2857,7 +2857,7 @@ void ObjectMgr::LoadItemRequiredTarget()
uint32 count = 0; uint32 count = 0;
QueryResult* result = WorldDatabase.Query("SELECT entry,type,targetEntry FROM item_required_target"); QueryResult* result = WorldDatabase.Query("SELECT `entry`,`type`,`targetEntry` FROM `item_required_target`");
if (!result) if (!result)
{ {
@ -5107,7 +5107,7 @@ void ObjectMgr::LoadPageTextLocales()
{ {
mPageTextLocaleMap.clear(); // need for reload case mPageTextLocaleMap.clear(); // need for reload case
QueryResult* result = WorldDatabase.Query("SELECT entry,text_loc1,text_loc2,text_loc3,text_loc4,text_loc5,text_loc6,text_loc7,text_loc8 FROM locales_page_text"); QueryResult* result = WorldDatabase.Query("SELECT `entry`,`text_loc1`,`text_loc2`,`text_loc3`,`text_loc4`,`text_loc5`,`text_loc6`,`text_loc7`,`text_loc8` FROM `locales_page_text`");
if (!result) if (!result)
{ {
@ -6418,7 +6418,7 @@ void ObjectMgr::SetHighestGuids()
delete result; delete result;
} }
result = CharacterDatabase.Query("SELECT MAX(id) FROM instance"); result = CharacterDatabase.Query("SELECT MAX(`id`) FROM `instance`");
if (result) if (result)
{ {
m_InstanceGuids.Set((*result)[0].GetUInt32() + 1); m_InstanceGuids.Set((*result)[0].GetUInt32() + 1);
@ -7387,7 +7387,7 @@ void ObjectMgr::LoadPointsOfInterest()
uint32 count = 0; uint32 count = 0;
// 0 1 2 3 4 5 // 0 1 2 3 4 5
QueryResult* result = WorldDatabase.Query("SELECT entry, x, y, icon, flags, data, icon_name FROM points_of_interest"); QueryResult* result = WorldDatabase.Query("SELECT `entry`, `x`, `y`, `icon`, `flags`, `data`, `icon_name` FROM `points_of_interest`");
if (!result) if (!result)
{ {
@ -7439,7 +7439,7 @@ void ObjectMgr::LoadQuestPOI()
uint32 count = 0; uint32 count = 0;
// 0 1 2 3 4 5 6 7 // 0 1 2 3 4 5 6 7
QueryResult* result = WorldDatabase.Query("SELECT questId, poiId, objIndex, mapId, mapAreaId, floorId, unk3, unk4 FROM quest_poi"); QueryResult* result = WorldDatabase.Query("SELECT `questId`, `poiId`, `objIndex`, `mapId`, `mapAreaId`, `floorId`, `unk3`, `unk4` FROM `quest_poi`");
if (!result) if (!result)
{ {
@ -7478,7 +7478,7 @@ void ObjectMgr::LoadQuestPOI()
delete result; delete result;
QueryResult* points = WorldDatabase.Query("SELECT questId, poiId, x, y FROM quest_poi_points"); QueryResult* points = WorldDatabase.Query("SELECT `questId`, `poiId`, `x`, `y` FROM `quest_poi_points`");
if (points) if (points)
{ {
@ -7518,7 +7518,7 @@ void ObjectMgr::LoadDungeonFinderRequirements()
mDungeonFinderRequirementsMap.clear(); // in case of a reload mDungeonFinderRequirementsMap.clear(); // in case of a reload
// 0 1 2 3 4 5 6 7 8 // 0 1 2 3 4 5 6 7 8
QueryResult* result = WorldDatabase.Query("SELECT mapId, difficulty, min_item_level, item, item_2, alliance_quest, horde_quest, achievement, quest_incomplete_text FROM dungeonfinder_requirements"); QueryResult* result = WorldDatabase.Query("SELECT `mapId`, `difficulty`, `min_item_level`, `item`, `item_2`, `alliance_quest`, `horde_quest`, `achievement`, `quest_incomplete_text` FROM `dungeonfinder_requirements`");
if (!result) if (!result)
{ {
@ -7625,7 +7625,7 @@ void ObjectMgr::LoadDungeonFinderRewards()
mDungeonFinderRewardsMap.clear(); // in case of a reload mDungeonFinderRewardsMap.clear(); // in case of a reload
// 0 1 2 3 // 0 1 2 3
QueryResult* result = WorldDatabase.Query("SELECT id, level, base_xp_reward, base_monetary_reward FROM dungeonfinder_rewards"); QueryResult* result = WorldDatabase.Query("SELECT `id`, `level`, `base_xp_reward`, `base_monetary_reward` FROM `dungeonfinder_rewards`");
if (!result) if (!result)
{ {
@ -7668,7 +7668,7 @@ void ObjectMgr::LoadDungeonFinderItems()
mDungeonFinderItemsMap.clear(); // in case of reload mDungeonFinderItemsMap.clear(); // in case of reload
// 0 1 2 3 4 5 // 0 1 2 3 4 5
QueryResult* result = WorldDatabase.Query("SELECT id, min_level, max_level, item_reward, item_amount, dungeon_type FROM dungeonfinder_item_rewards"); QueryResult* result = WorldDatabase.Query("SELECT `id`, `min_level`, `max_level`, `item_reward`, `item_amount`, `dungeon_type` FROM `dungeonfinder_item_rewards`");
if (!result) if (!result)
{ {
@ -9752,7 +9752,7 @@ void ObjectMgr::LoadMailLevelRewards()
m_mailLevelRewardMap.clear(); // for reload case m_mailLevelRewardMap.clear(); // for reload case
uint32 count = 0; uint32 count = 0;
QueryResult* result = WorldDatabase.Query("SELECT level, raceMask, mailTemplateId, senderEntry FROM mail_level_reward"); QueryResult* result = WorldDatabase.Query("SELECT `level`, `raceMask`, `mailTemplateId`, `senderEntry` FROM `mail_level_reward`");
if (!result) if (!result)
{ {

View file

@ -311,7 +311,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c
if (owner->GetTypeId() == TYPEID_PLAYER && getPetType() == HUNTER_PET) if (owner->GetTypeId() == TYPEID_PLAYER && getPetType() == HUNTER_PET)
{ {
result = CharacterDatabase.PQuery("SELECT genitive, dative, accusative, instrumental, prepositional FROM character_pet_declinedname WHERE owner = '%u' AND id = '%u'", owner->GetGUIDLow(), GetCharmInfo()->GetPetNumber()); result = CharacterDatabase.PQuery("SELECT `genitive`, `dative`, `accusative`, `instrumental`, `prepositional` FROM `character_pet_declinedname` WHERE `owner` = '%u' AND `id` = '%u'", owner->GetGUIDLow(), GetCharmInfo()->GetPetNumber());
if (result) if (result)
{ {
@ -1981,7 +1981,7 @@ void Pet::resetTalentsForAllPetsOf(Player* owner, Pet* online_pet /*= NULL*/)
uint32 except_petnumber = online_pet ? online_pet->GetCharmInfo()->GetPetNumber() : 0; uint32 except_petnumber = online_pet ? online_pet->GetCharmInfo()->GetPetNumber() : 0;
QueryResult* resultPets = CharacterDatabase.PQuery( QueryResult* resultPets = CharacterDatabase.PQuery(
"SELECT id FROM character_pet WHERE owner = '%u' AND id <> '%u'", "SELECT `id` FROM `character_pet` WHERE `owner` = '%u' AND `id` <> '%u'",
owner->GetGUIDLow(), except_petnumber); owner->GetGUIDLow(), except_petnumber);
// no offline pets // no offline pets
@ -1991,8 +1991,8 @@ void Pet::resetTalentsForAllPetsOf(Player* owner, Pet* online_pet /*= NULL*/)
} }
QueryResult* result = CharacterDatabase.PQuery( QueryResult* result = CharacterDatabase.PQuery(
"SELECT DISTINCT pet_spell.spell FROM pet_spell, character_pet " "SELECT DISTINCT `pet_spell`.`spell` FROM `pet_spell`, `character_pet` "
"WHERE character_pet.owner = '%u' AND character_pet.id = pet_spell.guid AND character_pet.id <> %u", "WHERE `character_pet`.`owner` = '%u' AND `character_pet`.`id` = `pet_spell`.`guid` AND `character_pet`.`id` <> %u",
owner->GetGUIDLow(), except_petnumber); owner->GetGUIDLow(), except_petnumber);
if (!result) if (!result)
@ -2003,7 +2003,7 @@ void Pet::resetTalentsForAllPetsOf(Player* owner, Pet* online_pet /*= NULL*/)
bool need_comma = false; bool need_comma = false;
std::ostringstream ss; std::ostringstream ss;
ss << "DELETE FROM pet_spell WHERE guid IN ("; ss << "DELETE FROM `pet_spell` WHERE `guid` IN (";
do do
{ {
@ -2022,7 +2022,7 @@ void Pet::resetTalentsForAllPetsOf(Player* owner, Pet* online_pet /*= NULL*/)
delete resultPets; delete resultPets;
ss << ") AND spell IN ("; ss << ") AND `spell` IN (";
bool need_execute = false; bool need_execute = false;
do do

View file

@ -17976,7 +17976,7 @@ void Player::_LoadSpells(QueryResult* result)
{ {
sLog.outError("Player::_LoadSpells: %s has talent spell %u in character_spell, removing it.", sLog.outError("Player::_LoadSpells: %s has talent spell %u in character_spell, removing it.",
GetGuidStr().c_str(), spell_id); GetGuidStr().c_str(), spell_id);
CharacterDatabase.PExecute("DELETE FROM character_spell WHERE spell = '%u'", spell_id); CharacterDatabase.PExecute("DELETE FROM `character_spell` WHERE `spell` = '%u'", spell_id);
continue; continue;
} }
@ -18003,7 +18003,7 @@ void Player::_LoadTalents(QueryResult* result)
if (!talentInfo) if (!talentInfo)
{ {
sLog.outError("Player::_LoadTalents:Player (GUID: %u) has invalid talent_id: %u , this talent will be deleted from character_talent", GetGUIDLow(), talent_id); sLog.outError("Player::_LoadTalents:Player (GUID: %u) has invalid talent_id: %u , this talent will be deleted from character_talent", GetGUIDLow(), talent_id);
CharacterDatabase.PExecute("DELETE FROM character_talent WHERE talent_id = '%u'", talent_id); CharacterDatabase.PExecute("DELETE FROM `character_talent` WHERE `talent_id` = '%u'", talent_id);
continue; continue;
} }
@ -18012,7 +18012,7 @@ void Player::_LoadTalents(QueryResult* result)
if (!talentTabInfo) if (!talentTabInfo)
{ {
sLog.outError("Player::_LoadTalents:Player (GUID: %u) has invalid talentTabInfo: %u for talentID: %u , this talent will be deleted from character_talent", GetGUIDLow(), talentInfo->TalentTab, talentInfo->TalentID); sLog.outError("Player::_LoadTalents:Player (GUID: %u) has invalid talentTabInfo: %u for talentID: %u , this talent will be deleted from character_talent", GetGUIDLow(), talentInfo->TalentTab, talentInfo->TalentID);
CharacterDatabase.PExecute("DELETE FROM character_talent WHERE talent_id = '%u'", talent_id); CharacterDatabase.PExecute("DELETE FROM `character_talent` WHERE `talent_id` = '%u'", talent_id);
continue; continue;
} }
@ -18020,7 +18020,7 @@ void Player::_LoadTalents(QueryResult* result)
if ((getClassMask() & talentTabInfo->ClassMask) == 0) if ((getClassMask() & talentTabInfo->ClassMask) == 0)
{ {
sLog.outError("Player::_LoadTalents:Player (GUID: %u) has talent with ClassMask: %u , but Player's ClassMask is: %u , talentID: %u , this talent will be deleted from character_talent", GetGUIDLow(), talentTabInfo->ClassMask, getClassMask() , talentInfo->TalentID); sLog.outError("Player::_LoadTalents:Player (GUID: %u) has talent with ClassMask: %u , but Player's ClassMask is: %u , talentID: %u , this talent will be deleted from character_talent", GetGUIDLow(), talentTabInfo->ClassMask, getClassMask() , talentInfo->TalentID);
CharacterDatabase.PExecute("DELETE FROM character_talent WHERE guid = '%u' AND talent_id = '%u'", GetGUIDLow(), talent_id); CharacterDatabase.PExecute("DELETE FROM `character_talent` WHERE `guid` = '%u' AND `talent_id` = '%u'", GetGUIDLow(), talent_id);
continue; continue;
} }
@ -18029,7 +18029,7 @@ void Player::_LoadTalents(QueryResult* result)
if (currentRank > MAX_TALENT_RANK || talentInfo->RankID[currentRank] == 0) if (currentRank > MAX_TALENT_RANK || talentInfo->RankID[currentRank] == 0)
{ {
sLog.outError("Player::_LoadTalents:Player (GUID: %u) has invalid talent rank: %u , talentID: %u , this talent will be deleted from character_talent", GetGUIDLow(), currentRank, talentInfo->TalentID); sLog.outError("Player::_LoadTalents:Player (GUID: %u) has invalid talent rank: %u , talentID: %u , this talent will be deleted from character_talent", GetGUIDLow(), currentRank, talentInfo->TalentID);
CharacterDatabase.PExecute("DELETE FROM character_talent WHERE guid = '%u' AND talent_id = '%u'", GetGUIDLow(), talent_id); CharacterDatabase.PExecute("DELETE FROM `character_talent` WHERE `guid` = '%u' AND `talent_id` = '%u'", GetGUIDLow(), talent_id);
continue; continue;
} }
@ -18038,14 +18038,14 @@ void Player::_LoadTalents(QueryResult* result)
if (spec > MAX_TALENT_SPEC_COUNT) if (spec > MAX_TALENT_SPEC_COUNT)
{ {
sLog.outError("Player::_LoadTalents:Player (GUID: %u) has invalid talent spec: %u, spec will be deleted from character_talent", GetGUIDLow(), spec); sLog.outError("Player::_LoadTalents:Player (GUID: %u) has invalid talent spec: %u, spec will be deleted from character_talent", GetGUIDLow(), spec);
CharacterDatabase.PExecute("DELETE FROM character_talent WHERE spec = '%u' ", spec); CharacterDatabase.PExecute("DELETE FROM `character_talent` WHERE `spec` = '%u' ", spec);
continue; continue;
} }
if (spec >= m_specsCount) if (spec >= m_specsCount)
{ {
sLog.outError("Player::_LoadTalents:Player (GUID: %u) has invalid talent spec: %u , this spec will be deleted from character_talent.", GetGUIDLow(), spec); sLog.outError("Player::_LoadTalents:Player (GUID: %u) has invalid talent spec: %u , this spec will be deleted from character_talent.", GetGUIDLow(), spec);
CharacterDatabase.PExecute("DELETE FROM character_talent WHERE guid = '%u' AND spec = '%u' ", GetGUIDLow(), spec); CharacterDatabase.PExecute("DELETE FROM `character_talent` WHERE `guid` = '%u' AND `spec` = '%u' ", GetGUIDLow(), spec);
continue; continue;
} }
@ -18124,7 +18124,7 @@ void Player::_LoadBoundInstances(QueryResult* result)
if (difficulty >= MAX_DIFFICULTY) if (difficulty >= MAX_DIFFICULTY)
{ {
sLog.outError("_LoadBoundInstances: player %s(%d) has bind to nonexistent difficulty %d instance for map %u", GetName(), GetGUIDLow(), difficulty, mapId); sLog.outError("_LoadBoundInstances: player %s(%d) has bind to nonexistent difficulty %d instance for map %u", GetName(), GetGUIDLow(), difficulty, mapId);
CharacterDatabase.PExecute("DELETE FROM character_instance WHERE guid = '%u' AND instance = '%u'", GetGUIDLow(), instanceId); CharacterDatabase.PExecute("DELETE FROM `character_instance` WHERE `guid` = '%u' AND `instance` = '%u'", GetGUIDLow(), instanceId);
continue; continue;
} }
@ -18132,7 +18132,7 @@ void Player::_LoadBoundInstances(QueryResult* result)
if (!mapDiff) if (!mapDiff)
{ {
sLog.outError("_LoadBoundInstances: player %s(%d) has bind to nonexistent difficulty %d instance for map %u", GetName(), GetGUIDLow(), difficulty, mapId); sLog.outError("_LoadBoundInstances: player %s(%d) has bind to nonexistent difficulty %d instance for map %u", GetName(), GetGUIDLow(), difficulty, mapId);
CharacterDatabase.PExecute("DELETE FROM character_instance WHERE guid = '%u' AND instance = '%u'", GetGUIDLow(), instanceId); CharacterDatabase.PExecute("DELETE FROM `character_instance` WHERE `guid` = '%u' AND `instance` = '%u'", GetGUIDLow(), instanceId);
continue; continue;
} }
@ -18714,7 +18714,7 @@ void Player::_SaveActions()
break; break;
case ACTIONBUTTON_CHANGED: case ACTIONBUTTON_CHANGED:
{ {
SqlStatement stmt = CharacterDatabase.CreateStatement(updateAction, "UPDATE character_action SET action = ?, type = ? WHERE guid = ? AND button = ? AND spec = ?"); SqlStatement stmt = CharacterDatabase.CreateStatement(updateAction, "UPDATE `character_action` SET `action` = ?, `type` = ? WHERE `guid` = ? AND `button` = ? AND `spec` = ?");
stmt.addUInt32(itr->second.GetAction()); stmt.addUInt32(itr->second.GetAction());
stmt.addUInt32(uint32(itr->second.GetType())); stmt.addUInt32(uint32(itr->second.GetType()));
stmt.addUInt32(GetGUIDLow()); stmt.addUInt32(GetGUIDLow());
@ -18727,7 +18727,7 @@ void Player::_SaveActions()
break; break;
case ACTIONBUTTON_DELETED: case ACTIONBUTTON_DELETED:
{ {
SqlStatement stmt = CharacterDatabase.CreateStatement(deleteAction, "DELETE FROM character_action WHERE guid = ? AND button = ? AND spec = ?"); SqlStatement stmt = CharacterDatabase.CreateStatement(deleteAction, "DELETE FROM `character_action` WHERE `guid` = ? AND `button` = ? AND `spec` = ?");
stmt.addUInt32(GetGUIDLow()); stmt.addUInt32(GetGUIDLow());
stmt.addUInt32(uint32(itr->first)); stmt.addUInt32(uint32(itr->first));
stmt.addUInt32(i); stmt.addUInt32(i);
@ -18835,19 +18835,19 @@ void Player::_SaveGlyphs()
{ {
case GLYPH_NEW: case GLYPH_NEW:
{ {
SqlStatement stmt = CharacterDatabase.CreateStatement(insertGlyph, "INSERT INTO character_glyphs (guid, spec, slot, glyph) VALUES (?, ?, ?, ?)"); SqlStatement stmt = CharacterDatabase.CreateStatement(insertGlyph, "INSERT INTO `character_glyphs` (`guid`, `spec`, `slot`, `glyph`) VALUES (?, ?, ?, ?)");
stmt.PExecute(GetGUIDLow(), spec, slot, m_glyphs[spec][slot].GetId()); stmt.PExecute(GetGUIDLow(), spec, slot, m_glyphs[spec][slot].GetId());
break; break;
} }
case GLYPH_CHANGED: case GLYPH_CHANGED:
{ {
SqlStatement stmt = CharacterDatabase.CreateStatement(updateGlyph, "UPDATE character_glyphs SET glyph = ? WHERE guid = ? AND spec = ? AND slot = ?"); SqlStatement stmt = CharacterDatabase.CreateStatement(updateGlyph, "UPDATE `character_glyphs` SET `glyph` = ? WHERE `guid` = ? AND `spec` = ? AND `slot` = ?");
stmt.PExecute(m_glyphs[spec][slot].GetId(), GetGUIDLow(), spec, slot); stmt.PExecute(m_glyphs[spec][slot].GetId(), GetGUIDLow(), spec, slot);
break; break;
} }
case GLYPH_DELETED: case GLYPH_DELETED:
{ {
SqlStatement stmt = CharacterDatabase.CreateStatement(deleteGlyph, "DELETE FROM character_glyphs WHERE guid = ? AND spec = ? AND slot = ?"); SqlStatement stmt = CharacterDatabase.CreateStatement(deleteGlyph, "DELETE FROM `character_glyphs` WHERE `guid` = ? AND `spec` = ? AND `slot` = ?");
stmt.PExecute(GetGUIDLow(), spec, slot); stmt.PExecute(GetGUIDLow(), spec, slot);
break; break;
} }
@ -19136,8 +19136,8 @@ void Player::_SaveWeeklyQuestStatus()
static SqlStatementID delQuestStatus ; static SqlStatementID delQuestStatus ;
static SqlStatementID insQuestStatus ; static SqlStatementID insQuestStatus ;
SqlStatement stmtDel = CharacterDatabase.CreateStatement(delQuestStatus, "DELETE FROM character_queststatus_weekly WHERE guid = ?"); SqlStatement stmtDel = CharacterDatabase.CreateStatement(delQuestStatus, "DELETE FROM `character_queststatus_weekly` WHERE `guid` = ?");
SqlStatement stmtIns = CharacterDatabase.CreateStatement(insQuestStatus, "INSERT INTO character_queststatus_weekly (guid,quest) VALUES (?, ?)"); SqlStatement stmtIns = CharacterDatabase.CreateStatement(insQuestStatus, "INSERT INTO `character_queststatus_weekly` (`guid`,`quest`) VALUES (?, ?)");
stmtDel.PExecute(GetGUIDLow()); stmtDel.PExecute(GetGUIDLow());
@ -19161,8 +19161,8 @@ void Player::_SaveMonthlyQuestStatus()
static SqlStatementID deleteQuest ; static SqlStatementID deleteQuest ;
static SqlStatementID insertQuest ; static SqlStatementID insertQuest ;
SqlStatement stmtDel = CharacterDatabase.CreateStatement(deleteQuest, "DELETE FROM character_queststatus_monthly WHERE guid = ?"); SqlStatement stmtDel = CharacterDatabase.CreateStatement(deleteQuest, "DELETE FROM `character_queststatus_monthly` WHERE `guid` = ?");
SqlStatement stmtIns = CharacterDatabase.CreateStatement(insertQuest, "INSERT INTO character_queststatus_monthly (guid, quest) VALUES (?, ?)"); SqlStatement stmtIns = CharacterDatabase.CreateStatement(insertQuest, "INSERT INTO `character_queststatus_monthly` (`guid`, `quest`) VALUES (?, ?)");
stmtDel.PExecute(GetGUIDLow()); stmtDel.PExecute(GetGUIDLow());
@ -19266,8 +19266,8 @@ void Player::_SaveTalents()
static SqlStatementID delTalents ; static SqlStatementID delTalents ;
static SqlStatementID insTalents ; static SqlStatementID insTalents ;
SqlStatement stmtDel = CharacterDatabase.CreateStatement(delTalents, "DELETE FROM character_talent WHERE guid = ? and talent_id = ? and spec = ?"); SqlStatement stmtDel = CharacterDatabase.CreateStatement(delTalents, "DELETE FROM `character_talent` WHERE `guid` = ? and `talent_id` = ? and `spec` = ?");
SqlStatement stmtIns = CharacterDatabase.CreateStatement(insTalents, "INSERT INTO character_talent (guid, talent_id, current_rank , spec) VALUES (?, ?, ?, ?)"); SqlStatement stmtIns = CharacterDatabase.CreateStatement(insTalents, "INSERT INTO `character_talent` (`guid`, `talent_id`, `current_rank`, `spec`) VALUES (?, ?, ?, ?)");
for (uint32 i = 0; i < MAX_TALENT_SPEC_COUNT; ++i) for (uint32 i = 0; i < MAX_TALENT_SPEC_COUNT; ++i)
{ {
@ -19442,7 +19442,7 @@ void Player::SetUInt32ValueInArray(Tokens& tokens, uint16 index, uint32 value)
void Player::Customize(ObjectGuid guid, uint8 gender, uint8 skin, uint8 face, uint8 hairStyle, uint8 hairColor, uint8 facialHair) void Player::Customize(ObjectGuid guid, uint8 gender, uint8 skin, uint8 face, uint8 hairStyle, uint8 hairColor, uint8 facialHair)
{ {
// 0 // 0
QueryResult* result = CharacterDatabase.PQuery("SELECT playerBytes2 FROM characters WHERE guid = '%u'", guid.GetCounter()); QueryResult* result = CharacterDatabase.PQuery("SELECT `playerBytes2` FROM `characters` WHERE `guid` = '%u'", guid.GetCounter());
if (!result) if (!result)
{ {
return; return;
@ -19454,7 +19454,7 @@ void Player::Customize(ObjectGuid guid, uint8 gender, uint8 skin, uint8 face, ui
player_bytes2 &= ~0xFF; player_bytes2 &= ~0xFF;
player_bytes2 |= facialHair; player_bytes2 |= facialHair;
CharacterDatabase.PExecute("UPDATE characters SET gender = '%u', playerBytes = '%u', playerBytes2 = '%u' WHERE guid = '%u'", gender, skin | (face << 8) | (hairStyle << 16) | (hairColor << 24), player_bytes2, guid.GetCounter()); CharacterDatabase.PExecute("UPDATE `characters` SET `gender` = '%u', `playerBytes` = '%u', `playerBytes2` = '%u' WHERE `guid` = '%u'", gender, skin | (face << 8) | (hairStyle << 16) | (hairColor << 24), player_bytes2, guid.GetCounter());
delete result; delete result;
} }
@ -24766,9 +24766,9 @@ void Player::_SaveEquipmentSets()
break; // nothing do break; // nothing do
case EQUIPMENT_SET_CHANGED: case EQUIPMENT_SET_CHANGED:
{ {
SqlStatement stmt = CharacterDatabase.CreateStatement(updSets, "UPDATE character_equipmentsets SET name=?, iconname=?, ignore_mask=?, item0=?, item1=?, item2=?, item3=?, item4=?, " SqlStatement stmt = CharacterDatabase.CreateStatement(updSets, "UPDATE `character_equipmentsets` SET `name`=?, `iconname`=?, `ignore_mask`=?, `item0`=?, `item1`=?, `item2`=?, `item3`=?, `item4`=?, "
"item5=?, item6=?, item7=?, item8=?, item9=?, item10=?, item11=?, item12=?, item13=?, item14=?, " "`item5`=?, `item6`=?, `item7`=?, `item8`=?, `item9`=?, `item10`=?, `item11`=?, `item12`=?, `item13`=?, `item14`=?, "
"item15=?, item16=?, item17=?, item18=? WHERE guid=? AND setguid=? AND setindex=?"); "`item15`=?, `item16`=?, `item17`=?, `item18`=? WHERE `guid`=? AND `setguid`=? AND `setindex`=?");
stmt.addString(eqset.Name); stmt.addString(eqset.Name);
stmt.addString(eqset.IconName); stmt.addString(eqset.IconName);
@ -24791,7 +24791,7 @@ void Player::_SaveEquipmentSets()
} }
case EQUIPMENT_SET_NEW: case EQUIPMENT_SET_NEW:
{ {
SqlStatement stmt = CharacterDatabase.CreateStatement(insSets, "INSERT INTO character_equipmentsets VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); SqlStatement stmt = CharacterDatabase.CreateStatement(insSets, "INSERT INTO `character_equipmentsets` VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
stmt.addUInt32(GetGUIDLow()); stmt.addUInt32(GetGUIDLow());
stmt.addUInt64(eqset.Guid); stmt.addUInt64(eqset.Guid);
stmt.addUInt32(index); stmt.addUInt32(index);
@ -24812,7 +24812,7 @@ void Player::_SaveEquipmentSets()
} }
case EQUIPMENT_SET_DELETED: case EQUIPMENT_SET_DELETED:
{ {
SqlStatement stmt = CharacterDatabase.CreateStatement(delSets, "DELETE FROM character_equipmentsets WHERE setguid = ?"); SqlStatement stmt = CharacterDatabase.CreateStatement(delSets, "DELETE FROM `character_equipmentsets` WHERE `setguid` = ?");
stmt.PExecute(eqset.Guid); stmt.PExecute(eqset.Guid);
m_EquipmentSets.erase(itr++); m_EquipmentSets.erase(itr++);
break; break;
@ -24832,13 +24832,13 @@ void Player::_SaveBGData()
static SqlStatementID delBGData ; static SqlStatementID delBGData ;
static SqlStatementID insBGData ; static SqlStatementID insBGData ;
SqlStatement stmt = CharacterDatabase.CreateStatement(delBGData, "DELETE FROM character_battleground_data WHERE guid = ?"); SqlStatement stmt = CharacterDatabase.CreateStatement(delBGData, "DELETE FROM `character_battleground_data` WHERE `guid` = ?");
stmt.PExecute(GetGUIDLow()); stmt.PExecute(GetGUIDLow());
if (m_bgData.bgInstanceID) if (m_bgData.bgInstanceID)
{ {
stmt = CharacterDatabase.CreateStatement(insBGData, "INSERT INTO character_battleground_data VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); stmt = CharacterDatabase.CreateStatement(insBGData, "INSERT INTO `character_battleground_data` VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
/* guid, bgInstanceID, bgTeam, x, y, z, o, map, taxi[0], taxi[1], mountSpell */ /* guid, bgInstanceID, bgTeam, x, y, z, o, map, taxi[0], taxi[1], mountSpell */
stmt.addUInt32(GetGUIDLow()); stmt.addUInt32(GetGUIDLow());
stmt.addUInt32(m_bgData.bgInstanceID); stmt.addUInt32(m_bgData.bgInstanceID);

View file

@ -958,7 +958,7 @@ void WorldSession::SendAuthResponse(uint8 code, bool queued, uint32 queuePos)
void WorldSession::LoadGlobalAccountData() void WorldSession::LoadGlobalAccountData()
{ {
LoadAccountData( LoadAccountData(
CharacterDatabase.PQuery("SELECT type, time, data FROM account_data WHERE account='%u'", GetAccountId()), CharacterDatabase.PQuery("SELECT `type`, `time`, `data` FROM `account_data` WHERE `account` = '%u'", GetAccountId()),
GLOBAL_CACHE_MASK GLOBAL_CACHE_MASK
); );
} }
@ -1012,10 +1012,10 @@ void WorldSession::SetAccountData(AccountDataType type, time_t time_, const std:
CharacterDatabase.BeginTransaction(); CharacterDatabase.BeginTransaction();
SqlStatement stmt = CharacterDatabase.CreateStatement(delId, "DELETE FROM account_data WHERE account=? AND type=?"); SqlStatement stmt = CharacterDatabase.CreateStatement(delId, "DELETE FROM `account_data` WHERE `account` = ? AND `type` = ?");
stmt.PExecute(acc, uint32(type)); stmt.PExecute(acc, uint32(type));
stmt = CharacterDatabase.CreateStatement(insId, "INSERT INTO account_data VALUES (?,?,?,?)"); stmt = CharacterDatabase.CreateStatement(insId, "INSERT INTO `account_data` VALUES (?,?,?,?)");
stmt.PExecute(acc, uint32(type), uint64(time_), data.c_str()); stmt.PExecute(acc, uint32(type), uint64(time_), data.c_str());
CharacterDatabase.CommitTransaction(); CharacterDatabase.CommitTransaction();
@ -1033,10 +1033,10 @@ void WorldSession::SetAccountData(AccountDataType type, time_t time_, const std:
CharacterDatabase.BeginTransaction(); CharacterDatabase.BeginTransaction();
SqlStatement stmt = CharacterDatabase.CreateStatement(delId, "DELETE FROM character_account_data WHERE guid=? AND type=?"); SqlStatement stmt = CharacterDatabase.CreateStatement(delId, "DELETE FROM `character_account_data` WHERE `guid` = ? AND `type` = ?");
stmt.PExecute(m_GUIDLow, uint32(type)); stmt.PExecute(m_GUIDLow, uint32(type));
stmt = CharacterDatabase.CreateStatement(insId, "INSERT INTO character_account_data VALUES (?,?,?,?)"); stmt = CharacterDatabase.CreateStatement(insId, "INSERT INTO `character_account_data` VALUES (?,?,?,?)");
stmt.PExecute(m_GUIDLow, uint32(type), uint64(time_), data.c_str()); stmt.PExecute(m_GUIDLow, uint32(type), uint64(time_), data.c_str());
CharacterDatabase.CommitTransaction(); CharacterDatabase.CommitTransaction();

View file

@ -153,7 +153,7 @@ bool CharacterDatabaseCleaner::TalentCheck(uint32 talent_id)
void CharacterDatabaseCleaner::CleanCharacterTalent() void CharacterDatabaseCleaner::CleanCharacterTalent()
{ {
CharacterDatabase.DirectPExecute("DELETE FROM character_talent WHERE spec > %u OR current_rank > %u", MAX_TALENT_SPEC_COUNT, MAX_TALENT_RANK); CharacterDatabase.DirectPExecute("DELETE FROM `character_talent` WHERE `spec` > %u OR `current_rank` > %u", MAX_TALENT_SPEC_COUNT, MAX_TALENT_RANK);
CheckUnique("talent_id", "character_talent", &TalentCheck); CheckUnique("talent_id", "character_talent", &TalentCheck);
} }

View file

@ -140,7 +140,7 @@ bool findnth(std::string& str, int n, std::string::size_type& s, std::string::si
std::string gettablename(std::string& str) std::string gettablename(std::string& str)
{ {
std::string::size_type s = 13; std::string::size_type s = 13;
std::string::size_type e = str.find(_TABLE_SIM_, s); std::string::size_type e = str.find('`', s);
if (e == std::string::npos) if (e == std::string::npos)
{ {
return ""; return "";
@ -250,7 +250,7 @@ std::string CreateDumpString(char const* tableName, QueryResult* result)
} }
std::ostringstream ss; std::ostringstream ss;
ss << "INSERT INTO " << _TABLE_SIM_ << tableName << _TABLE_SIM_ << " VALUES ("; ss << "INSERT INTO `" << tableName << "` VALUES (";
Field* fields = result->Fetch(); Field* fields = result->Fetch();
for (uint32 i = 0; i < result->GetFieldCount(); ++i) for (uint32 i = 0; i < result->GetFieldCount(); ++i)
{ {

View file

@ -497,8 +497,8 @@ void AchievementMgr::DeleteFromDB(ObjectGuid guid)
{ {
uint32 lowguid = guid.GetCounter(); uint32 lowguid = guid.GetCounter();
CharacterDatabase.BeginTransaction(); CharacterDatabase.BeginTransaction();
CharacterDatabase.PExecute("DELETE FROM character_achievement WHERE guid = %u", lowguid); CharacterDatabase.PExecute("DELETE FROM `character_achievement` WHERE `guid` = %u", lowguid);
CharacterDatabase.PExecute("DELETE FROM character_achievement_progress WHERE guid = %u", lowguid); CharacterDatabase.PExecute("DELETE FROM `character_achievement_progress` WHERE `guid` = %u", lowguid);
CharacterDatabase.CommitTransaction(); CharacterDatabase.CommitTransaction();
} }
@ -520,10 +520,10 @@ void AchievementMgr::SaveToDB()
/// mark as saved in db /// mark as saved in db
iter->second.changed = false; iter->second.changed = false;
SqlStatement stmt = CharacterDatabase.CreateStatement(delComplAchievements, "DELETE FROM character_achievement WHERE guid = ? AND achievement = ?"); SqlStatement stmt = CharacterDatabase.CreateStatement(delComplAchievements, "DELETE FROM `character_achievement` WHERE `guid` = ? AND `achievement` = ?");
stmt.PExecute(GetPlayer()->GetGUIDLow(), iter->first); stmt.PExecute(GetPlayer()->GetGUIDLow(), iter->first);
stmt = CharacterDatabase.CreateStatement(insComplAchievements, "INSERT INTO character_achievement (guid, achievement, date) VALUES (?, ?, ?)"); stmt = CharacterDatabase.CreateStatement(insComplAchievements, "INSERT INTO `character_achievement` (`guid`, `achievement`, `date`) VALUES (?, ?, ?)");
stmt.PExecute(GetPlayer()->GetGUIDLow(), iter->first, uint64(iter->second.date)); stmt.PExecute(GetPlayer()->GetGUIDLow(), iter->first, uint64(iter->second.date));
} }
} }
@ -540,7 +540,7 @@ void AchievementMgr::SaveToDB()
iter->second.changed = false; iter->second.changed = false;
// new/changed record data // new/changed record data
SqlStatement stmt = CharacterDatabase.CreateStatement(delProgress, "DELETE FROM character_achievement_progress WHERE guid = ? AND criteria = ?"); SqlStatement stmt = CharacterDatabase.CreateStatement(delProgress, "DELETE FROM `character_achievement_progress` WHERE `guid` = ? AND `criteria` = ?");
stmt.PExecute(GetPlayer()->GetGUIDLow(), iter->first); stmt.PExecute(GetPlayer()->GetGUIDLow(), iter->first);
bool needSave = iter->second.counter != 0; bool needSave = iter->second.counter != 0;
@ -552,7 +552,7 @@ void AchievementMgr::SaveToDB()
if (needSave) if (needSave)
{ {
stmt = CharacterDatabase.CreateStatement(insProgress, "INSERT INTO character_achievement_progress (guid, criteria, counter, date) VALUES (?, ?, ?, ?)"); stmt = CharacterDatabase.CreateStatement(insProgress, "INSERT INTO `character_achievement_progress` (`guid`, `criteria`, `counter`, `date`) VALUES (?, ?, ?, ?)");
stmt.PExecute(GetPlayer()->GetGUIDLow(), iter->first, iter->second.counter, uint64(iter->second.date)); stmt.PExecute(GetPlayer()->GetGUIDLow(), iter->first, iter->second.counter, uint64(iter->second.date));
} }
} }
@ -599,7 +599,7 @@ void AchievementMgr::LoadFromDB(QueryResult* achievementResult, QueryResult* cri
{ {
// we will remove nonexistent criteria for all characters // we will remove nonexistent criteria for all characters
sLog.outError("Nonexistent achievement criteria %u data removed from table `character_achievement_progress`.", id); sLog.outError("Nonexistent achievement criteria %u data removed from table `character_achievement_progress`.", id);
CharacterDatabase.PExecute("DELETE FROM character_achievement_progress WHERE criteria = %u", id); CharacterDatabase.PExecute("DELETE FROM `character_achievement_progress` WHERE `criteria` = %u", id);
continue; continue;
} }
@ -2289,7 +2289,7 @@ void AchievementMgr::IncompletedAchievement(AchievementEntry const* achievement)
m_player->SendDirectMessage(&data); m_player->SendDirectMessage(&data);
if (!itr->second.changed) // complete state saved if (!itr->second.changed) // complete state saved
CharacterDatabase.PExecute("DELETE FROM character_achievement WHERE guid = %u AND achievement = %u", CharacterDatabase.PExecute("DELETE FROM `character_achievement` WHERE `guid` = %u AND `achievement` = %u",
GetPlayer()->GetGUIDLow(), achievement->ID); GetPlayer()->GetGUIDLow(), achievement->ID);
m_completedAchievements.erase(achievement->ID); m_completedAchievements.erase(achievement->ID);
@ -2605,7 +2605,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaRequirements()
{ {
m_criteriaRequirementMap.clear(); // need for reload case m_criteriaRequirementMap.clear(); // need for reload case
QueryResult* result = WorldDatabase.Query("SELECT criteria_id, type, value1, value2 FROM achievement_criteria_requirement"); QueryResult* result = WorldDatabase.Query("SELECT `criteria_id`, `type`, `value1`, `value2` FROM `achievement_criteria_requirement`");
if (!result) if (!result)
{ {
@ -2735,7 +2735,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaRequirements()
void AchievementGlobalMgr::LoadCompletedAchievements() void AchievementGlobalMgr::LoadCompletedAchievements()
{ {
QueryResult* result = CharacterDatabase.Query("SELECT achievement FROM character_achievement GROUP BY achievement"); QueryResult* result = CharacterDatabase.Query("SELECT `achievement` FROM `character_achievement` GROUP BY `achievement`");
if (!result) if (!result)
{ {
@ -2758,7 +2758,7 @@ void AchievementGlobalMgr::LoadCompletedAchievements()
{ {
// we will remove nonexistent achievement for all characters // we will remove nonexistent achievement for all characters
sLog.outError("Nonexistent achievement %u data removed from table `character_achievement`.", achievement_id); sLog.outError("Nonexistent achievement %u data removed from table `character_achievement`.", achievement_id);
CharacterDatabase.PExecute("DELETE FROM character_achievement WHERE achievement = %u", achievement_id); CharacterDatabase.PExecute("DELETE FROM `character_achievement` WHERE `achievement` = %u", achievement_id);
continue; continue;
} }
@ -2777,7 +2777,7 @@ void AchievementGlobalMgr::LoadRewards()
m_achievementRewards.clear(); // need for reload case m_achievementRewards.clear(); // need for reload case
// 0 1 2 3 4 5 6 7 // 0 1 2 3 4 5 6 7
QueryResult* result = WorldDatabase.Query("SELECT entry, gender, title_A, title_H, item, sender, subject, text FROM achievement_reward"); QueryResult* result = WorldDatabase.Query("SELECT `entry`, `gender`, `title_A`, `title_H`, `item`, `sender`, `subject`, `text` FROM `achievement_reward`");
if (!result) if (!result)
{ {
@ -2908,7 +2908,7 @@ void AchievementGlobalMgr::LoadRewardLocales()
{ {
m_achievementRewardLocales.clear(); // need for reload case m_achievementRewardLocales.clear(); // need for reload case
QueryResult* result = WorldDatabase.Query("SELECT entry,gender,subject_loc1,text_loc1,subject_loc2,text_loc2,subject_loc3,text_loc3,subject_loc4,text_loc4,subject_loc5,text_loc5,subject_loc6,text_loc6,subject_loc7,text_loc7,subject_loc8,text_loc8 FROM locales_achievement_reward"); QueryResult* result = WorldDatabase.Query("SELECT `entry`,`gender`,`subject_loc1`,`text_loc1`,`subject_loc2`,`text_loc2`,`subject_loc3`,`text_loc3`,`subject_loc4`,`text_loc4`,`subject_loc5`,`text_loc5`,`subject_loc6`,`text_loc6`,`subject_loc7`,`text_loc7`,`subject_loc8`,`text_loc8` FROM `locales_achievement_reward`");
if (!result) if (!result)
{ {

View file

@ -371,9 +371,9 @@ void WorldSession::HandleCalendarUpdateEvent(WorldPacket& recv_data)
// query construction // query construction
CharacterDatabase.escape_string(title); CharacterDatabase.escape_string(title);
CharacterDatabase.escape_string(description); CharacterDatabase.escape_string(description);
CharacterDatabase.PExecute("UPDATE calendar_events SET " CharacterDatabase.PExecute("UPDATE `calendar_events` SET "
"type=%hu, flags=%u, dungeonId=%d, eventTime=%u, title='%s', description='%s'" "`type`=%hu, `flags`=%u, `dungeonId`=%d, `eventTime`=%lu, `title`='%s', `description`='%s'"
"WHERE eventid=" UI64FMTD, "WHERE `eventid` = " UI64FMTD,
type, flags, dungeonId, event->EventTime, title.c_str(), description.c_str(), eventId); type, flags, dungeonId, event->EventTime, title.c_str(), description.c_str(), eventId);
} }
else else
@ -445,7 +445,7 @@ void WorldSession::HandleCalendarEventInvite(WorldPacket& recv_data)
{ {
// Invitee offline, get data from database // Invitee offline, get data from database
CharacterDatabase.escape_string(name); CharacterDatabase.escape_string(name);
QueryResult* result = CharacterDatabase.PQuery("SELECT guid,race FROM characters WHERE name ='%s'", name.c_str()); QueryResult* result = CharacterDatabase.PQuery("SELECT `guid`,`race` FROM `characters` WHERE `name` = '%s'", name.c_str());
if (result) if (result)
{ {
Field* fields = result->Fetch(); Field* fields = result->Fetch();
@ -454,7 +454,7 @@ void WorldSession::HandleCalendarEventInvite(WorldPacket& recv_data)
inviteeGuildId = Player::GetGuildIdFromDB(inviteeGuid); inviteeGuildId = Player::GetGuildIdFromDB(inviteeGuid);
delete result; delete result;
result = CharacterDatabase.PQuery("SELECT flags FROM character_social WHERE guid = %u AND friend = %u", inviteeGuid.GetCounter(), playerGuid.GetCounter()); result = CharacterDatabase.PQuery("SELECT `flags` FROM `character_social` WHERE `guid` = %u AND `friend` = %u", inviteeGuid.GetCounter(), playerGuid.GetCounter());
if (result) if (result)
{ {
Field* fields = result->Fetch(); Field* fields = result->Fetch();
@ -563,7 +563,7 @@ void WorldSession::HandleCalendarEventRsvp(WorldPacket& recv_data)
invite->Status = CalendarInviteStatus(status); invite->Status = CalendarInviteStatus(status);
invite->LastUpdateTime = time(NULL); invite->LastUpdateTime = time(NULL);
CharacterDatabase.PExecute("UPDATE calendar_invites SET status=%u, lastUpdateTime=%u WHERE inviteId = " UI64FMTD, status, uint32(invite->LastUpdateTime), invite->InviteId); CharacterDatabase.PExecute("UPDATE `calendar_invites` SET `status`=%`u, `lastUpdateTime`=%u WHERE `inviteId` = " UI64FMTD , status, uint32(invite->LastUpdateTime), invite->InviteId);
sCalendarMgr.SendCalendarEventStatus(invite); sCalendarMgr.SendCalendarEventStatus(invite);
sCalendarMgr.SendCalendarClearPendingAction(_player); sCalendarMgr.SendCalendarClearPendingAction(_player);
} }
@ -636,7 +636,7 @@ void WorldSession::HandleCalendarEventStatus(WorldPacket& recv_data)
invite->Status = (CalendarInviteStatus)status; invite->Status = (CalendarInviteStatus)status;
invite->LastUpdateTime = time(NULL); // not sure if we should set response time when moderator changes invite status invite->LastUpdateTime = time(NULL); // not sure if we should set response time when moderator changes invite status
CharacterDatabase.PExecute("UPDATE calendar_invites SET status=%u, lastUpdateTime=%u WHERE inviteId=" UI64FMTD, status, uint32(invite->LastUpdateTime), invite->InviteId); CharacterDatabase.PExecute("UPDATE `calendar_invites` SET `status`=%u, `lastUpdateTime`=%u WHERE `inviteId`=" UI64FMTD, status, uint32(invite->LastUpdateTime), invite->InviteId);
sCalendarMgr.SendCalendarEventStatus(invite); sCalendarMgr.SendCalendarEventStatus(invite);
sCalendarMgr.SendCalendarClearPendingAction(sObjectMgr.GetPlayer(invitee)); sCalendarMgr.SendCalendarClearPendingAction(sObjectMgr.GetPlayer(invitee));
} }
@ -690,7 +690,7 @@ void WorldSession::HandleCalendarEventModeratorStatus(WorldPacket& recv_data)
return; return;
} }
CharacterDatabase.PExecute("UPDATE calendar_invites SET rank = %u WHERE inviteId=" UI64FMTD, rank, invite->InviteId); CharacterDatabase.PExecute("UPDATE `calendar_invites` SET `rank` = %u WHERE `inviteId` = " UI64FMTD, rank, invite->InviteId);
invite->Rank = CalendarModerationRank(rank); invite->Rank = CalendarModerationRank(rank);
sCalendarMgr.SendCalendarEventModeratorStatusAlert(invite); sCalendarMgr.SendCalendarEventModeratorStatusAlert(invite);
} }

View file

@ -1371,7 +1371,7 @@ void WorldSession::HandleCharCustomizeOpcode(WorldPacket& recv_data)
recv_data.ReadByteSeq(guid[1]); recv_data.ReadByteSeq(guid[1]);
recv_data.ReadByteSeq(guid[7]); recv_data.ReadByteSeq(guid[7]);
QueryResult* result = CharacterDatabase.PQuery("SELECT at_login FROM characters WHERE guid ='%u'", guid.GetCounter()); QueryResult* result = CharacterDatabase.PQuery("SELECT `at_login` FROM `characters` WHERE `guid` = '%u'", guid.GetCounter());
if (!result) if (!result)
{ {
WorldPacket data(SMSG_CHAR_CUSTOMIZE, 1); WorldPacket data(SMSG_CHAR_CUSTOMIZE, 1);
@ -1431,8 +1431,8 @@ void WorldSession::HandleCharCustomizeOpcode(WorldPacket& recv_data)
CharacterDatabase.escape_string(newname); CharacterDatabase.escape_string(newname);
Player::Customize(guid, gender, skin, face, hairStyle, hairColor, facialHair); Player::Customize(guid, gender, skin, face, hairStyle, hairColor, facialHair);
CharacterDatabase.PExecute("UPDATE characters set name = '%s', at_login = at_login & ~ %u WHERE guid ='%u'", newname.c_str(), uint32(AT_LOGIN_CUSTOMIZE), guid.GetCounter()); CharacterDatabase.PExecute("UPDATE `characters` SET `name` = '%s', `at_login` = `at_login` & ~ %u WHERE `guid` ='%u'", newname.c_str(), uint32(AT_LOGIN_CUSTOMIZE), guid.GetCounter());
CharacterDatabase.PExecute("DELETE FROM character_declinedname WHERE guid ='%u'", guid.GetCounter()); CharacterDatabase.PExecute("DELETE FROM `character_declinedname` WHERE `guid` ='%u'", guid.GetCounter());
std::string IP_str = GetRemoteAddress(); std::string IP_str = GetRemoteAddress();
sLog.outChar("Account: %d (IP: %s), Character %s customized to: %s", GetAccountId(), IP_str.c_str(), guid.GetString().c_str(), newname.c_str()); sLog.outChar("Account: %d (IP: %s), Character %s customized to: %s", GetAccountId(), IP_str.c_str(), guid.GetString().c_str(), newname.c_str());

View file

@ -1831,7 +1831,7 @@ void Group::SetRaidDifficulty(Difficulty difficulty)
{ {
m_raidDifficulty = difficulty; m_raidDifficulty = difficulty;
if (!isBGGroup()) if (!isBGGroup())
CharacterDatabase.PExecute("UPDATE groups SET raiddifficulty = %u WHERE groupId='%u'", m_raidDifficulty, m_Id); CharacterDatabase.PExecute("UPDATE `groups` SET `raiddifficulty` = %u WHERE `groupId` = '%u'", m_raidDifficulty, m_Id);
for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next()) for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next())
{ {

View file

@ -136,7 +136,7 @@ void GuildMgr::LoadGuilds()
// 0 1 2 3 4 5 6 // 0 1 2 3 4 5 6
QueryResult* result = CharacterDatabase.Query("SELECT `guild`.`guildid`,`guild`.`name`,`leaderguid`,`EmblemStyle`,`EmblemColor`,`BorderStyle`,`BorderColor`," QueryResult* result = CharacterDatabase.Query("SELECT `guild`.`guildid`,`guild`.`name`,`leaderguid`,`EmblemStyle`,`EmblemColor`,`BorderStyle`,`BorderColor`,"
// 7 8 9 10 11 12 // 7 8 9 10 11 12
"`BackgroundColor`,`info`,`motd`,`createdate`,`BankMoney`,(SELECT COUNT(`guild_bank_tab.guildid`) FROM `guild_bank_tab` WHERE `guild_bank_tab`.`guildid` = `guild`.`guildid`) " "`BackgroundColor`,`info`,`motd`,`createdate`,`BankMoney`,(SELECT COUNT(`guild_bank_tab`.`guildid`) FROM `guild_bank_tab` WHERE `guild_bank_tab`.`guildid` = `guild`.`guildid`) "
"FROM `guild` ORDER BY `guildid` ASC"); "FROM `guild` ORDER BY `guildid` ASC");
if (!result) if (!result)
@ -167,7 +167,7 @@ void GuildMgr::LoadGuilds()
// load guild bank tab rights // load guild bank tab rights
// 0 1 2 3 4 // 0 1 2 3 4
QueryResult* guildBankTabRightsResult = CharacterDatabase.Query("SELECT guildid,TabId,rid,gbright,SlotPerDay FROM guild_bank_right ORDER BY guildid ASC, TabId ASC"); QueryResult* guildBankTabRightsResult = CharacterDatabase.Query("SELECT `guildid`,`TabId`,`rid`,`gbright`,`SlotPerDay` FROM `guild_bank_right` ORDER BY `guildid` ASC, `TabId` ASC");
BarGoLink bar(result->GetRowCount()); BarGoLink bar(result->GetRowCount());

View file

@ -320,7 +320,7 @@ void DungeonPersistentState::UpdateEncounterState(EncounterCreditType type, uint
{ {
m_completedEncountersMask |= 1 << dbcEntry->encounterIndex; m_completedEncountersMask |= 1 << dbcEntry->encounterIndex;
CharacterDatabase.PExecute("UPDATE instance SET encountersMask = '%u' WHERE id = '%u'", m_completedEncountersMask, GetInstanceId()); CharacterDatabase.PExecute("UPDATE `instance` SET `encountersMask` = '%u' WHERE `id` = '%u'", m_completedEncountersMask, GetInstanceId());
DEBUG_LOG("DungeonPersistentState: Dungeon %s (Id %u) completed encounter %s", GetMap()->GetMapName(), GetInstanceId(), dbcEntry->encounterName[sWorld.GetDefaultDbcLocale()]); DEBUG_LOG("DungeonPersistentState: Dungeon %s (Id %u) completed encounter %s", GetMap()->GetMapName(), GetInstanceId(), dbcEntry->encounterName[sWorld.GetDefaultDbcLocale()]);
if (/*uint32 dungeonId =*/ iter->second->lastEncounterDungeon) if (/*uint32 dungeonId =*/ iter->second->lastEncounterDungeon)
@ -779,6 +779,7 @@ void MapPersistentStateManager::_DelHelper(DatabaseType& db, const char* fields,
vsnprintf(szQueryTail, MAX_QUERY_LEN, queryTail, ap); vsnprintf(szQueryTail, MAX_QUERY_LEN, queryTail, ap);
va_end(ap); va_end(ap);
// query is delimited in input
QueryResult* result = db.PQuery("SELECT %s FROM %s %s", fields, table, szQueryTail); QueryResult* result = db.PQuery("SELECT %s FROM %s %s", fields, table, szQueryTail);
if (result) if (result)
{ {

View file

@ -2405,7 +2405,7 @@ void World::_UpdateRealmCharCount(QueryResult* resultCharCount, uint32 accountId
void World::InitWeeklyQuestResetTime() void World::InitWeeklyQuestResetTime()
{ {
QueryResult* result = CharacterDatabase.Query("SELECT NextWeeklyQuestResetTime FROM saved_variables"); QueryResult* result = CharacterDatabase.Query("SELECT `NextWeeklyQuestResetTime` FROM `saved_variables`");
if (!result) if (!result)
m_NextWeeklyQuestReset = time_t(time(NULL)); // game time not yet init m_NextWeeklyQuestReset = time_t(time(NULL)); // game time not yet init
else else
@ -2432,7 +2432,7 @@ void World::InitWeeklyQuestResetTime()
m_NextWeeklyQuestReset = m_NextWeeklyQuestReset < curTime ? nextWeekResetTime - WEEK : nextWeekResetTime; m_NextWeeklyQuestReset = m_NextWeeklyQuestReset < curTime ? nextWeekResetTime - WEEK : nextWeekResetTime;
if (!result) if (!result)
CharacterDatabase.PExecute("INSERT INTO saved_variables (NextWeeklyQuestResetTime) VALUES ('" UI64FMTD "')", uint64(m_NextWeeklyQuestReset)); CharacterDatabase.PExecute("INSERT INTO `saved_variables` (`NextWeeklyQuestResetTime`) VALUES ('" UI64FMTD "')", uint64(m_NextWeeklyQuestReset));
else else
delete result; delete result;
} }
@ -2463,7 +2463,7 @@ void World::InitDailyQuestResetTime()
m_NextDailyQuestReset = m_NextDailyQuestReset < curTime ? nextDayResetTime - DAY : nextDayResetTime; m_NextDailyQuestReset = m_NextDailyQuestReset < curTime ? nextDayResetTime - DAY : nextDayResetTime;
if (!result) if (!result)
CharacterDatabase.PExecute("INSERT INTO saved_variables (NextDailyQuestResetTime) VALUES ('" UI64FMTD "')", uint64(m_NextDailyQuestReset)); CharacterDatabase.PExecute("INSERT INTO `saved_variables` (`NextDailyQuestResetTime`) VALUES ('" UI64FMTD "')", uint64(m_NextDailyQuestReset));
else else
delete result; delete result;
} }
@ -2472,7 +2472,7 @@ void World::SetMonthlyQuestResetTime(bool initialize)
{ {
if (initialize) if (initialize)
{ {
QueryResult* result = CharacterDatabase.Query("SELECT NextMonthlyQuestResetTime FROM saved_variables"); QueryResult* result = CharacterDatabase.Query("SELECT `NextMonthlyQuestResetTime` FROM `saved_variables`");
if (!result) if (!result)
m_NextMonthlyQuestReset = time_t(time(NULL)); m_NextMonthlyQuestReset = time_t(time(NULL));
@ -2511,7 +2511,7 @@ void World::SetMonthlyQuestResetTime(bool initialize)
m_NextMonthlyQuestReset = (initialize && m_NextMonthlyQuestReset < nextMonthResetTime) ? m_NextMonthlyQuestReset : nextMonthResetTime; m_NextMonthlyQuestReset = (initialize && m_NextMonthlyQuestReset < nextMonthResetTime) ? m_NextMonthlyQuestReset : nextMonthResetTime;
// Row must exist for this to work. Currently row is added by InitDailyQuestResetTime(), called before this function // Row must exist for this to work. Currently row is added by InitDailyQuestResetTime(), called before this function
CharacterDatabase.PExecute("UPDATE saved_variables SET NextMonthlyQuestResetTime = '" UI64FMTD "'", uint64(m_NextMonthlyQuestReset)); CharacterDatabase.PExecute("UPDATE `saved_variables` SET `NextMonthlyQuestResetTime` = '" UI64FMTD "'", uint64(m_NextMonthlyQuestReset));
} }
void World::InitCurrencyResetTime() void World::InitCurrencyResetTime()
@ -2554,7 +2554,7 @@ void World::InitCurrencyResetTime()
void World::InitRandomBGResetTime() void World::InitRandomBGResetTime()
{ {
QueryResult * result = CharacterDatabase.Query("SELECT NextRandomBGResetTime FROM saved_variables"); QueryResult * result = CharacterDatabase.Query("SELECT `NextRandomBGResetTime` FROM `saved_variables`");
if (!result) if (!result)
m_NextRandomBGReset = time_t(time(NULL)); // game time not yet init m_NextRandomBGReset = time_t(time(NULL)); // game time not yet init
else else
@ -2577,7 +2577,7 @@ void World::InitRandomBGResetTime()
// normalize reset time // normalize reset time
m_NextRandomBGReset = m_NextRandomBGReset < curTime ? nextDayResetTime - DAY : nextDayResetTime; m_NextRandomBGReset = m_NextRandomBGReset < curTime ? nextDayResetTime - DAY : nextDayResetTime;
if (!result) if (!result)
CharacterDatabase.PExecute("INSERT INTO saved_variables (NextRandomBGResetTime) VALUES ('" UI64FMTD "')", uint64(m_NextRandomBGReset)); CharacterDatabase.PExecute("INSERT INTO `saved_variables` (`NextRandomBGResetTime`) VALUES ('" UI64FMTD "')", uint64(m_NextRandomBGReset));
else else
delete result; delete result;
} }
@ -2585,7 +2585,7 @@ void World::InitRandomBGResetTime()
void World::ResetDailyQuests() void World::ResetDailyQuests()
{ {
DETAIL_LOG("Daily quests reset for all characters."); DETAIL_LOG("Daily quests reset for all characters.");
CharacterDatabase.Execute("DELETE FROM character_queststatus_daily"); CharacterDatabase.Execute("DELETE FROM `character_queststatus_daily`");
for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr) for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
if (itr->second->GetPlayer()) if (itr->second->GetPlayer())
itr->second->GetPlayer()->ResetDailyQuestStatus(); itr->second->GetPlayer()->ResetDailyQuestStatus();
@ -2597,13 +2597,13 @@ void World::ResetDailyQuests()
void World::ResetWeeklyQuests() void World::ResetWeeklyQuests()
{ {
DETAIL_LOG("Weekly quests reset for all characters."); DETAIL_LOG("Weekly quests reset for all characters.");
CharacterDatabase.Execute("DELETE FROM character_queststatus_weekly"); CharacterDatabase.Execute("DELETE FROM `character_queststatus_weekly`");
for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr) for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
if (itr->second->GetPlayer()) if (itr->second->GetPlayer())
itr->second->GetPlayer()->ResetWeeklyQuestStatus(); itr->second->GetPlayer()->ResetWeeklyQuestStatus();
m_NextWeeklyQuestReset = time_t(m_NextWeeklyQuestReset + WEEK); m_NextWeeklyQuestReset = time_t(m_NextWeeklyQuestReset + WEEK);
CharacterDatabase.PExecute("UPDATE saved_variables SET NextWeeklyQuestResetTime = '" UI64FMTD "'", uint64(m_NextWeeklyQuestReset)); CharacterDatabase.PExecute("UPDATE `saved_variables` SET `NextWeeklyQuestResetTime` = '" UI64FMTD "'", uint64(m_NextWeeklyQuestReset));
} }
void World::ResetMonthlyQuests() void World::ResetMonthlyQuests()

View file

@ -51,7 +51,6 @@ typedef DatabasePostgre DatabaseType;
*/ */
typedef DatabaseMysql DatabaseType; typedef DatabaseMysql DatabaseType;
#define _LIKE_ "LIKE" #define _LIKE_ "LIKE"
#define _TABLE_SIM_ "`"
#define _CONCAT3_(A,B,C) "CONCAT( " A " , " B " , " C " )" #define _CONCAT3_(A,B,C) "CONCAT( " A " , " B " , " C " )"
#define _OFFSET_ "LIMIT %d,1" #define _OFFSET_ "LIMIT %d,1"
#endif #endif