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:
1 parent
b46b498141
commit
3c6dc32030
47 files changed
+1003
-875
No files matched your search
@@ -600,7 +600,8 @@ void WorldSession::LoadAccountData(PreparedQueryResult result, uint32 mask)
|
||||
|
||||
do
|
||||
{
|
||||
uint32 type = result->GetUInt32(0);
|
||||
Field* fields = result->Fetch();
|
||||
uint32 type = fields[0].GetUInt32();
|
||||
if (type >= NUM_ACCOUNT_DATA_TYPES)
|
||||
{
|
||||
sLog.outError("Table `%s` have invalid account data type (%u), ignore.",
|
||||
@@ -615,10 +616,11 @@ void WorldSession::LoadAccountData(PreparedQueryResult result, uint32 mask)
|
||||
continue;
|
||||
}
|
||||
|
||||
m_accountData[type].Time = result->GetUInt32(1);
|
||||
m_accountData[type].Data = result->GetString(2);
|
||||
m_accountData[type].Time = fields[1].GetUInt32();
|
||||
m_accountData[type].Data = fields[2].GetString();
|
||||
|
||||
} while (result->NextRow());
|
||||
}
|
||||
while (result->NextRow());
|
||||
}
|
||||
|
||||
void WorldSession::SetAccountData(AccountDataType type, time_t time_, std::string data)
|
||||
|
||||
Reference in new issue
Block a user