UpdateLiveChar converted to QueryDatabase

This commit is contained in:
Arthur Ice authored and Arthur Ice committed 2014-07-08 21:09:56 -07:00
1 parent f7c637a0d9
commit b169dbd09d
1 file changed
+8 -5
+8 -5
View File
@@ -1700,15 +1700,18 @@ uint32 Database::GetCharacterInfo(const char* iName, uint32* oAccID, uint32* oZo
}
bool Database::UpdateLiveChar(char* charname,uint32 lsaccount_id) {
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
if (!RunQuery(query, MakeAnyLenString(&query, "UPDATE account SET charname='%s' WHERE id=%i;",charname, lsaccount_id), errbuf)) {
std::cerr << "Error in UpdateLiveChar query '" << query << "' " << errbuf << std::endl;
char *query = nullptr;
auto results = QueryDatabase(query, MakeAnyLenString(&query, "UPDATE account SET charname='%s' WHERE id=%i;",charname, lsaccount_id));
if (!results.Success())
{
std::cerr << "Error in UpdateLiveChar query '" << query << "' " << results.ErrorMessage() << std::endl;
safe_delete_array(query);
return false;
}
safe_delete_array(query);
return true;
}