mirror of
https://github.com/EQEmu/Server.git
synced 2026-02-28 04:02:25 +00:00
GetBotGroupListByBotOwnerCharacterId converted to QueryDatabase
This commit is contained in:
parent
38d04931ba
commit
26569ac51d
47
zone/bot.cpp
47
zone/bot.cpp
@ -4773,41 +4773,28 @@ std::list<BotGroup> Bot::LoadBotGroup(std::string botGroupName, std::string* err
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::list<BotGroupList> Bot::GetBotGroupListByBotOwnerCharacterId(uint32 botOwnerCharacterId, std::string* errorMessage) {
|
std::list<BotGroupList> Bot::GetBotGroupListByBotOwnerCharacterId(uint32 botOwnerCharacterId, std::string* errorMessage) {
|
||||||
std::list<BotGroupList> result;
|
std::list<BotGroupList> botGroups;
|
||||||
|
|
||||||
if(botOwnerCharacterId > 0) {
|
if(botOwnerCharacterId == 0)
|
||||||
char ErrBuf[MYSQL_ERRMSG_SIZE];
|
return botGroups;
|
||||||
char* Query = 0;
|
|
||||||
MYSQL_RES* DatasetResult;
|
|
||||||
MYSQL_ROW DataRow;
|
|
||||||
|
|
||||||
if(!database.RunQuery(Query, MakeAnyLenString(&Query, "select BotGroupName, BotGroupLeaderName from vwBotGroups where BotOwnerCharacterId = %u", botOwnerCharacterId), ErrBuf, &DatasetResult)) {
|
std::string query = StringFormat("SELECT BotGroupName, BotGroupLeaderName FROM vwBotGroups "
|
||||||
*errorMessage = std::string(ErrBuf);
|
"WHERE BotOwnerCharacterId = %u", botOwnerCharacterId);
|
||||||
}
|
auto results = database.QueryDatabase(query);
|
||||||
else {
|
if(!results.Success()) {
|
||||||
uint32 RowCount = mysql_num_rows(DatasetResult);
|
*errorMessage = std::string(results.ErrorMessage());
|
||||||
|
return botGroups;
|
||||||
|
}
|
||||||
|
|
||||||
if(RowCount > 0) {
|
for(auto row = results.begin(); row != results.end(); ++row) {
|
||||||
for(int iCounter = 0; iCounter < RowCount; iCounter++) {
|
BotGroupList botGroupList;
|
||||||
DataRow = mysql_fetch_row(DatasetResult);
|
botGroupList.BotGroupName = std::string(row[0]);
|
||||||
|
botGroupList.BotGroupLeaderName = std::string(row[1]);
|
||||||
|
|
||||||
if(DataRow) {
|
botGroups.push_back(botGroupList);
|
||||||
BotGroupList botGroupList;
|
}
|
||||||
botGroupList.BotGroupName = std::string(DataRow[0]);
|
|
||||||
botGroupList.BotGroupLeaderName = std::string(DataRow[1]);
|
|
||||||
|
|
||||||
result.push_back(botGroupList);
|
return botGroups;
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mysql_free_result(DatasetResult);
|
|
||||||
}
|
|
||||||
|
|
||||||
safe_delete_array(Query);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Bot::DoesBotGroupNameExist(std::string botGroupName) {
|
bool Bot::DoesBotGroupNameExist(std::string botGroupName) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user