mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 17:51:28 +00:00
CountAAEffects converted to QueryDatabase
This commit is contained in:
parent
9867fdd4d2
commit
1c87a6069a
29
zone/AA.cpp
29
zone/AA.cpp
@ -1747,22 +1747,21 @@ uint32 ZoneDatabase::CountAAs(){
|
|||||||
return atoi(row[0]);;
|
return atoi(row[0]);;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 ZoneDatabase::CountAAEffects(){
|
uint32 ZoneDatabase::CountAAEffects() {
|
||||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
|
||||||
char *query = 0;
|
const std::string query = "SELECT count(id) FROM aa_effects";
|
||||||
MYSQL_RES *result;
|
auto results = QueryDatabase(query);
|
||||||
MYSQL_ROW row;
|
if (!results.Success()) {
|
||||||
int count=0;
|
LogFile->write(EQEMuLog::Error, "Error in ZoneDatabase::CountAALevels query '%s': %s", query.c_str(), results.ErrorMessage().c_str());
|
||||||
if (RunQuery(query, MakeAnyLenString(&query, "SELECT count(id) from aa_effects"), errbuf, &result)) {
|
return 0;
|
||||||
if((row = mysql_fetch_row(result))!=nullptr){
|
|
||||||
count = atoi(row[0]);
|
|
||||||
}
|
|
||||||
mysql_free_result(result);
|
|
||||||
} else {
|
|
||||||
LogFile->write(EQEMuLog::Error, "Error in ZoneDatabase::CountAALevels query '%s': %s", query, errbuf);
|
|
||||||
}
|
}
|
||||||
safe_delete_array(query);
|
|
||||||
return count;
|
if (results.RowCount() != 1)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
auto row = results.begin();
|
||||||
|
|
||||||
|
return atoi(row[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 ZoneDatabase::GetSizeAA(){
|
uint32 ZoneDatabase::GetSizeAA(){
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user