SetLocalPassword converted to StringFormat

This commit is contained in:
Arthur Ice 2014-07-08 19:30:52 -07:00 committed by Arthur Ice
parent d287d9731e
commit 74b73e6f39

View File

@ -323,17 +323,15 @@ bool Database::DeleteAccount(const char* name) {
} }
bool Database::SetLocalPassword(uint32 accid, const char* password) { bool Database::SetLocalPassword(uint32 accid, const char* password) {
char *query = nullptr; std::string query = StringFormat("UPDATE account SET password=MD5('%s') where id=%i;", password, accid);
auto results = QueryDatabase(query, MakeAnyLenString(&query, "UPDATE account SET password=MD5('%s') where id=%i;", password, accid)); auto results = QueryDatabase(query);
if (!results.Success()) { if (!results.Success()) {
std::cerr << "Error in SetLocalPassword query '" << query << "' " << results.ErrorMessage() << std::endl; std::cerr << "Error in SetLocalPassword query '" << query << "' " << results.ErrorMessage() << std::endl;
safe_delete_array(query);
return false; return false;
} }
safe_delete_array(query);
return true; return true;
} }