mirror of
https://github.com/EQEmu/Server.git
synced 2026-04-14 20:12:26 +00:00
GetcommandSettings converted to QueryDatabase
This commit is contained in:
parent
c12805acce
commit
5cbae2b833
@ -1239,27 +1239,20 @@ int32 SharedDatabase::DeleteStalePlayerBackups() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool SharedDatabase::GetCommandSettings(std::map<std::string,uint8> &commands) {
|
bool SharedDatabase::GetCommandSettings(std::map<std::string,uint8> &commands) {
|
||||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
|
||||||
char *query = 0;
|
const std::string query = "SELECT command, access FROM commands";
|
||||||
MYSQL_RES *result;
|
auto results = QueryDatabase(query);
|
||||||
MYSQL_ROW row;
|
if (!results.Success()) {
|
||||||
query = new char[256];
|
std::cerr << "Error in GetCommands query '" << query << "' " << results.ErrorMessage() << std::endl;
|
||||||
strcpy(query, "SELECT command,access from commands");
|
|
||||||
commands.clear();
|
|
||||||
if (RunQuery(query, strlen(query), errbuf, &result)) {
|
|
||||||
safe_delete_array(query);
|
|
||||||
while((row = mysql_fetch_row(result))) {
|
|
||||||
commands[row[0]]=atoi(row[1]);
|
|
||||||
}
|
|
||||||
mysql_free_result(result);
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
std::cerr << "Error in GetCommands query '" << query << "' " << errbuf << std::endl;
|
|
||||||
safe_delete_array(query);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
commands.clear();
|
||||||
|
|
||||||
|
for (auto row = results.begin(); row != results.end(); ++row)
|
||||||
|
commands[row[0]]=atoi(row[1]);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SharedDatabase::LoadSkillCaps() {
|
bool SharedDatabase::LoadSkillCaps() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user