Core/DBLayer:

- Rewrite Field class to be able to store both binary prepared statement data and data from adhoc query resultsets
- Buffer the data of prepared statements using ResultSet and Field classes and let go of mysql c api structures after PreparedResultSet constructor. Fixes a race condition and thus a possible crash/data corruption (issue pointed out to Derex, basic suggestion by raczman)
- Conform PreparedResultSet and ResultSet to the same design standards, and using Field class as data buffer class for both
* NOTE: This means the fetching methods are uniform again, using ¨Field* fields = result->Fetch();¨ and access to elements trough fields[x].
* NOTE: for access to the correct row in prepared statements, ¨Field* fields = result->Fetch();¨ must ALWAYS be called inside the do { }while(result->NextRow()) loop.
* NOTE: This means that Field::GetString() returns std::string object and Field::GetCString() returns const char* pointer.

Still experimental and all that jazz, not recommended for production servers until feedback is given.

--HG--
branch : trunk
This commit is contained in:
Machiavelli
2010-09-24 22:16:21 +02:00
parent b46b498141
commit 3c6dc32030
47 changed files with 1003 additions and 875 deletions
+3 -3
View File
@@ -128,7 +128,7 @@ bool ArenaTeam::AddMember(const uint64& PlayerGuid)
if (!result)
return false;
plName = (*result)[0].GetCppString();
plName = (*result)[0].GetString();
plClass = (*result)[1].GetUInt8();
// check if player already in arenateam of that size
@@ -186,7 +186,7 @@ bool ArenaTeam::LoadArenaTeamFromDB(QueryResult arenaTeamDataResult)
Field *fields = arenaTeamDataResult->Fetch();
m_TeamId = fields[0].GetUInt32();
m_Name = fields[1].GetCppString();
m_Name = fields[1].GetString();
m_CaptainGuid = MAKE_NEW_GUID(fields[2].GetUInt32(), 0, HIGHGUID_PLAYER);
m_Type = fields[3].GetUInt32();
m_BackgroundColor = fields[4].GetUInt32();
@@ -251,7 +251,7 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult arenaTeamMembersResult)
newmember.wins_week = fields[3].GetUInt32();
newmember.games_season = fields[4].GetUInt32();
newmember.wins_season = fields[5].GetUInt32();
newmember.name = fields[6].GetCppString();
newmember.name = fields[6].GetString();
newmember.Class = fields[7].GetUInt8();
newmember.personal_rating = personalrating;
newmember.matchmaker_rating = matchmakerrating;
@@ -774,7 +774,7 @@ void BattlegroundMgr::CreateInitialBattlegrounds()
}
selectionWeight = fields[9].GetUInt8();
scriptId = sObjectMgr.GetScriptId(fields[10].GetString());
scriptId = sObjectMgr.GetScriptId(fields[10].GetCString());
//sLog.outDetail("Creating battleground %s, %u-%u", bl->name[sWorld.GetDBClang()], MinLvl, MaxLvl);
if (!CreateBattleground(bgTypeID, IsArena, MinPlayersPerTeam, MaxPlayersPerTeam, MinLvl, MaxLvl, bl->name[sWorld.GetDefaultDbcLocale()], bl->mapid[0], AStartLoc[0], AStartLoc[1], AStartLoc[2], AStartLoc[3], HStartLoc[0], HStartLoc[1], HStartLoc[2], HStartLoc[3], scriptId))
continue;