mirror of
https://github.com/EQEmu/Server.git
synced 2026-03-01 17:32:25 +00:00
GetCharacterLevel converted to QueryDatabase
This commit is contained in:
parent
0b352ff0f7
commit
2d8e9bf058
@ -449,28 +449,20 @@ void WorldDatabase::SetMailKey(int CharID, int IPAddress, int MailKey) {
|
|||||||
|
|
||||||
bool WorldDatabase::GetCharacterLevel(const char *name, int &level)
|
bool WorldDatabase::GetCharacterLevel(const char *name, int &level)
|
||||||
{
|
{
|
||||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
std::string query = StringFormat("SELECT level FROM character_data WHERE name = '%s'", name);
|
||||||
char* query = 0;
|
auto results = QueryDatabase(query);
|
||||||
MYSQL_RES *result;
|
if (!results.Success()) {
|
||||||
MYSQL_ROW row;
|
LogFile->write(EQEMuLog::Error, "WorldDatabase::GetCharacterLevel: %s", results.ErrorMessage().c_str());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if(RunQuery(query, MakeAnyLenString(&query, "SELECT `level` FROM `character_data` WHERE `name` = '%s'", name), errbuf, &result))
|
if (results.RowCount() == 0)
|
||||||
{
|
return false;
|
||||||
if(row = mysql_fetch_row(result))
|
|
||||||
{
|
auto row = results.begin();
|
||||||
level = atoi(row[0]);
|
level = atoi(row[0]);
|
||||||
mysql_free_result(result);
|
|
||||||
safe_delete_array(query);
|
return true;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
mysql_free_result(result);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
LogFile->write(EQEMuLog::Error, "WorldDatabase::GetCharacterLevel: %s", errbuf);
|
|
||||||
}
|
|
||||||
safe_delete_array(query);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WorldDatabase::LoadCharacterCreateAllocations() {
|
bool WorldDatabase::LoadCharacterCreateAllocations() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user