QueryWithLogging converted to QueryDatabase

This commit is contained in:
Arthur Ice 2014-08-17 11:22:05 -07:00
parent cca9ddab43
commit 8a44271b2f
2 changed files with 5 additions and 7 deletions

View File

@ -930,19 +930,17 @@ bool BaseGuildManager::DBSetPublicNote(uint32 charid, const char* note) {
return(true);
}
bool BaseGuildManager::QueryWithLogging(char *&query, int len, const char *errmsg) {
bool BaseGuildManager::QueryWithLogging(std::string query, int len, const char *errmsg) {
if(m_db == nullptr)
return(false);
char errbuf[MYSQL_ERRMSG_SIZE];
auto results = m_db->QueryDatabase(query);
if (!m_db->RunQuery(query, len, errbuf))
if (!results.Success())
{
_log(GUILDS__ERROR, "Error %s: '%s': %s", errmsg, query, errbuf);
safe_delete_array(query);
_log(GUILDS__ERROR, "Error %s: '%s': %s", errmsg, query.c_str(), results.ErrorMessage().c_str());
return(false);
}
safe_delete_array(query);
return(true);
}

View File

@ -108,7 +108,7 @@ protected:
bool DBSetAltFlag(uint32 charid, bool is_alt);
bool DBSetTributeFlag(uint32 charid, bool enabled);
bool DBSetPublicNote(uint32 charid, const char *note);
bool QueryWithLogging(char *&query, int len, const char *errmsg);
bool QueryWithLogging(std::string query, int len, const char *errmsg);
// void DBSetPublicNote(uint32 guild_id,char* charname, char* note);
bool LocalDeleteGuild(uint32 guild_id);