mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-27 20:47:15 +00:00
Add GetWhere and DeleteWhere repository methods
This commit is contained in:
@@ -250,7 +250,7 @@ public:
|
||||
return auras_entry;
|
||||
}
|
||||
|
||||
auras_entry = InstanceListRepository::NewEntity();
|
||||
auras_entry = AurasRepository::NewEntity();
|
||||
|
||||
return auras_entry;
|
||||
}
|
||||
@@ -325,6 +325,55 @@ public:
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static std::vector<Auras> GetWhere(std::string where_filter)
|
||||
{
|
||||
std::vector<Auras> all_entries;
|
||||
|
||||
auto results = content_db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE {}",
|
||||
BaseSelect(),
|
||||
where_filter
|
||||
)
|
||||
);
|
||||
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
Auras entry{};
|
||||
|
||||
entry.type = atoi(row[0]);
|
||||
entry.npc_type = atoi(row[1]);
|
||||
entry.name = row[2];
|
||||
entry.spell_id = atoi(row[3]);
|
||||
entry.distance = atoi(row[4]);
|
||||
entry.aura_type = atoi(row[5]);
|
||||
entry.spawn_type = atoi(row[6]);
|
||||
entry.movement = atoi(row[7]);
|
||||
entry.duration = atoi(row[8]);
|
||||
entry.icon = atoi(row[9]);
|
||||
entry.cast_time = atoi(row[10]);
|
||||
|
||||
all_entries.push_back(entry);
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static int DeleteWhere(std::string where_filter)
|
||||
{
|
||||
auto results = content_db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {}",
|
||||
TableName(),
|
||||
PrimaryKey(),
|
||||
where_filter
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_AURAS_REPOSITORY_H
|
||||
|
||||
Reference in New Issue
Block a user