mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-15 20:51:29 +00:00
CheckTitle converted to QueryDatabase
This commit is contained in:
parent
fd08e9f2ad
commit
b7c409e11b
@ -351,27 +351,21 @@ void Client::EnableTitle(int titleSet) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Client::CheckTitle(int titleset) {
|
bool Client::CheckTitle(int titleSet) {
|
||||||
|
|
||||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
std::string query = StringFormat("SELECT `id` FROM player_titlesets "
|
||||||
char *query = 0;
|
"WHERE `title_set`=%i AND `char_id`=%i LIMIT 1",
|
||||||
MYSQL_RES *result;
|
titleSet, CharacterID());
|
||||||
|
auto results = database.QueryDatabase(query);
|
||||||
if (database.RunQuery(query, MakeAnyLenString(&query, "SELECT `id` FROM player_titlesets WHERE `title_set`=%i AND `char_id`=%i LIMIT 1", titleset, CharacterID()), errbuf, &result)) {
|
if (!results.Success()) {
|
||||||
safe_delete_array(query);
|
LogFile->write(EQEMuLog::Error, "Error in CheckTitle query '%s': %s", query.c_str(), results.ErrorMessage().c_str());
|
||||||
if (mysql_num_rows(result) >= 1) {
|
return false;
|
||||||
mysql_free_result(result);
|
|
||||||
return(true);
|
|
||||||
}
|
|
||||||
mysql_free_result(result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
if (results.RowCount() == 0)
|
||||||
LogFile->write(EQEMuLog::Error, "Error in CheckTitle query '%s': %s", query, errbuf);
|
return false;
|
||||||
safe_delete_array(query);
|
|
||||||
}
|
|
||||||
|
|
||||||
return(false);
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::RemoveTitle(int titleset) {
|
void Client::RemoveTitle(int titleset) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user