mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-25 22:57:15 +00:00
Split repositories out between a base immutable repository (that does not change) and an extended repository of which developers can add more custom methods to
This commit is contained in:
@@ -23,506 +23,45 @@
|
||||
|
||||
#include "../database.h"
|
||||
#include "../string_util.h"
|
||||
#include "base/base_npc_scale_global_base_repository.h"
|
||||
|
||||
class NpcScaleGlobalBaseRepository {
|
||||
class NpcScaleGlobalBaseRepository: public BaseNpcScaleGlobalBaseRepository {
|
||||
public:
|
||||
struct NpcScaleGlobalBase {
|
||||
int type;
|
||||
int level;
|
||||
int ac;
|
||||
int hp;
|
||||
int accuracy;
|
||||
int slow_mitigation;
|
||||
int attack;
|
||||
int strength;
|
||||
int stamina;
|
||||
int dexterity;
|
||||
int agility;
|
||||
int intelligence;
|
||||
int wisdom;
|
||||
int charisma;
|
||||
int magic_resist;
|
||||
int cold_resist;
|
||||
int fire_resist;
|
||||
int poison_resist;
|
||||
int disease_resist;
|
||||
int corruption_resist;
|
||||
int physical_resist;
|
||||
int min_dmg;
|
||||
int max_dmg;
|
||||
int hp_regen_rate;
|
||||
int attack_delay;
|
||||
int spell_scale;
|
||||
int heal_scale;
|
||||
std::string special_abilities;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
{
|
||||
return std::string("level");
|
||||
}
|
||||
/**
|
||||
* This file was auto generated on Apr 5, 2020 and can be modified and extended upon
|
||||
*
|
||||
* Base repository methods are automatically
|
||||
* generated in the "base" version of this repository. The base repository
|
||||
* is immutable and to be left untouched, while methods in this class
|
||||
* are used as extension methods for more specific persistence-layer
|
||||
* accessors or mutators
|
||||
*
|
||||
* Base Methods (Subject to be expanded upon in time)
|
||||
*
|
||||
* InsertOne
|
||||
* UpdateOne
|
||||
* DeleteOne
|
||||
* FindOne
|
||||
* GetWhere(std::string where_filter)
|
||||
* DeleteWhere(std::string where_filter)
|
||||
* InsertMany
|
||||
* All
|
||||
*
|
||||
* Example custom methods in a repository
|
||||
*
|
||||
* NpcScaleGlobalBaseRepository::GetByZoneAndVersion(int zone_id, int zone_version)
|
||||
* NpcScaleGlobalBaseRepository::GetWhereNeverExpires()
|
||||
* NpcScaleGlobalBaseRepository::GetWhereXAndY()
|
||||
* NpcScaleGlobalBaseRepository::DeleteWhereXAndY()
|
||||
*
|
||||
* Most of the above could be covered by base methods, but if you as a developer
|
||||
* find yourself re-using logic for other parts of the code, its best to just make a
|
||||
* method that can be re-used easily elsewhere especially if it can use a base repository
|
||||
* method and encapsulate filters there
|
||||
*/
|
||||
|
||||
static std::vector<std::string> Columns()
|
||||
{
|
||||
return {
|
||||
"type",
|
||||
"level",
|
||||
"ac",
|
||||
"hp",
|
||||
"accuracy",
|
||||
"slow_mitigation",
|
||||
"attack",
|
||||
"strength",
|
||||
"stamina",
|
||||
"dexterity",
|
||||
"agility",
|
||||
"intelligence",
|
||||
"wisdom",
|
||||
"charisma",
|
||||
"magic_resist",
|
||||
"cold_resist",
|
||||
"fire_resist",
|
||||
"poison_resist",
|
||||
"disease_resist",
|
||||
"corruption_resist",
|
||||
"physical_resist",
|
||||
"min_dmg",
|
||||
"max_dmg",
|
||||
"hp_regen_rate",
|
||||
"attack_delay",
|
||||
"spell_scale",
|
||||
"heal_scale",
|
||||
"special_abilities",
|
||||
};
|
||||
}
|
||||
|
||||
static std::string ColumnsRaw()
|
||||
{
|
||||
return std::string(implode(", ", Columns()));
|
||||
}
|
||||
|
||||
static std::string InsertColumnsRaw()
|
||||
{
|
||||
std::vector<std::string> insert_columns;
|
||||
|
||||
for (auto &column : Columns()) {
|
||||
if (column == PrimaryKey()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
insert_columns.push_back(column);
|
||||
}
|
||||
|
||||
return std::string(implode(", ", insert_columns));
|
||||
}
|
||||
|
||||
static std::string TableName()
|
||||
{
|
||||
return std::string("npc_scale_global_base");
|
||||
}
|
||||
|
||||
static std::string BaseSelect()
|
||||
{
|
||||
return fmt::format(
|
||||
"SELECT {} FROM {}",
|
||||
ColumnsRaw(),
|
||||
TableName()
|
||||
);
|
||||
}
|
||||
|
||||
static std::string BaseInsert()
|
||||
{
|
||||
return fmt::format(
|
||||
"INSERT INTO {} ({}) ",
|
||||
TableName(),
|
||||
InsertColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static NpcScaleGlobalBase NewEntity()
|
||||
{
|
||||
NpcScaleGlobalBase entry{};
|
||||
|
||||
entry.type = 0;
|
||||
entry.level = 0;
|
||||
entry.ac = 0;
|
||||
entry.hp = 0;
|
||||
entry.accuracy = 0;
|
||||
entry.slow_mitigation = 0;
|
||||
entry.attack = 0;
|
||||
entry.strength = 0;
|
||||
entry.stamina = 0;
|
||||
entry.dexterity = 0;
|
||||
entry.agility = 0;
|
||||
entry.intelligence = 0;
|
||||
entry.wisdom = 0;
|
||||
entry.charisma = 0;
|
||||
entry.magic_resist = 0;
|
||||
entry.cold_resist = 0;
|
||||
entry.fire_resist = 0;
|
||||
entry.poison_resist = 0;
|
||||
entry.disease_resist = 0;
|
||||
entry.corruption_resist = 0;
|
||||
entry.physical_resist = 0;
|
||||
entry.min_dmg = 0;
|
||||
entry.max_dmg = 0;
|
||||
entry.hp_regen_rate = 0;
|
||||
entry.attack_delay = 0;
|
||||
entry.spell_scale = 100;
|
||||
entry.heal_scale = 100;
|
||||
entry.special_abilities = "";
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
static NpcScaleGlobalBase GetNpcScaleGlobalBaseEntry(
|
||||
const std::vector<NpcScaleGlobalBase> &npc_scale_global_bases,
|
||||
int npc_scale_global_base_id
|
||||
)
|
||||
{
|
||||
for (auto &npc_scale_global_base : npc_scale_global_bases) {
|
||||
if (npc_scale_global_base.level == npc_scale_global_base_id) {
|
||||
return npc_scale_global_base;
|
||||
}
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static NpcScaleGlobalBase FindOne(
|
||||
int npc_scale_global_base_id
|
||||
)
|
||||
{
|
||||
auto results = content_db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
npc_scale_global_base_id
|
||||
)
|
||||
);
|
||||
|
||||
auto row = results.begin();
|
||||
if (results.RowCount() == 1) {
|
||||
NpcScaleGlobalBase entry{};
|
||||
|
||||
entry.type = atoi(row[0]);
|
||||
entry.level = atoi(row[1]);
|
||||
entry.ac = atoi(row[2]);
|
||||
entry.hp = atoi(row[3]);
|
||||
entry.accuracy = atoi(row[4]);
|
||||
entry.slow_mitigation = atoi(row[5]);
|
||||
entry.attack = atoi(row[6]);
|
||||
entry.strength = atoi(row[7]);
|
||||
entry.stamina = atoi(row[8]);
|
||||
entry.dexterity = atoi(row[9]);
|
||||
entry.agility = atoi(row[10]);
|
||||
entry.intelligence = atoi(row[11]);
|
||||
entry.wisdom = atoi(row[12]);
|
||||
entry.charisma = atoi(row[13]);
|
||||
entry.magic_resist = atoi(row[14]);
|
||||
entry.cold_resist = atoi(row[15]);
|
||||
entry.fire_resist = atoi(row[16]);
|
||||
entry.poison_resist = atoi(row[17]);
|
||||
entry.disease_resist = atoi(row[18]);
|
||||
entry.corruption_resist = atoi(row[19]);
|
||||
entry.physical_resist = atoi(row[20]);
|
||||
entry.min_dmg = atoi(row[21]);
|
||||
entry.max_dmg = atoi(row[22]);
|
||||
entry.hp_regen_rate = atoi(row[23]);
|
||||
entry.attack_delay = atoi(row[24]);
|
||||
entry.spell_scale = atoi(row[25]);
|
||||
entry.heal_scale = atoi(row[26]);
|
||||
entry.special_abilities = row[27] ? row[27] : "";
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static int DeleteOne(
|
||||
int npc_scale_global_base_id
|
||||
)
|
||||
{
|
||||
auto results = content_db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {} = {}",
|
||||
TableName(),
|
||||
PrimaryKey(),
|
||||
npc_scale_global_base_id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int UpdateOne(
|
||||
NpcScaleGlobalBase npc_scale_global_base_entry
|
||||
)
|
||||
{
|
||||
std::vector<std::string> update_values;
|
||||
|
||||
auto columns = Columns();
|
||||
|
||||
update_values.push_back(columns[2] + " = " + std::to_string(npc_scale_global_base_entry.ac));
|
||||
update_values.push_back(columns[3] + " = " + std::to_string(npc_scale_global_base_entry.hp));
|
||||
update_values.push_back(columns[4] + " = " + std::to_string(npc_scale_global_base_entry.accuracy));
|
||||
update_values.push_back(columns[5] + " = " + std::to_string(npc_scale_global_base_entry.slow_mitigation));
|
||||
update_values.push_back(columns[6] + " = " + std::to_string(npc_scale_global_base_entry.attack));
|
||||
update_values.push_back(columns[7] + " = " + std::to_string(npc_scale_global_base_entry.strength));
|
||||
update_values.push_back(columns[8] + " = " + std::to_string(npc_scale_global_base_entry.stamina));
|
||||
update_values.push_back(columns[9] + " = " + std::to_string(npc_scale_global_base_entry.dexterity));
|
||||
update_values.push_back(columns[10] + " = " + std::to_string(npc_scale_global_base_entry.agility));
|
||||
update_values.push_back(columns[11] + " = " + std::to_string(npc_scale_global_base_entry.intelligence));
|
||||
update_values.push_back(columns[12] + " = " + std::to_string(npc_scale_global_base_entry.wisdom));
|
||||
update_values.push_back(columns[13] + " = " + std::to_string(npc_scale_global_base_entry.charisma));
|
||||
update_values.push_back(columns[14] + " = " + std::to_string(npc_scale_global_base_entry.magic_resist));
|
||||
update_values.push_back(columns[15] + " = " + std::to_string(npc_scale_global_base_entry.cold_resist));
|
||||
update_values.push_back(columns[16] + " = " + std::to_string(npc_scale_global_base_entry.fire_resist));
|
||||
update_values.push_back(columns[17] + " = " + std::to_string(npc_scale_global_base_entry.poison_resist));
|
||||
update_values.push_back(columns[18] + " = " + std::to_string(npc_scale_global_base_entry.disease_resist));
|
||||
update_values.push_back(columns[19] + " = " + std::to_string(npc_scale_global_base_entry.corruption_resist));
|
||||
update_values.push_back(columns[20] + " = " + std::to_string(npc_scale_global_base_entry.physical_resist));
|
||||
update_values.push_back(columns[21] + " = " + std::to_string(npc_scale_global_base_entry.min_dmg));
|
||||
update_values.push_back(columns[22] + " = " + std::to_string(npc_scale_global_base_entry.max_dmg));
|
||||
update_values.push_back(columns[23] + " = " + std::to_string(npc_scale_global_base_entry.hp_regen_rate));
|
||||
update_values.push_back(columns[24] + " = " + std::to_string(npc_scale_global_base_entry.attack_delay));
|
||||
update_values.push_back(columns[25] + " = " + std::to_string(npc_scale_global_base_entry.spell_scale));
|
||||
update_values.push_back(columns[26] + " = " + std::to_string(npc_scale_global_base_entry.heal_scale));
|
||||
update_values.push_back(columns[27] + " = '" + EscapeString(npc_scale_global_base_entry.special_abilities) + "'");
|
||||
|
||||
auto results = content_db.QueryDatabase(
|
||||
fmt::format(
|
||||
"UPDATE {} SET {} WHERE {} = {}",
|
||||
TableName(),
|
||||
implode(", ", update_values),
|
||||
PrimaryKey(),
|
||||
npc_scale_global_base_entry.level
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static NpcScaleGlobalBase InsertOne(
|
||||
NpcScaleGlobalBase npc_scale_global_base_entry
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
insert_values.push_back(std::to_string(npc_scale_global_base_entry.ac));
|
||||
insert_values.push_back(std::to_string(npc_scale_global_base_entry.hp));
|
||||
insert_values.push_back(std::to_string(npc_scale_global_base_entry.accuracy));
|
||||
insert_values.push_back(std::to_string(npc_scale_global_base_entry.slow_mitigation));
|
||||
insert_values.push_back(std::to_string(npc_scale_global_base_entry.attack));
|
||||
insert_values.push_back(std::to_string(npc_scale_global_base_entry.strength));
|
||||
insert_values.push_back(std::to_string(npc_scale_global_base_entry.stamina));
|
||||
insert_values.push_back(std::to_string(npc_scale_global_base_entry.dexterity));
|
||||
insert_values.push_back(std::to_string(npc_scale_global_base_entry.agility));
|
||||
insert_values.push_back(std::to_string(npc_scale_global_base_entry.intelligence));
|
||||
insert_values.push_back(std::to_string(npc_scale_global_base_entry.wisdom));
|
||||
insert_values.push_back(std::to_string(npc_scale_global_base_entry.charisma));
|
||||
insert_values.push_back(std::to_string(npc_scale_global_base_entry.magic_resist));
|
||||
insert_values.push_back(std::to_string(npc_scale_global_base_entry.cold_resist));
|
||||
insert_values.push_back(std::to_string(npc_scale_global_base_entry.fire_resist));
|
||||
insert_values.push_back(std::to_string(npc_scale_global_base_entry.poison_resist));
|
||||
insert_values.push_back(std::to_string(npc_scale_global_base_entry.disease_resist));
|
||||
insert_values.push_back(std::to_string(npc_scale_global_base_entry.corruption_resist));
|
||||
insert_values.push_back(std::to_string(npc_scale_global_base_entry.physical_resist));
|
||||
insert_values.push_back(std::to_string(npc_scale_global_base_entry.min_dmg));
|
||||
insert_values.push_back(std::to_string(npc_scale_global_base_entry.max_dmg));
|
||||
insert_values.push_back(std::to_string(npc_scale_global_base_entry.hp_regen_rate));
|
||||
insert_values.push_back(std::to_string(npc_scale_global_base_entry.attack_delay));
|
||||
insert_values.push_back(std::to_string(npc_scale_global_base_entry.spell_scale));
|
||||
insert_values.push_back(std::to_string(npc_scale_global_base_entry.heal_scale));
|
||||
insert_values.push_back("'" + EscapeString(npc_scale_global_base_entry.special_abilities) + "'");
|
||||
|
||||
auto results = content_db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES ({})",
|
||||
BaseInsert(),
|
||||
implode(",", insert_values)
|
||||
)
|
||||
);
|
||||
|
||||
if (results.Success()) {
|
||||
npc_scale_global_base_entry.id = results.LastInsertedID();
|
||||
return npc_scale_global_base_entry;
|
||||
}
|
||||
|
||||
npc_scale_global_base_entry = NpcScaleGlobalBaseRepository::NewEntity();
|
||||
|
||||
return npc_scale_global_base_entry;
|
||||
}
|
||||
|
||||
static int InsertMany(
|
||||
std::vector<NpcScaleGlobalBase> npc_scale_global_base_entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &npc_scale_global_base_entry: npc_scale_global_base_entries) {
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
insert_values.push_back(std::to_string(npc_scale_global_base_entry.ac));
|
||||
insert_values.push_back(std::to_string(npc_scale_global_base_entry.hp));
|
||||
insert_values.push_back(std::to_string(npc_scale_global_base_entry.accuracy));
|
||||
insert_values.push_back(std::to_string(npc_scale_global_base_entry.slow_mitigation));
|
||||
insert_values.push_back(std::to_string(npc_scale_global_base_entry.attack));
|
||||
insert_values.push_back(std::to_string(npc_scale_global_base_entry.strength));
|
||||
insert_values.push_back(std::to_string(npc_scale_global_base_entry.stamina));
|
||||
insert_values.push_back(std::to_string(npc_scale_global_base_entry.dexterity));
|
||||
insert_values.push_back(std::to_string(npc_scale_global_base_entry.agility));
|
||||
insert_values.push_back(std::to_string(npc_scale_global_base_entry.intelligence));
|
||||
insert_values.push_back(std::to_string(npc_scale_global_base_entry.wisdom));
|
||||
insert_values.push_back(std::to_string(npc_scale_global_base_entry.charisma));
|
||||
insert_values.push_back(std::to_string(npc_scale_global_base_entry.magic_resist));
|
||||
insert_values.push_back(std::to_string(npc_scale_global_base_entry.cold_resist));
|
||||
insert_values.push_back(std::to_string(npc_scale_global_base_entry.fire_resist));
|
||||
insert_values.push_back(std::to_string(npc_scale_global_base_entry.poison_resist));
|
||||
insert_values.push_back(std::to_string(npc_scale_global_base_entry.disease_resist));
|
||||
insert_values.push_back(std::to_string(npc_scale_global_base_entry.corruption_resist));
|
||||
insert_values.push_back(std::to_string(npc_scale_global_base_entry.physical_resist));
|
||||
insert_values.push_back(std::to_string(npc_scale_global_base_entry.min_dmg));
|
||||
insert_values.push_back(std::to_string(npc_scale_global_base_entry.max_dmg));
|
||||
insert_values.push_back(std::to_string(npc_scale_global_base_entry.hp_regen_rate));
|
||||
insert_values.push_back(std::to_string(npc_scale_global_base_entry.attack_delay));
|
||||
insert_values.push_back(std::to_string(npc_scale_global_base_entry.spell_scale));
|
||||
insert_values.push_back(std::to_string(npc_scale_global_base_entry.heal_scale));
|
||||
insert_values.push_back("'" + EscapeString(npc_scale_global_base_entry.special_abilities) + "'");
|
||||
|
||||
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
|
||||
}
|
||||
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
auto results = content_db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES {}",
|
||||
BaseInsert(),
|
||||
implode(",", insert_chunks)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static std::vector<NpcScaleGlobalBase> All()
|
||||
{
|
||||
std::vector<NpcScaleGlobalBase> all_entries;
|
||||
|
||||
auto results = content_db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{}",
|
||||
BaseSelect()
|
||||
)
|
||||
);
|
||||
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
NpcScaleGlobalBase entry{};
|
||||
|
||||
entry.type = atoi(row[0]);
|
||||
entry.level = atoi(row[1]);
|
||||
entry.ac = atoi(row[2]);
|
||||
entry.hp = atoi(row[3]);
|
||||
entry.accuracy = atoi(row[4]);
|
||||
entry.slow_mitigation = atoi(row[5]);
|
||||
entry.attack = atoi(row[6]);
|
||||
entry.strength = atoi(row[7]);
|
||||
entry.stamina = atoi(row[8]);
|
||||
entry.dexterity = atoi(row[9]);
|
||||
entry.agility = atoi(row[10]);
|
||||
entry.intelligence = atoi(row[11]);
|
||||
entry.wisdom = atoi(row[12]);
|
||||
entry.charisma = atoi(row[13]);
|
||||
entry.magic_resist = atoi(row[14]);
|
||||
entry.cold_resist = atoi(row[15]);
|
||||
entry.fire_resist = atoi(row[16]);
|
||||
entry.poison_resist = atoi(row[17]);
|
||||
entry.disease_resist = atoi(row[18]);
|
||||
entry.corruption_resist = atoi(row[19]);
|
||||
entry.physical_resist = atoi(row[20]);
|
||||
entry.min_dmg = atoi(row[21]);
|
||||
entry.max_dmg = atoi(row[22]);
|
||||
entry.hp_regen_rate = atoi(row[23]);
|
||||
entry.attack_delay = atoi(row[24]);
|
||||
entry.spell_scale = atoi(row[25]);
|
||||
entry.heal_scale = atoi(row[26]);
|
||||
entry.special_abilities = row[27] ? row[27] : "";
|
||||
|
||||
all_entries.push_back(entry);
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static std::vector<NpcScaleGlobalBase> GetWhere(std::string where_filter)
|
||||
{
|
||||
std::vector<NpcScaleGlobalBase> 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) {
|
||||
NpcScaleGlobalBase entry{};
|
||||
|
||||
entry.type = atoi(row[0]);
|
||||
entry.level = atoi(row[1]);
|
||||
entry.ac = atoi(row[2]);
|
||||
entry.hp = atoi(row[3]);
|
||||
entry.accuracy = atoi(row[4]);
|
||||
entry.slow_mitigation = atoi(row[5]);
|
||||
entry.attack = atoi(row[6]);
|
||||
entry.strength = atoi(row[7]);
|
||||
entry.stamina = atoi(row[8]);
|
||||
entry.dexterity = atoi(row[9]);
|
||||
entry.agility = atoi(row[10]);
|
||||
entry.intelligence = atoi(row[11]);
|
||||
entry.wisdom = atoi(row[12]);
|
||||
entry.charisma = atoi(row[13]);
|
||||
entry.magic_resist = atoi(row[14]);
|
||||
entry.cold_resist = atoi(row[15]);
|
||||
entry.fire_resist = atoi(row[16]);
|
||||
entry.poison_resist = atoi(row[17]);
|
||||
entry.disease_resist = atoi(row[18]);
|
||||
entry.corruption_resist = atoi(row[19]);
|
||||
entry.physical_resist = atoi(row[20]);
|
||||
entry.min_dmg = atoi(row[21]);
|
||||
entry.max_dmg = atoi(row[22]);
|
||||
entry.hp_regen_rate = atoi(row[23]);
|
||||
entry.attack_delay = atoi(row[24]);
|
||||
entry.spell_scale = atoi(row[25]);
|
||||
entry.heal_scale = atoi(row[26]);
|
||||
entry.special_abilities = row[27] ? row[27] : "";
|
||||
|
||||
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);
|
||||
}
|
||||
// Custom extended repository methods here
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user