mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-20 09:11:30 +00:00
GetRulesetName converted to QueryDatabase
This commit is contained in:
parent
a75b53f9b0
commit
b439881f37
@ -364,28 +364,21 @@ int RuleManager::_FindOrCreateRuleset(Database *db, const char *ruleset) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string RuleManager::GetRulesetName(Database *db, int id) {
|
std::string RuleManager::GetRulesetName(Database *db, int id) {
|
||||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
|
||||||
char *query = 0;
|
|
||||||
MYSQL_RES *result;
|
|
||||||
MYSQL_ROW row;
|
|
||||||
|
|
||||||
std::string res;
|
std::string query = StringFormat("SELECT name FROM rule_sets WHERE ruleset_id=%d", id);
|
||||||
|
auto results = db->QueryDatabase(query);
|
||||||
if (db->RunQuery(query, MakeAnyLenString(&query,
|
if (!results.Success())
|
||||||
"SELECT name"
|
|
||||||
" FROM rule_sets"
|
|
||||||
" WHERE ruleset_id=%d", id), errbuf, &result))
|
|
||||||
{
|
{
|
||||||
if((row = mysql_fetch_row(result))) {
|
LogFile->write(EQEMuLog::Error, "Error in LoadRules query %s: %s", query.c_str(), results.ErrorMessage().c_str());
|
||||||
res = row[0];
|
return "";
|
||||||
}
|
|
||||||
mysql_free_result(result);
|
|
||||||
} else {
|
|
||||||
LogFile->write(EQEMuLog::Error, "Error in LoadRules query %s: %s", query, errbuf);
|
|
||||||
}
|
}
|
||||||
safe_delete_array(query);
|
|
||||||
|
|
||||||
return(res);
|
if (results.RowCount() == 0)
|
||||||
|
return "";
|
||||||
|
|
||||||
|
auto row = results.begin();
|
||||||
|
|
||||||
|
return row[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RuleManager::ListRulesets(Database *db, std::map<int, std::string> &into) {
|
bool RuleManager::ListRulesets(Database *db, std::map<int, std::string> &into) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user