mirror of
https://github.com/EQEmu/Server.git
synced 2026-01-08 19:43:53 +00:00
GetBotInspectMessage converted to QueryDatabase
This commit is contained in:
parent
74b8f38030
commit
64641a3390
@ -1918,25 +1918,19 @@ void SharedDatabase::SaveCharacterInspectMessage(uint32 character_id, const Insp
|
||||
|
||||
void SharedDatabase::GetBotInspectMessage(uint32 botid, InspectMessage_Struct* message) {
|
||||
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
char *query = 0;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
|
||||
if (RunQuery(query, MakeAnyLenString(&query, "SELECT BotInspectMessage FROM bots WHERE BotID=%i", botid), errbuf, &result)) {
|
||||
safe_delete_array(query);
|
||||
|
||||
if (mysql_num_rows(result) == 1) {
|
||||
row = mysql_fetch_row(result);
|
||||
memcpy(message, row[0], sizeof(InspectMessage_Struct));
|
||||
}
|
||||
|
||||
mysql_free_result(result);
|
||||
}
|
||||
else {
|
||||
std::cerr << "Error in GetBotInspectMessage query '" << query << "' " << errbuf << std::endl;
|
||||
safe_delete_array(query);
|
||||
std::string query = StringFormat("SELECT BotInspectMessage FROM bots WHERE BotID = %i", botid);
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
std::cerr << "Error in GetBotInspectMessage query '" << query << "' " << results.ErrorMessage() << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
if (results.RowCount() != 1)
|
||||
return;
|
||||
|
||||
auto row = results.begin();
|
||||
memcpy(message, row[0], sizeof(InspectMessage_Struct));
|
||||
|
||||
}
|
||||
|
||||
void SharedDatabase::SetBotInspectMessage(uint32 botid, const InspectMessage_Struct* message) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user