Use DELETE + INSERT statement wrapped in a transaction in Item::SaveRefundDataToDB()

--HG--
branch : trunk
This commit is contained in:
Machiavelli
2010-05-05 01:02:35 +02:00
parent ce17866ef0
commit 6649215e61
+5 -9
View File
@@ -1057,15 +1057,11 @@ void Item::BuildUpdate(UpdateDataMapType& data_map)
void Item::SaveRefundDataToDB() void Item::SaveRefundDataToDB()
{ {
std::ostringstream ss; CharacterDatabase.BeginTransaction();
ss << "INSERT INTO item_refund_instance VALUES("; CharacterDatabase.PExecute("DELETE FROM item_refund_instance WHERE item_guid = '%u'", GetGUIDLow());
ss << GetGUIDLow() << ","; CharacterDatabase.PExecute("INSERT INTO item_refund_instance (`item_guid`,`player_guid`,`paidMoney`,`paidExtendedCost`)"
ss << GetRefundRecipient() << ","; " VALUES('%u','%u','%u','%u')", GetGUIDLow(), GetRefundRecipient(), GetPaidMoney(), GetPaidExtendedCost());
ss << GetPaidMoney() << ","; CharacterDatabase.CommitTransaction();
ss << GetPaidExtendedCost();
ss << ")";
CharacterDatabase.Execute(ss.str().c_str());
} }
void Item::DeleteRefundDataFromDB() void Item::DeleteRefundDataFromDB()