From 8de368c1456d997d61c4730f2fe12624dfcf1974 Mon Sep 17 00:00:00 2001 From: Andreas Habel Date: Wed, 5 Nov 2008 16:36:36 +0000 Subject: Fixed reusage of ostringstream. Now calling clear() before str("") to reset stream state. --- src/account-server/dalstorage.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src') diff --git a/src/account-server/dalstorage.cpp b/src/account-server/dalstorage.cpp index 4f992165..b0a02c4e 100644 --- a/src/account-server/dalstorage.cpp +++ b/src/account-server/dalstorage.cpp @@ -663,6 +663,7 @@ void DALStorage::flushSkill(const Character* const character, return; } + sql.clear(); sql.str(""); sql << "INSERT INTO " << CHAR_SKILLS_TBL_NAME << " " << "(char_id, skill_id, skill_exp) VALUES ( " @@ -1231,36 +1232,42 @@ void DALStorage::delCharacter(int charId, bool startTransaction = true) const mDb->execSql(sql.str()); // delete the skills of the character + sql.clear(); sql.str(""); sql << "DELETE FROM " << CHAR_SKILLS_TBL_NAME << " WHERE char_id = '" << charId << "';"; mDb->execSql(sql.str()); // delete from the quests table + sql.clear(); sql.str(""); sql << "DELETE FROM " << QUESTS_TBL_NAME << " WHERE owner_id = '" << charId << "';"; mDb->execSql(sql.str()); // delete from the guilds table + sql.clear(); sql.str(""); sql << "DELETE FROM " << GUILD_MEMBERS_TBL_NAME << " WHERE member_id = '" << charId << "';"; mDb->execSql(sql.str()); // delete auctions of the character + sql.clear(); sql.str(""); sql << "DELETE FROM " << AUCTION_TBL_NAME << " WHERE char_id = '" << charId << "';"; mDb->execSql(sql.str()); // delete bids made on auctions made by the character + sql.clear(); sql.str(""); sql << "DELETE FROM " << AUCTION_BIDS_TBL_NAME << " WHERE char_id = '" << charId << "';"; mDb->execSql(sql.str()); // now delete the character itself. + sql.clear(); sql.str(""); sql << "DELETE FROM " << CHARACTERS_TBL_NAME << " WHERE id = '" << charId << "';"; @@ -1434,6 +1441,7 @@ void DALStorage::deletePost(Letter* letter) mDb->execSql(sql.str()); // delete the letter itself + sql.clear(); sql.str(""); sql << "DELETE FROM " << POST_TBL_NAME << " WHERE letter_id = " << letter->getId(); @@ -1535,6 +1543,7 @@ void DALStorage::SyncDatabase(void) mDb->execSql(sql.str()); if (mDb->getModifiedRows() == 0) { + sql.clear(); sql.str(""); sql << "INSERT INTO " << ITEMS_TBL_NAME << " VALUES ( " << id << ", '" << name << "', '" -- cgit v1.2.3-60-g2f50