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
@@ -72,8 +72,8 @@ void TicketMgr::LoadGMTickets()
ticket = new GM_Ticket;
ticket->guid = fields[0].GetUInt64();
ticket->playerGuid = fields[1].GetUInt64();
ticket->name = fields[2].GetCppString();
ticket->message = fields[3].GetCppString();
ticket->name = fields[2].GetString();
ticket->message = fields[3].GetString();
ticket->createtime = fields[4].GetUInt64();
ticket->map = fields[5].GetUInt32();
ticket->pos_x = fields[6].GetFloat();
@@ -85,7 +85,7 @@ void TicketMgr::LoadGMTickets()
m_openTickets++;
ticket->assignedToGM = fields[11].GetUInt64();
ticket->comment = fields[12].GetCppString();
ticket->comment = fields[12].GetString();
ticket->completed = fields[13].GetBool();
ticket->escalated = fields[14].GetUInt8();
ticket->viewed = fields[15].GetBool();