diff options
author | Machiavelli <none@none> | 2010-05-05 01:02:35 +0200 |
---|---|---|
committer | Machiavelli <none@none> | 2010-05-05 01:02:35 +0200 |
commit | 6649215e6135f13903f75c1e146f10b973aabd3a (patch) | |
tree | cf6b98f70da4e7e30d4dad947450dfdfa0309653 /src/game/Item.cpp | |
parent | ce17866ef08b10957e9a246a4a8d0839995033af (diff) |
Use DELETE + INSERT statement wrapped in a transaction in Item::SaveRefundDataToDB()
--HG--
branch : trunk
Diffstat (limited to 'src/game/Item.cpp')
-rw-r--r-- | src/game/Item.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/game/Item.cpp b/src/game/Item.cpp index 9927a936bc1..cbb27666033 100644 --- a/src/game/Item.cpp +++ b/src/game/Item.cpp @@ -1057,15 +1057,11 @@ void Item::BuildUpdate(UpdateDataMapType& data_map) void Item::SaveRefundDataToDB() { - std::ostringstream ss; - ss << "INSERT INTO item_refund_instance VALUES("; - ss << GetGUIDLow() << ","; - ss << GetRefundRecipient() << ","; - ss << GetPaidMoney() << ","; - ss << GetPaidExtendedCost(); - ss << ")"; - - CharacterDatabase.Execute(ss.str().c_str()); + CharacterDatabase.BeginTransaction(); + CharacterDatabase.PExecute("DELETE FROM item_refund_instance WHERE item_guid = '%u'", GetGUIDLow()); + CharacterDatabase.PExecute("INSERT INTO item_refund_instance (`item_guid`,`player_guid`,`paidMoney`,`paidExtendedCost`)" + " VALUES('%u','%u','%u','%u')", GetGUIDLow(), GetRefundRecipient(), GetPaidMoney(), GetPaidExtendedCost()); + CharacterDatabase.CommitTransaction(); } void Item::DeleteRefundDataFromDB() |