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:
@@ -54,9 +54,9 @@ void MapManager::LoadTransports()
|
||||
Field *fields = result->Fetch();
|
||||
uint32 lowguid = fields[0].GetUInt32();
|
||||
uint32 entry = fields[1].GetUInt32();
|
||||
std::string name = fields[2].GetCppString();
|
||||
std::string name = fields[2].GetString();
|
||||
uint32 period = fields[3].GetUInt32();
|
||||
uint32 scriptId = sObjectMgr.GetScriptId(fields[4].GetString());
|
||||
uint32 scriptId = sObjectMgr.GetScriptId(fields[4].GetCString());
|
||||
|
||||
Transport *t = new Transport(period, scriptId);
|
||||
|
||||
@@ -133,7 +133,7 @@ void MapManager::LoadTransports()
|
||||
|
||||
uint32 guid = fields[0].GetUInt32();
|
||||
uint32 entry = fields[1].GetUInt32();
|
||||
std::string name = fields[2].GetCppString();
|
||||
std::string name = fields[2].GetString();
|
||||
sLog.outErrorDb("Transport %u '%s' have record (GUID: %u) in `gameobject`. Transports DON'T must have any records in `gameobject` or its behavior will be unpredictable/bugged.",entry,name.c_str(),guid);
|
||||
}
|
||||
while (result->NextRow());
|
||||
|
||||
Reference in New Issue
Block a user