diff options
Diffstat (limited to 'src/game/Item.cpp')
-rw-r--r-- | src/game/Item.cpp | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/game/Item.cpp b/src/game/Item.cpp index b2821ae7b83..f6b50704abd 100644 --- a/src/game/Item.cpp +++ b/src/game/Item.cpp @@ -300,17 +300,14 @@ void Item::SaveToDB() switch (uState) { case ITEM_NEW: - { - CharacterDatabase.PExecute( "DELETE FROM item_instance WHERE guid = '%u'", guid ); std::ostringstream ss; - ss << "INSERT INTO item_instance (guid,owner_guid,data) VALUES (" << guid << "," << GUID_LOPART(GetOwnerGUID()) << ",'"; + ss << "REPLACE INTO item_instance (guid,owner_guid,data) VALUES (" << guid << "," << GUID_LOPART(GetOwnerGUID()) << ",'"; for (uint16 i = 0; i < m_valuesCount; ++i ) ss << GetUInt32Value(i) << " "; ss << "' )"; - CharacterDatabase.Execute( ss.str().c_str() ); - } break; + CharacterDatabase.Execute(ss.str().c_str()); + break; case ITEM_CHANGED: - { std::ostringstream ss; ss << "UPDATE item_instance SET data = '"; for (uint16 i = 0; i < m_valuesCount; ++i ) @@ -321,9 +318,8 @@ void Item::SaveToDB() if(HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_WRAPPED)) CharacterDatabase.PExecute("UPDATE character_gifts SET guid = '%u' WHERE item_guid = '%u'", GUID_LOPART(GetOwnerGUID()),GetGUIDLow()); - } break; + break; case ITEM_REMOVED: - { if (GetUInt32Value(ITEM_FIELD_ITEM_TEXT_ID) > 0 ) CharacterDatabase.PExecute("DELETE FROM item_text WHERE id = '%u'", GetUInt32Value(ITEM_FIELD_ITEM_TEXT_ID)); CharacterDatabase.PExecute("DELETE FROM item_instance WHERE guid = '%u'", guid); @@ -331,7 +327,6 @@ void Item::SaveToDB() CharacterDatabase.PExecute("DELETE FROM character_gifts WHERE item_guid = '%u'", GetGUIDLow()); delete this; return; - } case ITEM_UNCHANGED: break; } |