mirror of
https://github.com/mangosfour/server.git
synced 2025-12-18 10:37:01 +00:00
More SQL delimiting for modern servers (#166)
* Add delimiter to sql objects
This commit is contained in:
parent
95056c5a29
commit
bd4f8a8f40
21 changed files with 114 additions and 114 deletions
|
|
@ -4153,14 +4153,14 @@ bool ChatHandler::HandleCharacterCustomizeCommand(char* args)
|
|||
{
|
||||
PSendSysMessage(LANG_CUSTOMIZE_PLAYER, GetNameLink(target).c_str());
|
||||
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
|
||||
{
|
||||
std::string oldNameLink = playerLink(target_name);
|
||||
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -3146,7 +3146,7 @@ bool ChatHandler::HandleListItemCommand(char* args)
|
|||
|
||||
// guild bank case
|
||||
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)
|
||||
{
|
||||
guild_count = (*result)[0].GetUInt32();
|
||||
|
|
|
|||
|
|
@ -1115,7 +1115,7 @@ void AuctionEntry::AuctionBidWinning(Player* newbidder)
|
|||
moneyDeliveryTime = time(NULL) + HOUR;
|
||||
|
||||
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)
|
||||
{
|
||||
newbidder->SaveInventoryAndGoldToDB();
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ void CalendarEvent::RemoveInviteByItr(CalendarInviteMap::iterator inviteItr)
|
|||
|
||||
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;
|
||||
m_Invitee.erase(inviteItr);
|
||||
|
|
@ -317,7 +317,7 @@ CalendarEvent* CalendarMgr::AddEvent(ObjectGuid const& guid, std::string title,
|
|||
|
||||
CharacterDatabase.escape_string(title);
|
||||
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,
|
||||
guid.GetCounter(),
|
||||
guildId,
|
||||
|
|
@ -350,7 +350,7 @@ void CalendarMgr::RemoveEvent(uint64 eventId, Player* remover)
|
|||
|
||||
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
|
||||
citr->second.RemoveAllInvite(remover->GetObjectGuid());
|
||||
|
|
@ -413,7 +413,7 @@ CalendarInvite* CalendarMgr::AddInvite(CalendarEvent* event, ObjectGuid const& s
|
|||
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,
|
||||
event->EventId,
|
||||
inviteeGuid.GetCounter(),
|
||||
|
|
@ -584,7 +584,7 @@ void CalendarMgr::LoadCalendarsFromDB()
|
|||
sLog.outString("Loading Calendar Events...");
|
||||
|
||||
// 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)
|
||||
{
|
||||
BarGoLink bar(1);
|
||||
|
|
@ -625,7 +625,7 @@ void CalendarMgr::LoadCalendarsFromDB()
|
|||
|
||||
sLog.outString("Loading Calendar invites...");
|
||||
// 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)
|
||||
{
|
||||
BarGoLink bar(1);
|
||||
|
|
@ -666,7 +666,7 @@ void CalendarMgr::LoadCalendarsFromDB()
|
|||
if (!event)
|
||||
{
|
||||
// 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;
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ void GMTicketMgr::LoadGMTickets()
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ class GMTicket
|
|||
|
||||
std::string escapedString = m_text;
|
||||
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)
|
||||
|
|
@ -142,14 +142,14 @@ class GMTicket
|
|||
|
||||
std::string escapedString = m_responseText;
|
||||
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(); }
|
||||
|
||||
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
|
||||
|
|
@ -163,7 +163,7 @@ class GMTicket
|
|||
std::string escapedString2 = m_responseText;
|
||||
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();
|
||||
}
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -1710,7 +1710,7 @@ uint32 Guild::GetMemberSlotWithdrawRem(uint32 LowGuid, uint8 TabId)
|
|||
{
|
||||
member.BankResetTimeTab[TabId] = curTime;
|
||||
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);
|
||||
}
|
||||
return member.BankRemSlotsTab[TabId];
|
||||
|
|
@ -1736,7 +1736,7 @@ uint64 Guild::GetMemberMoneyWithdrawRem(uint32 LowGuid)
|
|||
{
|
||||
member.BankResetTimeMoney = curTime;
|
||||
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);
|
||||
}
|
||||
return member.BankRemMoney;
|
||||
|
|
|
|||
|
|
@ -2795,7 +2795,7 @@ void ObjectMgr::LoadItemExpireConverts()
|
|||
|
||||
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)
|
||||
{
|
||||
|
|
@ -2857,7 +2857,7 @@ void ObjectMgr::LoadItemRequiredTarget()
|
|||
|
||||
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)
|
||||
{
|
||||
|
|
@ -5107,7 +5107,7 @@ void ObjectMgr::LoadPageTextLocales()
|
|||
{
|
||||
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)
|
||||
{
|
||||
|
|
@ -6418,7 +6418,7 @@ void ObjectMgr::SetHighestGuids()
|
|||
delete result;
|
||||
}
|
||||
|
||||
result = CharacterDatabase.Query("SELECT MAX(id) FROM instance");
|
||||
result = CharacterDatabase.Query("SELECT MAX(`id`) FROM `instance`");
|
||||
if (result)
|
||||
{
|
||||
m_InstanceGuids.Set((*result)[0].GetUInt32() + 1);
|
||||
|
|
@ -7387,7 +7387,7 @@ void ObjectMgr::LoadPointsOfInterest()
|
|||
uint32 count = 0;
|
||||
|
||||
// 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)
|
||||
{
|
||||
|
|
@ -7439,7 +7439,7 @@ void ObjectMgr::LoadQuestPOI()
|
|||
uint32 count = 0;
|
||||
|
||||
// 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)
|
||||
{
|
||||
|
|
@ -7478,7 +7478,7 @@ void ObjectMgr::LoadQuestPOI()
|
|||
|
||||
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)
|
||||
{
|
||||
|
|
@ -7518,7 +7518,7 @@ void ObjectMgr::LoadDungeonFinderRequirements()
|
|||
mDungeonFinderRequirementsMap.clear(); // in case of a reload
|
||||
|
||||
// 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)
|
||||
{
|
||||
|
|
@ -7625,7 +7625,7 @@ void ObjectMgr::LoadDungeonFinderRewards()
|
|||
mDungeonFinderRewardsMap.clear(); // in case of a reload
|
||||
|
||||
// 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)
|
||||
{
|
||||
|
|
@ -7668,7 +7668,7 @@ void ObjectMgr::LoadDungeonFinderItems()
|
|||
mDungeonFinderItemsMap.clear(); // in case of reload
|
||||
|
||||
// 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)
|
||||
{
|
||||
|
|
@ -9752,7 +9752,7 @@ void ObjectMgr::LoadMailLevelRewards()
|
|||
m_mailLevelRewardMap.clear(); // for reload case
|
||||
|
||||
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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -311,7 +311,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c
|
|||
|
||||
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)
|
||||
{
|
||||
|
|
@ -1981,7 +1981,7 @@ void Pet::resetTalentsForAllPetsOf(Player* owner, Pet* online_pet /*= NULL*/)
|
|||
uint32 except_petnumber = online_pet ? online_pet->GetCharmInfo()->GetPetNumber() : 0;
|
||||
|
||||
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);
|
||||
|
||||
// no offline pets
|
||||
|
|
@ -1991,8 +1991,8 @@ void Pet::resetTalentsForAllPetsOf(Player* owner, Pet* online_pet /*= NULL*/)
|
|||
}
|
||||
|
||||
QueryResult* result = CharacterDatabase.PQuery(
|
||||
"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",
|
||||
"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",
|
||||
owner->GetGUIDLow(), except_petnumber);
|
||||
|
||||
if (!result)
|
||||
|
|
@ -2003,7 +2003,7 @@ void Pet::resetTalentsForAllPetsOf(Player* owner, Pet* online_pet /*= NULL*/)
|
|||
|
||||
bool need_comma = false;
|
||||
std::ostringstream ss;
|
||||
ss << "DELETE FROM pet_spell WHERE guid IN (";
|
||||
ss << "DELETE FROM `pet_spell` WHERE `guid` IN (";
|
||||
|
||||
do
|
||||
{
|
||||
|
|
@ -2022,7 +2022,7 @@ void Pet::resetTalentsForAllPetsOf(Player* owner, Pet* online_pet /*= NULL*/)
|
|||
|
||||
delete resultPets;
|
||||
|
||||
ss << ") AND spell IN (";
|
||||
ss << ") AND `spell` IN (";
|
||||
|
||||
bool need_execute = false;
|
||||
do
|
||||
|
|
|
|||
|
|
@ -17976,7 +17976,7 @@ void Player::_LoadSpells(QueryResult* result)
|
|||
{
|
||||
sLog.outError("Player::_LoadSpells: %s has talent spell %u in character_spell, removing it.",
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -18003,7 +18003,7 @@ void Player::_LoadTalents(QueryResult* result)
|
|||
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);
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -18012,7 +18012,7 @@ void Player::_LoadTalents(QueryResult* result)
|
|||
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);
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -18020,7 +18020,7 @@ void Player::_LoadTalents(QueryResult* result)
|
|||
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);
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -18029,7 +18029,7 @@ void Player::_LoadTalents(QueryResult* result)
|
|||
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);
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -18038,14 +18038,14 @@ void Player::_LoadTalents(QueryResult* result)
|
|||
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);
|
||||
CharacterDatabase.PExecute("DELETE FROM character_talent WHERE spec = '%u' ", spec);
|
||||
CharacterDatabase.PExecute("DELETE FROM `character_talent` WHERE `spec` = '%u' ", spec);
|
||||
continue;
|
||||
}
|
||||
|
||||
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);
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -18124,7 +18124,7 @@ void Player::_LoadBoundInstances(QueryResult* result)
|
|||
if (difficulty >= MAX_DIFFICULTY)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -18132,7 +18132,7 @@ void Player::_LoadBoundInstances(QueryResult* result)
|
|||
if (!mapDiff)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -18714,7 +18714,7 @@ void Player::_SaveActions()
|
|||
break;
|
||||
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(uint32(itr->second.GetType()));
|
||||
stmt.addUInt32(GetGUIDLow());
|
||||
|
|
@ -18727,7 +18727,7 @@ void Player::_SaveActions()
|
|||
break;
|
||||
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(uint32(itr->first));
|
||||
stmt.addUInt32(i);
|
||||
|
|
@ -18835,19 +18835,19 @@ void Player::_SaveGlyphs()
|
|||
{
|
||||
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());
|
||||
break;
|
||||
}
|
||||
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);
|
||||
break;
|
||||
}
|
||||
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);
|
||||
break;
|
||||
}
|
||||
|
|
@ -19136,8 +19136,8 @@ void Player::_SaveWeeklyQuestStatus()
|
|||
static SqlStatementID delQuestStatus ;
|
||||
static SqlStatementID insQuestStatus ;
|
||||
|
||||
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 stmtDel = CharacterDatabase.CreateStatement(delQuestStatus, "DELETE FROM `character_queststatus_weekly` WHERE `guid` = ?");
|
||||
SqlStatement stmtIns = CharacterDatabase.CreateStatement(insQuestStatus, "INSERT INTO `character_queststatus_weekly` (`guid`,`quest`) VALUES (?, ?)");
|
||||
|
||||
stmtDel.PExecute(GetGUIDLow());
|
||||
|
||||
|
|
@ -19161,8 +19161,8 @@ void Player::_SaveMonthlyQuestStatus()
|
|||
static SqlStatementID deleteQuest ;
|
||||
static SqlStatementID insertQuest ;
|
||||
|
||||
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 stmtDel = CharacterDatabase.CreateStatement(deleteQuest, "DELETE FROM `character_queststatus_monthly` WHERE `guid` = ?");
|
||||
SqlStatement stmtIns = CharacterDatabase.CreateStatement(insertQuest, "INSERT INTO `character_queststatus_monthly` (`guid`, `quest`) VALUES (?, ?)");
|
||||
|
||||
stmtDel.PExecute(GetGUIDLow());
|
||||
|
||||
|
|
@ -19266,8 +19266,8 @@ void Player::_SaveTalents()
|
|||
static SqlStatementID delTalents ;
|
||||
static SqlStatementID insTalents ;
|
||||
|
||||
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 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 (?, ?, ?, ?)");
|
||||
|
||||
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)
|
||||
{
|
||||
// 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)
|
||||
{
|
||||
return;
|
||||
|
|
@ -19454,7 +19454,7 @@ void Player::Customize(ObjectGuid guid, uint8 gender, uint8 skin, uint8 face, ui
|
|||
player_bytes2 &= ~0xFF;
|
||||
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;
|
||||
}
|
||||
|
|
@ -24766,9 +24766,9 @@ void Player::_SaveEquipmentSets()
|
|||
break; // nothing do
|
||||
case EQUIPMENT_SET_CHANGED:
|
||||
{
|
||||
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=?, "
|
||||
"item15=?, item16=?, item17=?, item18=? WHERE guid=? AND setguid=? AND setindex=?");
|
||||
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`=?, "
|
||||
"`item15`=?, `item16`=?, `item17`=?, `item18`=? WHERE `guid`=? AND `setguid`=? AND `setindex`=?");
|
||||
|
||||
stmt.addString(eqset.Name);
|
||||
stmt.addString(eqset.IconName);
|
||||
|
|
@ -24791,7 +24791,7 @@ void Player::_SaveEquipmentSets()
|
|||
}
|
||||
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.addUInt64(eqset.Guid);
|
||||
stmt.addUInt32(index);
|
||||
|
|
@ -24812,7 +24812,7 @@ void Player::_SaveEquipmentSets()
|
|||
}
|
||||
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);
|
||||
m_EquipmentSets.erase(itr++);
|
||||
break;
|
||||
|
|
@ -24832,13 +24832,13 @@ void Player::_SaveBGData()
|
|||
static SqlStatementID delBGData ;
|
||||
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());
|
||||
|
||||
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 */
|
||||
stmt.addUInt32(GetGUIDLow());
|
||||
stmt.addUInt32(m_bgData.bgInstanceID);
|
||||
|
|
|
|||
|
|
@ -958,7 +958,7 @@ void WorldSession::SendAuthResponse(uint8 code, bool queued, uint32 queuePos)
|
|||
void WorldSession::LoadGlobalAccountData()
|
||||
{
|
||||
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
|
||||
);
|
||||
}
|
||||
|
|
@ -1012,10 +1012,10 @@ void WorldSession::SetAccountData(AccountDataType type, time_t time_, const std:
|
|||
|
||||
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 = 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());
|
||||
|
||||
CharacterDatabase.CommitTransaction();
|
||||
|
|
@ -1033,10 +1033,10 @@ void WorldSession::SetAccountData(AccountDataType type, time_t time_, const std:
|
|||
|
||||
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 = 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());
|
||||
|
||||
CharacterDatabase.CommitTransaction();
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ bool CharacterDatabaseCleaner::TalentCheck(uint32 talent_id)
|
|||
|
||||
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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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::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)
|
||||
{
|
||||
return "";
|
||||
|
|
@ -250,7 +250,7 @@ std::string CreateDumpString(char const* tableName, QueryResult* result)
|
|||
}
|
||||
|
||||
std::ostringstream ss;
|
||||
ss << "INSERT INTO " << _TABLE_SIM_ << tableName << _TABLE_SIM_ << " VALUES (";
|
||||
ss << "INSERT INTO `" << tableName << "` VALUES (";
|
||||
Field* fields = result->Fetch();
|
||||
for (uint32 i = 0; i < result->GetFieldCount(); ++i)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -497,8 +497,8 @@ void AchievementMgr::DeleteFromDB(ObjectGuid guid)
|
|||
{
|
||||
uint32 lowguid = guid.GetCounter();
|
||||
CharacterDatabase.BeginTransaction();
|
||||
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` WHERE `guid` = %u", lowguid);
|
||||
CharacterDatabase.PExecute("DELETE FROM `character_achievement_progress` WHERE `guid` = %u", lowguid);
|
||||
CharacterDatabase.CommitTransaction();
|
||||
}
|
||||
|
||||
|
|
@ -520,10 +520,10 @@ void AchievementMgr::SaveToDB()
|
|||
/// mark as saved in db
|
||||
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 = 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));
|
||||
}
|
||||
}
|
||||
|
|
@ -540,7 +540,7 @@ void AchievementMgr::SaveToDB()
|
|||
iter->second.changed = false;
|
||||
|
||||
// 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);
|
||||
|
||||
bool needSave = iter->second.counter != 0;
|
||||
|
|
@ -552,7 +552,7 @@ void AchievementMgr::SaveToDB()
|
|||
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
|
@ -599,7 +599,7 @@ void AchievementMgr::LoadFromDB(QueryResult* achievementResult, QueryResult* cri
|
|||
{
|
||||
// we will remove nonexistent criteria for all characters
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -2289,7 +2289,7 @@ void AchievementMgr::IncompletedAchievement(AchievementEntry const* achievement)
|
|||
m_player->SendDirectMessage(&data);
|
||||
|
||||
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);
|
||||
|
||||
m_completedAchievements.erase(achievement->ID);
|
||||
|
|
@ -2605,7 +2605,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaRequirements()
|
|||
{
|
||||
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)
|
||||
{
|
||||
|
|
@ -2735,7 +2735,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaRequirements()
|
|||
|
||||
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)
|
||||
{
|
||||
|
|
@ -2758,7 +2758,7 @@ void AchievementGlobalMgr::LoadCompletedAchievements()
|
|||
{
|
||||
// we will remove nonexistent achievement for all characters
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -2777,7 +2777,7 @@ void AchievementGlobalMgr::LoadRewards()
|
|||
m_achievementRewards.clear(); // need for reload case
|
||||
|
||||
// 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)
|
||||
{
|
||||
|
|
@ -2908,7 +2908,7 @@ void AchievementGlobalMgr::LoadRewardLocales()
|
|||
{
|
||||
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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -371,9 +371,9 @@ void WorldSession::HandleCalendarUpdateEvent(WorldPacket& recv_data)
|
|||
// query construction
|
||||
CharacterDatabase.escape_string(title);
|
||||
CharacterDatabase.escape_string(description);
|
||||
CharacterDatabase.PExecute("UPDATE calendar_events SET "
|
||||
"type=%hu, flags=%u, dungeonId=%d, eventTime=%u, title='%s', description='%s'"
|
||||
"WHERE eventid=" UI64FMTD,
|
||||
CharacterDatabase.PExecute("UPDATE `calendar_events` SET "
|
||||
"`type`=%hu, `flags`=%u, `dungeonId`=%d, `eventTime`=%lu, `title`='%s', `description`='%s'"
|
||||
"WHERE `eventid` = " UI64FMTD,
|
||||
type, flags, dungeonId, event->EventTime, title.c_str(), description.c_str(), eventId);
|
||||
}
|
||||
else
|
||||
|
|
@ -445,7 +445,7 @@ void WorldSession::HandleCalendarEventInvite(WorldPacket& recv_data)
|
|||
{
|
||||
// Invitee offline, get data from database
|
||||
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)
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
|
|
@ -454,7 +454,7 @@ void WorldSession::HandleCalendarEventInvite(WorldPacket& recv_data)
|
|||
inviteeGuildId = Player::GetGuildIdFromDB(inviteeGuid);
|
||||
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)
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
|
|
@ -563,7 +563,7 @@ void WorldSession::HandleCalendarEventRsvp(WorldPacket& recv_data)
|
|||
invite->Status = CalendarInviteStatus(status);
|
||||
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.SendCalendarClearPendingAction(_player);
|
||||
}
|
||||
|
|
@ -636,7 +636,7 @@ void WorldSession::HandleCalendarEventStatus(WorldPacket& recv_data)
|
|||
invite->Status = (CalendarInviteStatus)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.SendCalendarClearPendingAction(sObjectMgr.GetPlayer(invitee));
|
||||
}
|
||||
|
|
@ -690,7 +690,7 @@ void WorldSession::HandleCalendarEventModeratorStatus(WorldPacket& recv_data)
|
|||
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);
|
||||
sCalendarMgr.SendCalendarEventModeratorStatusAlert(invite);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1371,7 +1371,7 @@ void WorldSession::HandleCharCustomizeOpcode(WorldPacket& recv_data)
|
|||
recv_data.ReadByteSeq(guid[1]);
|
||||
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)
|
||||
{
|
||||
WorldPacket data(SMSG_CHAR_CUSTOMIZE, 1);
|
||||
|
|
@ -1431,8 +1431,8 @@ void WorldSession::HandleCharCustomizeOpcode(WorldPacket& recv_data)
|
|||
|
||||
CharacterDatabase.escape_string(newname);
|
||||
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("DELETE FROM character_declinedname WHERE guid ='%u'", 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());
|
||||
|
||||
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());
|
||||
|
|
|
|||
|
|
@ -1831,7 +1831,7 @@ void Group::SetRaidDifficulty(Difficulty difficulty)
|
|||
{
|
||||
m_raidDifficulty = difficulty;
|
||||
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())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ void GuildMgr::LoadGuilds()
|
|||
// 0 1 2 3 4 5 6
|
||||
QueryResult* result = CharacterDatabase.Query("SELECT `guild`.`guildid`,`guild`.`name`,`leaderguid`,`EmblemStyle`,`EmblemColor`,`BorderStyle`,`BorderColor`,"
|
||||
// 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");
|
||||
|
||||
if (!result)
|
||||
|
|
@ -167,7 +167,7 @@ void GuildMgr::LoadGuilds()
|
|||
|
||||
// load guild bank tab rights
|
||||
// 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());
|
||||
|
||||
|
|
|
|||
|
|
@ -320,7 +320,7 @@ void DungeonPersistentState::UpdateEncounterState(EncounterCreditType type, uint
|
|||
{
|
||||
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()]);
|
||||
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);
|
||||
va_end(ap);
|
||||
|
||||
// query is delimited in input
|
||||
QueryResult* result = db.PQuery("SELECT %s FROM %s %s", fields, table, szQueryTail);
|
||||
if (result)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2405,7 +2405,7 @@ void World::_UpdateRealmCharCount(QueryResult* resultCharCount, uint32 accountId
|
|||
|
||||
void World::InitWeeklyQuestResetTime()
|
||||
{
|
||||
QueryResult* result = CharacterDatabase.Query("SELECT NextWeeklyQuestResetTime FROM saved_variables");
|
||||
QueryResult* result = CharacterDatabase.Query("SELECT `NextWeeklyQuestResetTime` FROM `saved_variables`");
|
||||
if (!result)
|
||||
m_NextWeeklyQuestReset = time_t(time(NULL)); // game time not yet init
|
||||
else
|
||||
|
|
@ -2432,7 +2432,7 @@ void World::InitWeeklyQuestResetTime()
|
|||
m_NextWeeklyQuestReset = m_NextWeeklyQuestReset < curTime ? nextWeekResetTime - WEEK : nextWeekResetTime;
|
||||
|
||||
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
|
||||
delete result;
|
||||
}
|
||||
|
|
@ -2463,7 +2463,7 @@ void World::InitDailyQuestResetTime()
|
|||
m_NextDailyQuestReset = m_NextDailyQuestReset < curTime ? nextDayResetTime - DAY : nextDayResetTime;
|
||||
|
||||
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
|
||||
delete result;
|
||||
}
|
||||
|
|
@ -2472,7 +2472,7 @@ void World::SetMonthlyQuestResetTime(bool initialize)
|
|||
{
|
||||
if (initialize)
|
||||
{
|
||||
QueryResult* result = CharacterDatabase.Query("SELECT NextMonthlyQuestResetTime FROM saved_variables");
|
||||
QueryResult* result = CharacterDatabase.Query("SELECT `NextMonthlyQuestResetTime` FROM `saved_variables`");
|
||||
|
||||
if (!result)
|
||||
m_NextMonthlyQuestReset = time_t(time(NULL));
|
||||
|
|
@ -2511,7 +2511,7 @@ void World::SetMonthlyQuestResetTime(bool initialize)
|
|||
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
|
||||
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()
|
||||
|
|
@ -2554,7 +2554,7 @@ void World::InitCurrencyResetTime()
|
|||
|
||||
void World::InitRandomBGResetTime()
|
||||
{
|
||||
QueryResult * result = CharacterDatabase.Query("SELECT NextRandomBGResetTime FROM saved_variables");
|
||||
QueryResult * result = CharacterDatabase.Query("SELECT `NextRandomBGResetTime` FROM `saved_variables`");
|
||||
if (!result)
|
||||
m_NextRandomBGReset = time_t(time(NULL)); // game time not yet init
|
||||
else
|
||||
|
|
@ -2577,7 +2577,7 @@ void World::InitRandomBGResetTime()
|
|||
// normalize reset time
|
||||
m_NextRandomBGReset = m_NextRandomBGReset < curTime ? nextDayResetTime - DAY : nextDayResetTime;
|
||||
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
|
||||
delete result;
|
||||
}
|
||||
|
|
@ -2585,7 +2585,7 @@ void World::InitRandomBGResetTime()
|
|||
void World::ResetDailyQuests()
|
||||
{
|
||||
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)
|
||||
if (itr->second->GetPlayer())
|
||||
itr->second->GetPlayer()->ResetDailyQuestStatus();
|
||||
|
|
@ -2597,13 +2597,13 @@ void World::ResetDailyQuests()
|
|||
void World::ResetWeeklyQuests()
|
||||
{
|
||||
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)
|
||||
if (itr->second->GetPlayer())
|
||||
itr->second->GetPlayer()->ResetWeeklyQuestStatus();
|
||||
|
||||
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()
|
||||
|
|
|
|||
|
|
@ -51,7 +51,6 @@ typedef DatabasePostgre DatabaseType;
|
|||
*/
|
||||
typedef DatabaseMysql DatabaseType;
|
||||
#define _LIKE_ "LIKE"
|
||||
#define _TABLE_SIM_ "`"
|
||||
#define _CONCAT3_(A,B,C) "CONCAT( " A " , " B " , " C " )"
|
||||
#define _OFFSET_ "LIMIT %d,1"
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue