mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-16 05:11:29 +00:00
LoadByCharID converted to QueryDatabase
This commit is contained in:
parent
5234eb6fc8
commit
c6b2b1da4e
@ -152,21 +152,15 @@ void QGlobalCache::LoadByNPCID(uint32 npcID)
|
|||||||
|
|
||||||
void QGlobalCache::LoadByCharID(uint32 charID)
|
void QGlobalCache::LoadByCharID(uint32 charID)
|
||||||
{
|
{
|
||||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
std::string query = StringFormat("SELECT name, charid, npcid, zoneid, value, expdate "
|
||||||
char *query = 0;
|
"FROM quest_globals WHERE charid = %d && npcid = 0", charID);
|
||||||
MYSQL_RES *result;
|
auto results = database.QueryDatabase(query);
|
||||||
MYSQL_ROW row;
|
if (!results.Success())
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (auto row = results.begin(); row != results.end(); ++row)
|
||||||
|
AddGlobal(0, QGlobal(std::string(row[0]), atoi(row[1]), atoi(row[2]), atoi(row[3]), row[4], row[5]? atoi(row[5]): 0xFFFFFFFF));
|
||||||
|
|
||||||
if (database.RunQuery(query, MakeAnyLenString(&query, "select name, charid, npcid, zoneid, value, expdate from"
|
|
||||||
" quest_globals where charid = %d && npcid = 0", charID), errbuf, &result))
|
|
||||||
{
|
|
||||||
while((row = mysql_fetch_row(result)))
|
|
||||||
{
|
|
||||||
AddGlobal(0, QGlobal(std::string(row[0]), atoi(row[1]), atoi(row[2]), atoi(row[3]), row[4], row[5]?atoi(row[5]):0xFFFFFFFF));
|
|
||||||
}
|
|
||||||
mysql_free_result(result);
|
|
||||||
}
|
|
||||||
safe_delete_array(query);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QGlobalCache::LoadByZoneID(uint32 zoneID)
|
void QGlobalCache::LoadByZoneID(uint32 zoneID)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user