[9702] Drop now redundent item_text table.

* In beggining bad news: at 3.3.3 switch has been forgoted item_instance.data field chnage.
  In result items with texts (mail copy in to inventory, some other) lost text content.
* That why in current commit item_text droped without convertion. In result all itesm with texts
  will lost text. Sorry for this as i think small porblem :(
* Now text stored in item itself.
This commit is contained in:
VladimirMangos 2010-04-09 01:50:18 +04:00
parent 53486545b5
commit 24f2d03485
17 changed files with 85 additions and 152 deletions

View file

@ -297,21 +297,26 @@ void Item::SaveToDB()
{
case ITEM_NEW:
{
std::string text = m_text;
CharacterDatabase.escape_string(text);
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 << "INSERT 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() );
@ -320,8 +325,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());