mirror of
https://github.com/EQEmu/Server.git
synced 2026-03-25 12:42:25 +00:00
LoadByGlobalContext converted to QueryDatabase
This commit is contained in:
parent
810553de2a
commit
8d909ea8e2
@ -177,19 +177,12 @@ void QGlobalCache::LoadByZoneID(uint32 zoneID)
|
|||||||
|
|
||||||
void QGlobalCache::LoadByGlobalContext()
|
void QGlobalCache::LoadByGlobalContext()
|
||||||
{
|
{
|
||||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
std::string query = "SELECT name, charid, npcid, zoneid, value, expdate "
|
||||||
char *query = 0;
|
"FROM quest_globals WHERE zoneid = 0 && npcid = 0 && charid = 0";
|
||||||
MYSQL_RES *result;
|
auto results = database.QueryDatabase(query);
|
||||||
MYSQL_ROW row;
|
if (!results.Success())
|
||||||
|
return;
|
||||||
|
|
||||||
if (database.RunQuery(query, MakeAnyLenString(&query, "select name, charid, npcid, zoneid, value, expdate from quest_globals"
|
for (auto row = results.begin(); row != results.end(); ++row)
|
||||||
" where zoneid = 0 && npcid = 0 && charid = 0"), errbuf, &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));
|
||||||
{
|
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user