diff options
author | n0n4m3 <none@none> | 2010-04-14 12:43:42 +0400 |
---|---|---|
committer | n0n4m3 <none@none> | 2010-04-14 12:43:42 +0400 |
commit | e3e5ca62270f010d5dbc2c160db22cbffa6dc94b (patch) | |
tree | a60290ce37faf031fbe705121e7efa446f77c846 /src/game/Item.cpp | |
parent | 61e71986f076f636619380da8e800f084b4465f5 (diff) |
Drop not needed table 'item_text', add new column 'text' in table 'item_instance'. Original patch by Vladimir.
--HG--
branch : trunk
Diffstat (limited to 'src/game/Item.cpp')
-rw-r--r-- | src/game/Item.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/game/Item.cpp b/src/game/Item.cpp index 8a20fa91973..30023f511ab 100644 --- a/src/game/Item.cpp +++ b/src/game/Item.cpp @@ -308,20 +308,25 @@ void Item::SaveToDB() { case ITEM_NEW: { + std::string text = m_text; + CharacterDatabase.escape_string(text); std::ostringstream ss; - ss << "REPLACE INTO item_instance (guid,owner_guid,data) VALUES (" << guid << "," << GUID_LOPART(GetOwnerGUID()) << ",'"; + ss << "REPLACE INTO item_instance (guid, owner_guid, data, text) VALUES (" << guid << "," << GUID_LOPART(GetOwnerGUID()) << ",'"; for (uint16 i = 0; i < m_valuesCount; ++i) ss << GetUInt32Value(i) << " "; - ss << "')"; + ss << "', '" << text << "')"; CharacterDatabase.Execute(ss.str().c_str()); }break; case ITEM_CHANGED: { + std::string text = m_text; + CharacterDatabase.escape_string(text); std::ostringstream ss; ss << "UPDATE item_instance SET data = '"; for (uint16 i = 0; i < m_valuesCount; ++i) ss << GetUInt32Value(i) << " "; - ss << "', owner_guid = '" << GUID_LOPART(GetOwnerGUID()) << "' WHERE guid = '" << guid << "'"; + ss << "', owner_guid = '" << GUID_LOPART(GetOwnerGUID()); + ss << "', text = '" << text << "' WHERE guid = '" << guid << "'"; CharacterDatabase.Execute(ss.str().c_str()); @@ -330,8 +335,6 @@ void Item::SaveToDB() }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); if (HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_WRAPPED)) CharacterDatabase.PExecute("DELETE FROM character_gifts WHERE item_guid = '%u'", GetGUIDLow()); |