mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-20 21:41:29 +00:00
GetPetSaveId converted to QueryDatabase
This commit is contained in:
parent
87f1f78b67
commit
93aa690a6d
30
zone/bot.cpp
30
zone/bot.cpp
@ -2547,32 +2547,18 @@ void Bot::LoadBuffs() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint32 Bot::GetPetSaveId() {
|
uint32 Bot::GetPetSaveId() {
|
||||||
uint32 Result = 0;
|
|
||||||
std::string errorMessage;
|
|
||||||
char* Query = 0;
|
|
||||||
char TempErrorMessageBuffer[MYSQL_ERRMSG_SIZE];
|
|
||||||
MYSQL_RES* DatasetResult;
|
|
||||||
MYSQL_ROW DataRow;
|
|
||||||
|
|
||||||
if(!database.RunQuery(Query, MakeAnyLenString(&Query, "select BotPetsId from botpets where BotId = %u;", GetBotID()), TempErrorMessageBuffer, &DatasetResult)) {
|
std::string query = StringFormat("SELECT BotPetsId FROM botpets WHERE BotId = %u;", GetBotID());
|
||||||
errorMessage = std::string(TempErrorMessageBuffer);
|
auto results = database.QueryDatabase(query);
|
||||||
}
|
if(!results.Success())
|
||||||
else {
|
return 0;
|
||||||
while(DataRow = mysql_fetch_row(DatasetResult)) {
|
|
||||||
Result = atoi(DataRow[0]);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
mysql_free_result(DatasetResult);
|
if (results.RowCount() == 0)
|
||||||
}
|
return 0;
|
||||||
|
|
||||||
safe_delete(Query);
|
auto row = results.begin();
|
||||||
|
|
||||||
if(!errorMessage.empty()) {
|
return atoi(row[0]);
|
||||||
// TODO: Record this error message to zone error log
|
|
||||||
}
|
|
||||||
|
|
||||||
return Result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Bot::LoadPet() {
|
void Bot::LoadPet() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user