Core/Auction: wrap item deletions from AHBot auction on a transaction

This speeds up the query execution time tremendously
Refs #19182
This commit is contained in:
ariel-
2017-04-03 22:44:14 -03:00
parent 58f2e62098
commit ae9995f463
2 changed files with 6 additions and 6 deletions

View File

@@ -182,7 +182,7 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction, SQLTransaction&
else
{
// bidder doesn't exist, delete the item
sAuctionMgr->RemoveAItem(auction->itemGUIDLow, true);
sAuctionMgr->RemoveAItem(auction->itemGUIDLow, true, &trans);
}
}
@@ -247,7 +247,7 @@ void AuctionHouseMgr::SendAuctionExpiredMail(AuctionEntry* auction, SQLTransacti
else
{
// owner doesn't exist, delete the item
sAuctionMgr->RemoveAItem(auction->itemGUIDLow, true);
sAuctionMgr->RemoveAItem(auction->itemGUIDLow, true, &trans);
}
}
@@ -392,7 +392,7 @@ void AuctionHouseMgr::AddAItem(Item* it)
mAitems[it->GetGUID().GetCounter()] = it;
}
bool AuctionHouseMgr::RemoveAItem(ObjectGuid::LowType id, bool deleteItem)
bool AuctionHouseMgr::RemoveAItem(ObjectGuid::LowType id, bool deleteItem /*= false*/, SQLTransaction* trans /*= nullptr*/)
{
ItemMap::iterator i = mAitems.find(id);
if (i == mAitems.end())
@@ -400,9 +400,9 @@ bool AuctionHouseMgr::RemoveAItem(ObjectGuid::LowType id, bool deleteItem)
if (deleteItem)
{
SQLTransaction trans = SQLTransaction(nullptr);
ASSERT(trans);
i->second->FSetState(ITEM_REMOVED);
i->second->SaveToDB(trans);
i->second->SaveToDB(*trans);
}
mAitems.erase(i);

View File

@@ -190,7 +190,7 @@ class TC_GAME_API AuctionHouseMgr
void LoadAuctions();
void AddAItem(Item* it);
bool RemoveAItem(ObjectGuid::LowType id, bool deleteItem = false);
bool RemoveAItem(ObjectGuid::LowType id, bool deleteItem = false, SQLTransaction* trans = nullptr);
bool PendingAuctionAdd(Player* player, AuctionEntry* aEntry, Item* item);
uint32 PendingAuctionCount(const Player* player) const;
void PendingAuctionProcess(Player* player);