mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 13:41:31 +00:00
GetHighestGrid converted to QueryDatabase
This commit is contained in:
parent
891952eb79
commit
f5e49441b6
@ -1007,26 +1007,19 @@ void Mob::SendToFixZ(float new_x, float new_y, float new_z) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int ZoneDatabase::GetHighestGrid(uint32 zoneid) {
|
int ZoneDatabase::GetHighestGrid(uint32 zoneid) {
|
||||||
char *query = 0;
|
|
||||||
char errbuff[MYSQL_ERRMSG_SIZE];
|
std::string query = StringFormat("SELECT COALESCE(MAX(id), 0) FROM grid WHERE zoneid = %i", zoneid);
|
||||||
MYSQL_RES *result;
|
auto results = QueryDatabase(query);
|
||||||
MYSQL_ROW row;
|
if (!results.Success()) {
|
||||||
int res = 0;
|
LogFile->write(EQEMuLog::Error, "Error in GetHighestGrid query '%s': %s", query.c_str(), results.ErrorMessage().c_str());
|
||||||
if (RunQuery(query, MakeAnyLenString(&query,
|
return 0;
|
||||||
"SELECT COALESCE(MAX(id), 0) FROM grid WHERE zoneid = %i",
|
|
||||||
zoneid),errbuff,&result)) {
|
|
||||||
safe_delete_array(query);
|
|
||||||
if (mysql_num_rows(result) == 1) {
|
|
||||||
row = mysql_fetch_row(result);
|
|
||||||
res = atoi( row[0] );
|
|
||||||
}
|
|
||||||
mysql_free_result(result);
|
|
||||||
} else {
|
|
||||||
LogFile->write(EQEMuLog::Error, "Error in GetHighestGrid query '%s': %s", query, errbuff);
|
|
||||||
safe_delete_array(query);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return(res);
|
if (results.RowCount() != 1)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
auto row = results.begin();
|
||||||
|
return atoi(row[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8 ZoneDatabase::GetGridType2(uint32 grid, uint16 zoneid) {
|
uint8 ZoneDatabase::GetGridType2(uint32 grid, uint16 zoneid) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user