Merge pull request #1225 from EQEmu/akkadius/repository-improvements

[Repositories] Explicitly pass database pointers to repository methods
This commit is contained in:
Chris Miles 2021-02-06 14:23:54 -06:00 committed by GitHub
commit 18e9c4dc95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
167 changed files with 2738 additions and 1938 deletions

View File

@ -156,10 +156,11 @@ public:
} }
static AaAbility FindOne( static AaAbility FindOne(
Database& db,
int aa_ability_id int aa_ability_id
) )
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -193,10 +194,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int aa_ability_id int aa_ability_id
) )
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -209,6 +211,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
AaAbility aa_ability_entry AaAbility aa_ability_entry
) )
{ {
@ -231,7 +234,7 @@ public:
update_values.push_back(columns[12] + " = " + std::to_string(aa_ability_entry.enabled)); update_values.push_back(columns[12] + " = " + std::to_string(aa_ability_entry.enabled));
update_values.push_back(columns[13] + " = " + std::to_string(aa_ability_entry.reset_on_death)); update_values.push_back(columns[13] + " = " + std::to_string(aa_ability_entry.reset_on_death));
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -245,6 +248,7 @@ public:
} }
static AaAbility InsertOne( static AaAbility InsertOne(
Database& db,
AaAbility aa_ability_entry AaAbility aa_ability_entry
) )
{ {
@ -284,6 +288,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<AaAbility> aa_ability_entries std::vector<AaAbility> aa_ability_entries
) )
{ {
@ -312,7 +317,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -323,11 +328,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<AaAbility> All() static std::vector<AaAbility> All(Database& db)
{ {
std::vector<AaAbility> all_entries; std::vector<AaAbility> all_entries;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -360,11 +365,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<AaAbility> GetWhere(std::string where_filter) static std::vector<AaAbility> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<AaAbility> all_entries; std::vector<AaAbility> all_entries;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -398,9 +403,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -411,9 +416,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -129,10 +129,11 @@ public:
} }
static AaRankEffects FindOne( static AaRankEffects FindOne(
Database& db,
int aa_rank_effects_id int aa_rank_effects_id
) )
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -157,10 +158,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int aa_rank_effects_id int aa_rank_effects_id
) )
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -173,6 +175,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
AaRankEffects aa_rank_effects_entry AaRankEffects aa_rank_effects_entry
) )
{ {
@ -186,7 +189,7 @@ public:
update_values.push_back(columns[3] + " = " + std::to_string(aa_rank_effects_entry.base1)); update_values.push_back(columns[3] + " = " + std::to_string(aa_rank_effects_entry.base1));
update_values.push_back(columns[4] + " = " + std::to_string(aa_rank_effects_entry.base2)); update_values.push_back(columns[4] + " = " + std::to_string(aa_rank_effects_entry.base2));
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -200,6 +203,7 @@ public:
} }
static AaRankEffects InsertOne( static AaRankEffects InsertOne(
Database& db,
AaRankEffects aa_rank_effects_entry AaRankEffects aa_rank_effects_entry
) )
{ {
@ -230,6 +234,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<AaRankEffects> aa_rank_effects_entries std::vector<AaRankEffects> aa_rank_effects_entries
) )
{ {
@ -249,7 +254,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -260,11 +265,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<AaRankEffects> All() static std::vector<AaRankEffects> All(Database& db)
{ {
std::vector<AaRankEffects> all_entries; std::vector<AaRankEffects> all_entries;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -288,11 +293,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<AaRankEffects> GetWhere(std::string where_filter) static std::vector<AaRankEffects> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<AaRankEffects> all_entries; std::vector<AaRankEffects> all_entries;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -317,9 +322,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -330,9 +335,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -123,10 +123,11 @@ public:
} }
static AaRankPrereqs FindOne( static AaRankPrereqs FindOne(
Database& db,
int aa_rank_prereqs_id int aa_rank_prereqs_id
) )
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -149,10 +150,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int aa_rank_prereqs_id int aa_rank_prereqs_id
) )
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -165,6 +167,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
AaRankPrereqs aa_rank_prereqs_entry AaRankPrereqs aa_rank_prereqs_entry
) )
{ {
@ -176,7 +179,7 @@ public:
update_values.push_back(columns[1] + " = " + std::to_string(aa_rank_prereqs_entry.aa_id)); update_values.push_back(columns[1] + " = " + std::to_string(aa_rank_prereqs_entry.aa_id));
update_values.push_back(columns[2] + " = " + std::to_string(aa_rank_prereqs_entry.points)); update_values.push_back(columns[2] + " = " + std::to_string(aa_rank_prereqs_entry.points));
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -190,6 +193,7 @@ public:
} }
static AaRankPrereqs InsertOne( static AaRankPrereqs InsertOne(
Database& db,
AaRankPrereqs aa_rank_prereqs_entry AaRankPrereqs aa_rank_prereqs_entry
) )
{ {
@ -218,6 +222,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<AaRankPrereqs> aa_rank_prereqs_entries std::vector<AaRankPrereqs> aa_rank_prereqs_entries
) )
{ {
@ -235,7 +240,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -246,11 +251,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<AaRankPrereqs> All() static std::vector<AaRankPrereqs> All(Database& db)
{ {
std::vector<AaRankPrereqs> all_entries; std::vector<AaRankPrereqs> all_entries;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -272,11 +277,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<AaRankPrereqs> GetWhere(std::string where_filter) static std::vector<AaRankPrereqs> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<AaRankPrereqs> all_entries; std::vector<AaRankPrereqs> all_entries;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -299,9 +304,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -312,9 +317,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -153,10 +153,11 @@ public:
} }
static AaRanks FindOne( static AaRanks FindOne(
Database& db,
int aa_ranks_id int aa_ranks_id
) )
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -189,10 +190,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int aa_ranks_id int aa_ranks_id
) )
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -205,6 +207,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
AaRanks aa_ranks_entry AaRanks aa_ranks_entry
) )
{ {
@ -226,7 +229,7 @@ public:
update_values.push_back(columns[11] + " = " + std::to_string(aa_ranks_entry.prev_id)); update_values.push_back(columns[11] + " = " + std::to_string(aa_ranks_entry.prev_id));
update_values.push_back(columns[12] + " = " + std::to_string(aa_ranks_entry.next_id)); update_values.push_back(columns[12] + " = " + std::to_string(aa_ranks_entry.next_id));
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -240,6 +243,7 @@ public:
} }
static AaRanks InsertOne( static AaRanks InsertOne(
Database& db,
AaRanks aa_ranks_entry AaRanks aa_ranks_entry
) )
{ {
@ -278,6 +282,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<AaRanks> aa_ranks_entries std::vector<AaRanks> aa_ranks_entries
) )
{ {
@ -305,7 +310,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -316,11 +321,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<AaRanks> All() static std::vector<AaRanks> All(Database& db)
{ {
std::vector<AaRanks> all_entries; std::vector<AaRanks> all_entries;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -352,11 +357,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<AaRanks> GetWhere(std::string where_filter) static std::vector<AaRanks> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<AaRanks> all_entries; std::vector<AaRanks> all_entries;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -389,9 +394,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -402,9 +407,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -123,10 +123,11 @@ public:
} }
static AccountFlags FindOne( static AccountFlags FindOne(
Database& db,
int account_flags_id int account_flags_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -149,10 +150,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int account_flags_id int account_flags_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -165,6 +167,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
AccountFlags account_flags_entry AccountFlags account_flags_entry
) )
{ {
@ -176,7 +179,7 @@ public:
update_values.push_back(columns[1] + " = '" + EscapeString(account_flags_entry.p_flag) + "'"); update_values.push_back(columns[1] + " = '" + EscapeString(account_flags_entry.p_flag) + "'");
update_values.push_back(columns[2] + " = '" + EscapeString(account_flags_entry.p_value) + "'"); update_values.push_back(columns[2] + " = '" + EscapeString(account_flags_entry.p_value) + "'");
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -190,6 +193,7 @@ public:
} }
static AccountFlags InsertOne( static AccountFlags InsertOne(
Database& db,
AccountFlags account_flags_entry AccountFlags account_flags_entry
) )
{ {
@ -218,6 +222,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<AccountFlags> account_flags_entries std::vector<AccountFlags> account_flags_entries
) )
{ {
@ -235,7 +240,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -246,11 +251,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<AccountFlags> All() static std::vector<AccountFlags> All(Database& db)
{ {
std::vector<AccountFlags> all_entries; std::vector<AccountFlags> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -272,11 +277,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<AccountFlags> GetWhere(std::string where_filter) static std::vector<AccountFlags> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<AccountFlags> all_entries; std::vector<AccountFlags> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -299,9 +304,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -312,9 +317,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -126,10 +126,11 @@ public:
} }
static AccountIp FindOne( static AccountIp FindOne(
Database& db,
int account_ip_id int account_ip_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -153,10 +154,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int account_ip_id int account_ip_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -169,6 +171,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
AccountIp account_ip_entry AccountIp account_ip_entry
) )
{ {
@ -181,7 +184,7 @@ public:
update_values.push_back(columns[2] + " = " + std::to_string(account_ip_entry.count)); update_values.push_back(columns[2] + " = " + std::to_string(account_ip_entry.count));
update_values.push_back(columns[3] + " = '" + EscapeString(account_ip_entry.lastused) + "'"); update_values.push_back(columns[3] + " = '" + EscapeString(account_ip_entry.lastused) + "'");
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -195,6 +198,7 @@ public:
} }
static AccountIp InsertOne( static AccountIp InsertOne(
Database& db,
AccountIp account_ip_entry AccountIp account_ip_entry
) )
{ {
@ -224,6 +228,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<AccountIp> account_ip_entries std::vector<AccountIp> account_ip_entries
) )
{ {
@ -242,7 +247,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -253,11 +258,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<AccountIp> All() static std::vector<AccountIp> All(Database& db)
{ {
std::vector<AccountIp> all_entries; std::vector<AccountIp> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -280,11 +285,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<AccountIp> GetWhere(std::string where_filter) static std::vector<AccountIp> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<AccountIp> all_entries; std::vector<AccountIp> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -308,9 +313,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -321,9 +326,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -171,10 +171,11 @@ public:
} }
static Account FindOne( static Account FindOne(
Database& db,
int account_id int account_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -213,10 +214,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int account_id int account_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -229,6 +231,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
Account account_entry Account account_entry
) )
{ {
@ -255,7 +258,7 @@ public:
update_values.push_back(columns[17] + " = '" + EscapeString(account_entry.ban_reason) + "'"); update_values.push_back(columns[17] + " = '" + EscapeString(account_entry.ban_reason) + "'");
update_values.push_back(columns[18] + " = '" + EscapeString(account_entry.suspend_reason) + "'"); update_values.push_back(columns[18] + " = '" + EscapeString(account_entry.suspend_reason) + "'");
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -269,6 +272,7 @@ public:
} }
static Account InsertOne( static Account InsertOne(
Database& db,
Account account_entry Account account_entry
) )
{ {
@ -312,6 +316,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<Account> account_entries std::vector<Account> account_entries
) )
{ {
@ -344,7 +349,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -355,11 +360,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<Account> All() static std::vector<Account> All(Database& db)
{ {
std::vector<Account> all_entries; std::vector<Account> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -397,11 +402,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<Account> GetWhere(std::string where_filter) static std::vector<Account> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<Account> all_entries; std::vector<Account> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -440,9 +445,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -453,9 +458,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -123,10 +123,11 @@ public:
} }
static AccountRewards FindOne( static AccountRewards FindOne(
Database& db,
int account_rewards_id int account_rewards_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -149,10 +150,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int account_rewards_id int account_rewards_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -165,6 +167,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
AccountRewards account_rewards_entry AccountRewards account_rewards_entry
) )
{ {
@ -176,7 +179,7 @@ public:
update_values.push_back(columns[1] + " = " + std::to_string(account_rewards_entry.reward_id)); update_values.push_back(columns[1] + " = " + std::to_string(account_rewards_entry.reward_id));
update_values.push_back(columns[2] + " = " + std::to_string(account_rewards_entry.amount)); update_values.push_back(columns[2] + " = " + std::to_string(account_rewards_entry.amount));
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -190,6 +193,7 @@ public:
} }
static AccountRewards InsertOne( static AccountRewards InsertOne(
Database& db,
AccountRewards account_rewards_entry AccountRewards account_rewards_entry
) )
{ {
@ -218,6 +222,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<AccountRewards> account_rewards_entries std::vector<AccountRewards> account_rewards_entries
) )
{ {
@ -235,7 +240,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -246,11 +251,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<AccountRewards> All() static std::vector<AccountRewards> All(Database& db)
{ {
std::vector<AccountRewards> all_entries; std::vector<AccountRewards> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -272,11 +277,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<AccountRewards> GetWhere(std::string where_filter) static std::vector<AccountRewards> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<AccountRewards> all_entries; std::vector<AccountRewards> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -299,9 +304,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -312,9 +317,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -141,10 +141,11 @@ public:
} }
static AdventureDetails FindOne( static AdventureDetails FindOne(
Database& db,
int adventure_details_id int adventure_details_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -173,10 +174,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int adventure_details_id int adventure_details_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -189,6 +191,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
AdventureDetails adventure_details_entry AdventureDetails adventure_details_entry
) )
{ {
@ -205,7 +208,7 @@ public:
update_values.push_back(columns[7] + " = " + std::to_string(adventure_details_entry.time_zoned)); update_values.push_back(columns[7] + " = " + std::to_string(adventure_details_entry.time_zoned));
update_values.push_back(columns[8] + " = " + std::to_string(adventure_details_entry.time_completed)); update_values.push_back(columns[8] + " = " + std::to_string(adventure_details_entry.time_completed));
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -219,6 +222,7 @@ public:
} }
static AdventureDetails InsertOne( static AdventureDetails InsertOne(
Database& db,
AdventureDetails adventure_details_entry AdventureDetails adventure_details_entry
) )
{ {
@ -252,6 +256,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<AdventureDetails> adventure_details_entries std::vector<AdventureDetails> adventure_details_entries
) )
{ {
@ -274,7 +279,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -285,11 +290,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<AdventureDetails> All() static std::vector<AdventureDetails> All(Database& db)
{ {
std::vector<AdventureDetails> all_entries; std::vector<AdventureDetails> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -317,11 +322,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<AdventureDetails> GetWhere(std::string where_filter) static std::vector<AdventureDetails> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<AdventureDetails> all_entries; std::vector<AdventureDetails> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -350,9 +355,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -363,9 +368,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -120,10 +120,11 @@ public:
} }
static AdventureMembers FindOne( static AdventureMembers FindOne(
Database& db,
int adventure_members_id int adventure_members_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -145,10 +146,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int adventure_members_id int adventure_members_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -161,6 +163,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
AdventureMembers adventure_members_entry AdventureMembers adventure_members_entry
) )
{ {
@ -171,7 +174,7 @@ public:
update_values.push_back(columns[0] + " = " + std::to_string(adventure_members_entry.id)); update_values.push_back(columns[0] + " = " + std::to_string(adventure_members_entry.id));
update_values.push_back(columns[1] + " = " + std::to_string(adventure_members_entry.charid)); update_values.push_back(columns[1] + " = " + std::to_string(adventure_members_entry.charid));
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -185,6 +188,7 @@ public:
} }
static AdventureMembers InsertOne( static AdventureMembers InsertOne(
Database& db,
AdventureMembers adventure_members_entry AdventureMembers adventure_members_entry
) )
{ {
@ -212,6 +216,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<AdventureMembers> adventure_members_entries std::vector<AdventureMembers> adventure_members_entries
) )
{ {
@ -228,7 +233,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -239,11 +244,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<AdventureMembers> All() static std::vector<AdventureMembers> All(Database& db)
{ {
std::vector<AdventureMembers> all_entries; std::vector<AdventureMembers> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -264,11 +269,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<AdventureMembers> GetWhere(std::string where_filter) static std::vector<AdventureMembers> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<AdventureMembers> all_entries; std::vector<AdventureMembers> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -290,9 +295,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -303,9 +308,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -147,10 +147,11 @@ public:
} }
static AdventureStats FindOne( static AdventureStats FindOne(
Database& db,
int adventure_stats_id int adventure_stats_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -181,10 +182,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int adventure_stats_id int adventure_stats_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -197,6 +199,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
AdventureStats adventure_stats_entry AdventureStats adventure_stats_entry
) )
{ {
@ -216,7 +219,7 @@ public:
update_values.push_back(columns[9] + " = " + std::to_string(adventure_stats_entry.ruj_losses)); update_values.push_back(columns[9] + " = " + std::to_string(adventure_stats_entry.ruj_losses));
update_values.push_back(columns[10] + " = " + std::to_string(adventure_stats_entry.tak_losses)); update_values.push_back(columns[10] + " = " + std::to_string(adventure_stats_entry.tak_losses));
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -230,6 +233,7 @@ public:
} }
static AdventureStats InsertOne( static AdventureStats InsertOne(
Database& db,
AdventureStats adventure_stats_entry AdventureStats adventure_stats_entry
) )
{ {
@ -266,6 +270,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<AdventureStats> adventure_stats_entries std::vector<AdventureStats> adventure_stats_entries
) )
{ {
@ -291,7 +296,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -302,11 +307,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<AdventureStats> All() static std::vector<AdventureStats> All(Database& db)
{ {
std::vector<AdventureStats> all_entries; std::vector<AdventureStats> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -336,11 +341,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<AdventureStats> GetWhere(std::string where_filter) static std::vector<AdventureStats> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<AdventureStats> all_entries; std::vector<AdventureStats> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -371,9 +376,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -384,9 +389,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -120,10 +120,11 @@ public:
} }
static AdventureTemplateEntryFlavor FindOne( static AdventureTemplateEntryFlavor FindOne(
Database& db,
int adventure_template_entry_flavor_id int adventure_template_entry_flavor_id
) )
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -145,10 +146,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int adventure_template_entry_flavor_id int adventure_template_entry_flavor_id
) )
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -161,6 +163,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
AdventureTemplateEntryFlavor adventure_template_entry_flavor_entry AdventureTemplateEntryFlavor adventure_template_entry_flavor_entry
) )
{ {
@ -171,7 +174,7 @@ public:
update_values.push_back(columns[0] + " = " + std::to_string(adventure_template_entry_flavor_entry.id)); update_values.push_back(columns[0] + " = " + std::to_string(adventure_template_entry_flavor_entry.id));
update_values.push_back(columns[1] + " = '" + EscapeString(adventure_template_entry_flavor_entry.text) + "'"); update_values.push_back(columns[1] + " = '" + EscapeString(adventure_template_entry_flavor_entry.text) + "'");
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -185,6 +188,7 @@ public:
} }
static AdventureTemplateEntryFlavor InsertOne( static AdventureTemplateEntryFlavor InsertOne(
Database& db,
AdventureTemplateEntryFlavor adventure_template_entry_flavor_entry AdventureTemplateEntryFlavor adventure_template_entry_flavor_entry
) )
{ {
@ -212,6 +216,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<AdventureTemplateEntryFlavor> adventure_template_entry_flavor_entries std::vector<AdventureTemplateEntryFlavor> adventure_template_entry_flavor_entries
) )
{ {
@ -228,7 +233,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -239,11 +244,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<AdventureTemplateEntryFlavor> All() static std::vector<AdventureTemplateEntryFlavor> All(Database& db)
{ {
std::vector<AdventureTemplateEntryFlavor> all_entries; std::vector<AdventureTemplateEntryFlavor> all_entries;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -264,11 +269,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<AdventureTemplateEntryFlavor> GetWhere(std::string where_filter) static std::vector<AdventureTemplateEntryFlavor> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<AdventureTemplateEntryFlavor> all_entries; std::vector<AdventureTemplateEntryFlavor> all_entries;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -290,9 +295,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -303,9 +308,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -120,10 +120,11 @@ public:
} }
static AdventureTemplateEntry FindOne( static AdventureTemplateEntry FindOne(
Database& db,
int adventure_template_entry_id int adventure_template_entry_id
) )
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -145,10 +146,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int adventure_template_entry_id int adventure_template_entry_id
) )
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -161,6 +163,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
AdventureTemplateEntry adventure_template_entry_entry AdventureTemplateEntry adventure_template_entry_entry
) )
{ {
@ -171,7 +174,7 @@ public:
update_values.push_back(columns[0] + " = " + std::to_string(adventure_template_entry_entry.id)); update_values.push_back(columns[0] + " = " + std::to_string(adventure_template_entry_entry.id));
update_values.push_back(columns[1] + " = " + std::to_string(adventure_template_entry_entry.template_id)); update_values.push_back(columns[1] + " = " + std::to_string(adventure_template_entry_entry.template_id));
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -185,6 +188,7 @@ public:
} }
static AdventureTemplateEntry InsertOne( static AdventureTemplateEntry InsertOne(
Database& db,
AdventureTemplateEntry adventure_template_entry_entry AdventureTemplateEntry adventure_template_entry_entry
) )
{ {
@ -212,6 +216,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<AdventureTemplateEntry> adventure_template_entry_entries std::vector<AdventureTemplateEntry> adventure_template_entry_entries
) )
{ {
@ -228,7 +233,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -239,11 +244,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<AdventureTemplateEntry> All() static std::vector<AdventureTemplateEntry> All(Database& db)
{ {
std::vector<AdventureTemplateEntry> all_entries; std::vector<AdventureTemplateEntry> all_entries;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -264,11 +269,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<AdventureTemplateEntry> GetWhere(std::string where_filter) static std::vector<AdventureTemplateEntry> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<AdventureTemplateEntry> all_entries; std::vector<AdventureTemplateEntry> all_entries;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -290,9 +295,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -303,9 +308,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -213,10 +213,11 @@ public:
} }
static AdventureTemplate FindOne( static AdventureTemplate FindOne(
Database& db,
int adventure_template_id int adventure_template_id
) )
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -269,10 +270,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int adventure_template_id int adventure_template_id
) )
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -285,6 +287,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
AdventureTemplate adventure_template_entry AdventureTemplate adventure_template_entry
) )
{ {
@ -326,7 +329,7 @@ public:
update_values.push_back(columns[31] + " = " + std::to_string(adventure_template_entry.graveyard_z)); update_values.push_back(columns[31] + " = " + std::to_string(adventure_template_entry.graveyard_z));
update_values.push_back(columns[32] + " = " + std::to_string(adventure_template_entry.graveyard_radius)); update_values.push_back(columns[32] + " = " + std::to_string(adventure_template_entry.graveyard_radius));
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -340,6 +343,7 @@ public:
} }
static AdventureTemplate InsertOne( static AdventureTemplate InsertOne(
Database& db,
AdventureTemplate adventure_template_entry AdventureTemplate adventure_template_entry
) )
{ {
@ -398,6 +402,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<AdventureTemplate> adventure_template_entries std::vector<AdventureTemplate> adventure_template_entries
) )
{ {
@ -445,7 +450,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -456,11 +461,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<AdventureTemplate> All() static std::vector<AdventureTemplate> All(Database& db)
{ {
std::vector<AdventureTemplate> all_entries; std::vector<AdventureTemplate> all_entries;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -512,11 +517,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<AdventureTemplate> GetWhere(std::string where_filter) static std::vector<AdventureTemplate> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<AdventureTemplate> all_entries; std::vector<AdventureTemplate> all_entries;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -569,9 +574,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -582,9 +587,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -120,10 +120,11 @@ public:
} }
static AlternateCurrency FindOne( static AlternateCurrency FindOne(
Database& db,
int alternate_currency_id int alternate_currency_id
) )
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -145,10 +146,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int alternate_currency_id int alternate_currency_id
) )
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -161,6 +163,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
AlternateCurrency alternate_currency_entry AlternateCurrency alternate_currency_entry
) )
{ {
@ -171,7 +174,7 @@ public:
update_values.push_back(columns[0] + " = " + std::to_string(alternate_currency_entry.id)); update_values.push_back(columns[0] + " = " + std::to_string(alternate_currency_entry.id));
update_values.push_back(columns[1] + " = " + std::to_string(alternate_currency_entry.item_id)); update_values.push_back(columns[1] + " = " + std::to_string(alternate_currency_entry.item_id));
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -185,6 +188,7 @@ public:
} }
static AlternateCurrency InsertOne( static AlternateCurrency InsertOne(
Database& db,
AlternateCurrency alternate_currency_entry AlternateCurrency alternate_currency_entry
) )
{ {
@ -212,6 +216,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<AlternateCurrency> alternate_currency_entries std::vector<AlternateCurrency> alternate_currency_entries
) )
{ {
@ -228,7 +233,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -239,11 +244,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<AlternateCurrency> All() static std::vector<AlternateCurrency> All(Database& db)
{ {
std::vector<AlternateCurrency> all_entries; std::vector<AlternateCurrency> all_entries;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -264,11 +269,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<AlternateCurrency> GetWhere(std::string where_filter) static std::vector<AlternateCurrency> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<AlternateCurrency> all_entries; std::vector<AlternateCurrency> all_entries;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -290,9 +295,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -303,9 +308,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -147,10 +147,11 @@ public:
} }
static Auras FindOne( static Auras FindOne(
Database& db,
int auras_id int auras_id
) )
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -181,10 +182,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int auras_id int auras_id
) )
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -197,6 +199,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
Auras auras_entry Auras auras_entry
) )
{ {
@ -216,7 +219,7 @@ public:
update_values.push_back(columns[9] + " = " + std::to_string(auras_entry.icon)); update_values.push_back(columns[9] + " = " + std::to_string(auras_entry.icon));
update_values.push_back(columns[10] + " = " + std::to_string(auras_entry.cast_time)); update_values.push_back(columns[10] + " = " + std::to_string(auras_entry.cast_time));
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -230,6 +233,7 @@ public:
} }
static Auras InsertOne( static Auras InsertOne(
Database& db,
Auras auras_entry Auras auras_entry
) )
{ {
@ -266,6 +270,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<Auras> auras_entries std::vector<Auras> auras_entries
) )
{ {
@ -291,7 +296,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -302,11 +307,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<Auras> All() static std::vector<Auras> All(Database& db)
{ {
std::vector<Auras> all_entries; std::vector<Auras> all_entries;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -336,11 +341,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<Auras> GetWhere(std::string where_filter) static std::vector<Auras> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<Auras> all_entries; std::vector<Auras> all_entries;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -371,9 +376,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -384,9 +389,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -144,10 +144,11 @@ public:
} }
static BaseData FindOne( static BaseData FindOne(
Database& db,
int base_data_id int base_data_id
) )
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -177,10 +178,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int base_data_id int base_data_id
) )
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -193,6 +195,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
BaseData base_data_entry BaseData base_data_entry
) )
{ {
@ -211,7 +214,7 @@ public:
update_values.push_back(columns[8] + " = " + std::to_string(base_data_entry.mana_fac)); update_values.push_back(columns[8] + " = " + std::to_string(base_data_entry.mana_fac));
update_values.push_back(columns[9] + " = " + std::to_string(base_data_entry.end_fac)); update_values.push_back(columns[9] + " = " + std::to_string(base_data_entry.end_fac));
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -225,6 +228,7 @@ public:
} }
static BaseData InsertOne( static BaseData InsertOne(
Database& db,
BaseData base_data_entry BaseData base_data_entry
) )
{ {
@ -260,6 +264,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<BaseData> base_data_entries std::vector<BaseData> base_data_entries
) )
{ {
@ -284,7 +289,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -295,11 +300,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<BaseData> All() static std::vector<BaseData> All(Database& db)
{ {
std::vector<BaseData> all_entries; std::vector<BaseData> all_entries;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -328,11 +333,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<BaseData> GetWhere(std::string where_filter) static std::vector<BaseData> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<BaseData> all_entries; std::vector<BaseData> all_entries;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -362,9 +367,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -375,9 +380,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -150,10 +150,11 @@ public:
} }
static BlockedSpells FindOne( static BlockedSpells FindOne(
Database& db,
int blocked_spells_id int blocked_spells_id
) )
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -185,10 +186,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int blocked_spells_id int blocked_spells_id
) )
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -201,6 +203,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
BlockedSpells blocked_spells_entry BlockedSpells blocked_spells_entry
) )
{ {
@ -220,7 +223,7 @@ public:
update_values.push_back(columns[10] + " = '" + EscapeString(blocked_spells_entry.message) + "'"); update_values.push_back(columns[10] + " = '" + EscapeString(blocked_spells_entry.message) + "'");
update_values.push_back(columns[11] + " = '" + EscapeString(blocked_spells_entry.description) + "'"); update_values.push_back(columns[11] + " = '" + EscapeString(blocked_spells_entry.description) + "'");
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -234,6 +237,7 @@ public:
} }
static BlockedSpells InsertOne( static BlockedSpells InsertOne(
Database& db,
BlockedSpells blocked_spells_entry BlockedSpells blocked_spells_entry
) )
{ {
@ -270,6 +274,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<BlockedSpells> blocked_spells_entries std::vector<BlockedSpells> blocked_spells_entries
) )
{ {
@ -295,7 +300,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -306,11 +311,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<BlockedSpells> All() static std::vector<BlockedSpells> All(Database& db)
{ {
std::vector<BlockedSpells> all_entries; std::vector<BlockedSpells> all_entries;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -341,11 +346,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<BlockedSpells> GetWhere(std::string where_filter) static std::vector<BlockedSpells> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<BlockedSpells> all_entries; std::vector<BlockedSpells> all_entries;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -377,9 +382,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -390,9 +395,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -210,10 +210,11 @@ public:
} }
static BugReports FindOne( static BugReports FindOne(
Database& db,
int bug_reports_id int bug_reports_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -265,10 +266,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int bug_reports_id int bug_reports_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -281,6 +283,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
BugReports bug_reports_entry BugReports bug_reports_entry
) )
{ {
@ -320,7 +323,7 @@ public:
update_values.push_back(columns[30] + " = '" + EscapeString(bug_reports_entry.last_reviewer) + "'"); update_values.push_back(columns[30] + " = '" + EscapeString(bug_reports_entry.last_reviewer) + "'");
update_values.push_back(columns[31] + " = '" + EscapeString(bug_reports_entry.reviewer_notes) + "'"); update_values.push_back(columns[31] + " = '" + EscapeString(bug_reports_entry.reviewer_notes) + "'");
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -334,6 +337,7 @@ public:
} }
static BugReports InsertOne( static BugReports InsertOne(
Database& db,
BugReports bug_reports_entry BugReports bug_reports_entry
) )
{ {
@ -390,6 +394,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<BugReports> bug_reports_entries std::vector<BugReports> bug_reports_entries
) )
{ {
@ -435,7 +440,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -446,11 +451,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<BugReports> All() static std::vector<BugReports> All(Database& db)
{ {
std::vector<BugReports> all_entries; std::vector<BugReports> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -501,11 +506,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<BugReports> GetWhere(std::string where_filter) static std::vector<BugReports> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<BugReports> all_entries; std::vector<BugReports> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -557,9 +562,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -570,9 +575,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -153,10 +153,11 @@ public:
} }
static Bugs FindOne( static Bugs FindOne(
Database& db,
int bugs_id int bugs_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -189,10 +190,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int bugs_id int bugs_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -205,6 +207,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
Bugs bugs_entry Bugs bugs_entry
) )
{ {
@ -225,7 +228,7 @@ public:
update_values.push_back(columns[11] + " = '" + EscapeString(bugs_entry.date) + "'"); update_values.push_back(columns[11] + " = '" + EscapeString(bugs_entry.date) + "'");
update_values.push_back(columns[12] + " = " + std::to_string(bugs_entry.status)); update_values.push_back(columns[12] + " = " + std::to_string(bugs_entry.status));
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -239,6 +242,7 @@ public:
} }
static Bugs InsertOne( static Bugs InsertOne(
Database& db,
Bugs bugs_entry Bugs bugs_entry
) )
{ {
@ -276,6 +280,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<Bugs> bugs_entries std::vector<Bugs> bugs_entries
) )
{ {
@ -302,7 +307,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -313,11 +318,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<Bugs> All() static std::vector<Bugs> All(Database& db)
{ {
std::vector<Bugs> all_entries; std::vector<Bugs> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -349,11 +354,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<Bugs> GetWhere(std::string where_filter) static std::vector<Bugs> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<Bugs> all_entries; std::vector<Bugs> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -386,9 +391,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -399,9 +404,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -132,10 +132,11 @@ public:
} }
static Buyer FindOne( static Buyer FindOne(
Database& db,
int buyer_id int buyer_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -161,10 +162,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int buyer_id int buyer_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -177,6 +179,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
Buyer buyer_entry Buyer buyer_entry
) )
{ {
@ -191,7 +194,7 @@ public:
update_values.push_back(columns[4] + " = " + std::to_string(buyer_entry.quantity)); update_values.push_back(columns[4] + " = " + std::to_string(buyer_entry.quantity));
update_values.push_back(columns[5] + " = " + std::to_string(buyer_entry.price)); update_values.push_back(columns[5] + " = " + std::to_string(buyer_entry.price));
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -205,6 +208,7 @@ public:
} }
static Buyer InsertOne( static Buyer InsertOne(
Database& db,
Buyer buyer_entry Buyer buyer_entry
) )
{ {
@ -236,6 +240,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<Buyer> buyer_entries std::vector<Buyer> buyer_entries
) )
{ {
@ -256,7 +261,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -267,11 +272,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<Buyer> All() static std::vector<Buyer> All(Database& db)
{ {
std::vector<Buyer> all_entries; std::vector<Buyer> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -296,11 +301,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<Buyer> GetWhere(std::string where_filter) static std::vector<Buyer> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<Buyer> all_entries; std::vector<Buyer> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -326,9 +331,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -339,9 +344,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -132,10 +132,11 @@ public:
} }
static CharCreateCombinations FindOne( static CharCreateCombinations FindOne(
Database& db,
int char_create_combinations_id int char_create_combinations_id
) )
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -161,10 +162,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int char_create_combinations_id int char_create_combinations_id
) )
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -177,6 +179,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
CharCreateCombinations char_create_combinations_entry CharCreateCombinations char_create_combinations_entry
) )
{ {
@ -191,7 +194,7 @@ public:
update_values.push_back(columns[4] + " = " + std::to_string(char_create_combinations_entry.start_zone)); update_values.push_back(columns[4] + " = " + std::to_string(char_create_combinations_entry.start_zone));
update_values.push_back(columns[5] + " = " + std::to_string(char_create_combinations_entry.expansions_req)); update_values.push_back(columns[5] + " = " + std::to_string(char_create_combinations_entry.expansions_req));
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -205,6 +208,7 @@ public:
} }
static CharCreateCombinations InsertOne( static CharCreateCombinations InsertOne(
Database& db,
CharCreateCombinations char_create_combinations_entry CharCreateCombinations char_create_combinations_entry
) )
{ {
@ -236,6 +240,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<CharCreateCombinations> char_create_combinations_entries std::vector<CharCreateCombinations> char_create_combinations_entries
) )
{ {
@ -256,7 +261,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -267,11 +272,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<CharCreateCombinations> All() static std::vector<CharCreateCombinations> All(Database& db)
{ {
std::vector<CharCreateCombinations> all_entries; std::vector<CharCreateCombinations> all_entries;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -296,11 +301,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<CharCreateCombinations> GetWhere(std::string where_filter) static std::vector<CharCreateCombinations> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<CharCreateCombinations> all_entries; std::vector<CharCreateCombinations> all_entries;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -326,9 +331,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -339,9 +344,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -159,10 +159,11 @@ public:
} }
static CharCreatePointAllocations FindOne( static CharCreatePointAllocations FindOne(
Database& db,
int char_create_point_allocations_id int char_create_point_allocations_id
) )
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -197,10 +198,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int char_create_point_allocations_id int char_create_point_allocations_id
) )
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -213,6 +215,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
CharCreatePointAllocations char_create_point_allocations_entry CharCreatePointAllocations char_create_point_allocations_entry
) )
{ {
@ -236,7 +239,7 @@ public:
update_values.push_back(columns[13] + " = " + std::to_string(char_create_point_allocations_entry.alloc_wis)); update_values.push_back(columns[13] + " = " + std::to_string(char_create_point_allocations_entry.alloc_wis));
update_values.push_back(columns[14] + " = " + std::to_string(char_create_point_allocations_entry.alloc_cha)); update_values.push_back(columns[14] + " = " + std::to_string(char_create_point_allocations_entry.alloc_cha));
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -250,6 +253,7 @@ public:
} }
static CharCreatePointAllocations InsertOne( static CharCreatePointAllocations InsertOne(
Database& db,
CharCreatePointAllocations char_create_point_allocations_entry CharCreatePointAllocations char_create_point_allocations_entry
) )
{ {
@ -290,6 +294,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<CharCreatePointAllocations> char_create_point_allocations_entries std::vector<CharCreatePointAllocations> char_create_point_allocations_entries
) )
{ {
@ -319,7 +324,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -330,11 +335,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<CharCreatePointAllocations> All() static std::vector<CharCreatePointAllocations> All(Database& db)
{ {
std::vector<CharCreatePointAllocations> all_entries; std::vector<CharCreatePointAllocations> all_entries;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -368,11 +373,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<CharCreatePointAllocations> GetWhere(std::string where_filter) static std::vector<CharCreatePointAllocations> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<CharCreatePointAllocations> all_entries; std::vector<CharCreatePointAllocations> all_entries;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -407,9 +412,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -420,9 +425,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -123,10 +123,11 @@ public:
} }
static CharRecipeList FindOne( static CharRecipeList FindOne(
Database& db,
int char_recipe_list_id int char_recipe_list_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -149,10 +150,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int char_recipe_list_id int char_recipe_list_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -165,6 +167,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
CharRecipeList char_recipe_list_entry CharRecipeList char_recipe_list_entry
) )
{ {
@ -176,7 +179,7 @@ public:
update_values.push_back(columns[1] + " = " + std::to_string(char_recipe_list_entry.recipe_id)); update_values.push_back(columns[1] + " = " + std::to_string(char_recipe_list_entry.recipe_id));
update_values.push_back(columns[2] + " = " + std::to_string(char_recipe_list_entry.madecount)); update_values.push_back(columns[2] + " = " + std::to_string(char_recipe_list_entry.madecount));
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -190,6 +193,7 @@ public:
} }
static CharRecipeList InsertOne( static CharRecipeList InsertOne(
Database& db,
CharRecipeList char_recipe_list_entry CharRecipeList char_recipe_list_entry
) )
{ {
@ -218,6 +222,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<CharRecipeList> char_recipe_list_entries std::vector<CharRecipeList> char_recipe_list_entries
) )
{ {
@ -235,7 +240,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -246,11 +251,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<CharRecipeList> All() static std::vector<CharRecipeList> All(Database& db)
{ {
std::vector<CharRecipeList> all_entries; std::vector<CharRecipeList> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -272,11 +277,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<CharRecipeList> GetWhere(std::string where_filter) static std::vector<CharRecipeList> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<CharRecipeList> all_entries; std::vector<CharRecipeList> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -299,9 +304,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -312,9 +317,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -129,10 +129,11 @@ public:
} }
static CharacterActivities FindOne( static CharacterActivities FindOne(
Database& db,
int character_activities_id int character_activities_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -157,10 +158,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int character_activities_id int character_activities_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -173,6 +175,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
CharacterActivities character_activities_entry CharacterActivities character_activities_entry
) )
{ {
@ -186,7 +189,7 @@ public:
update_values.push_back(columns[3] + " = " + std::to_string(character_activities_entry.donecount)); update_values.push_back(columns[3] + " = " + std::to_string(character_activities_entry.donecount));
update_values.push_back(columns[4] + " = " + std::to_string(character_activities_entry.completed)); update_values.push_back(columns[4] + " = " + std::to_string(character_activities_entry.completed));
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -200,6 +203,7 @@ public:
} }
static CharacterActivities InsertOne( static CharacterActivities InsertOne(
Database& db,
CharacterActivities character_activities_entry CharacterActivities character_activities_entry
) )
{ {
@ -230,6 +234,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<CharacterActivities> character_activities_entries std::vector<CharacterActivities> character_activities_entries
) )
{ {
@ -249,7 +254,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -260,11 +265,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<CharacterActivities> All() static std::vector<CharacterActivities> All(Database& db)
{ {
std::vector<CharacterActivities> all_entries; std::vector<CharacterActivities> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -288,11 +293,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<CharacterActivities> GetWhere(std::string where_filter) static std::vector<CharacterActivities> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<CharacterActivities> all_entries; std::vector<CharacterActivities> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -317,9 +322,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -330,9 +335,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -123,10 +123,11 @@ public:
} }
static CharacterAltCurrency FindOne( static CharacterAltCurrency FindOne(
Database& db,
int character_alt_currency_id int character_alt_currency_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -149,10 +150,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int character_alt_currency_id int character_alt_currency_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -165,6 +167,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
CharacterAltCurrency character_alt_currency_entry CharacterAltCurrency character_alt_currency_entry
) )
{ {
@ -176,7 +179,7 @@ public:
update_values.push_back(columns[1] + " = " + std::to_string(character_alt_currency_entry.currency_id)); update_values.push_back(columns[1] + " = " + std::to_string(character_alt_currency_entry.currency_id));
update_values.push_back(columns[2] + " = " + std::to_string(character_alt_currency_entry.amount)); update_values.push_back(columns[2] + " = " + std::to_string(character_alt_currency_entry.amount));
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -190,6 +193,7 @@ public:
} }
static CharacterAltCurrency InsertOne( static CharacterAltCurrency InsertOne(
Database& db,
CharacterAltCurrency character_alt_currency_entry CharacterAltCurrency character_alt_currency_entry
) )
{ {
@ -218,6 +222,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<CharacterAltCurrency> character_alt_currency_entries std::vector<CharacterAltCurrency> character_alt_currency_entries
) )
{ {
@ -235,7 +240,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -246,11 +251,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<CharacterAltCurrency> All() static std::vector<CharacterAltCurrency> All(Database& db)
{ {
std::vector<CharacterAltCurrency> all_entries; std::vector<CharacterAltCurrency> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -272,11 +277,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<CharacterAltCurrency> GetWhere(std::string where_filter) static std::vector<CharacterAltCurrency> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<CharacterAltCurrency> all_entries; std::vector<CharacterAltCurrency> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -299,9 +304,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -312,9 +317,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -126,10 +126,11 @@ public:
} }
static CharacterAlternateAbilities FindOne( static CharacterAlternateAbilities FindOne(
Database& db,
int character_alternate_abilities_id int character_alternate_abilities_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -153,10 +154,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int character_alternate_abilities_id int character_alternate_abilities_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -169,6 +171,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
CharacterAlternateAbilities character_alternate_abilities_entry CharacterAlternateAbilities character_alternate_abilities_entry
) )
{ {
@ -181,7 +184,7 @@ public:
update_values.push_back(columns[2] + " = " + std::to_string(character_alternate_abilities_entry.aa_value)); update_values.push_back(columns[2] + " = " + std::to_string(character_alternate_abilities_entry.aa_value));
update_values.push_back(columns[3] + " = " + std::to_string(character_alternate_abilities_entry.charges)); update_values.push_back(columns[3] + " = " + std::to_string(character_alternate_abilities_entry.charges));
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -195,6 +198,7 @@ public:
} }
static CharacterAlternateAbilities InsertOne( static CharacterAlternateAbilities InsertOne(
Database& db,
CharacterAlternateAbilities character_alternate_abilities_entry CharacterAlternateAbilities character_alternate_abilities_entry
) )
{ {
@ -224,6 +228,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<CharacterAlternateAbilities> character_alternate_abilities_entries std::vector<CharacterAlternateAbilities> character_alternate_abilities_entries
) )
{ {
@ -242,7 +247,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -253,11 +258,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<CharacterAlternateAbilities> All() static std::vector<CharacterAlternateAbilities> All(Database& db)
{ {
std::vector<CharacterAlternateAbilities> all_entries; std::vector<CharacterAlternateAbilities> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -280,11 +285,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<CharacterAlternateAbilities> GetWhere(std::string where_filter) static std::vector<CharacterAlternateAbilities> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<CharacterAlternateAbilities> all_entries; std::vector<CharacterAlternateAbilities> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -308,9 +313,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -321,9 +326,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -123,10 +123,11 @@ public:
} }
static CharacterAuras FindOne( static CharacterAuras FindOne(
Database& db,
int character_auras_id int character_auras_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -149,10 +150,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int character_auras_id int character_auras_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -165,6 +167,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
CharacterAuras character_auras_entry CharacterAuras character_auras_entry
) )
{ {
@ -176,7 +179,7 @@ public:
update_values.push_back(columns[1] + " = " + std::to_string(character_auras_entry.slot)); update_values.push_back(columns[1] + " = " + std::to_string(character_auras_entry.slot));
update_values.push_back(columns[2] + " = " + std::to_string(character_auras_entry.spell_id)); update_values.push_back(columns[2] + " = " + std::to_string(character_auras_entry.spell_id));
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -190,6 +193,7 @@ public:
} }
static CharacterAuras InsertOne( static CharacterAuras InsertOne(
Database& db,
CharacterAuras character_auras_entry CharacterAuras character_auras_entry
) )
{ {
@ -218,6 +222,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<CharacterAuras> character_auras_entries std::vector<CharacterAuras> character_auras_entries
) )
{ {
@ -235,7 +240,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -246,11 +251,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<CharacterAuras> All() static std::vector<CharacterAuras> All(Database& db)
{ {
std::vector<CharacterAuras> all_entries; std::vector<CharacterAuras> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -272,11 +277,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<CharacterAuras> GetWhere(std::string where_filter) static std::vector<CharacterAuras> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<CharacterAuras> all_entries; std::vector<CharacterAuras> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -299,9 +304,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -312,9 +317,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -132,10 +132,11 @@ public:
} }
static CharacterBandolier FindOne( static CharacterBandolier FindOne(
Database& db,
int character_bandolier_id int character_bandolier_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -161,10 +162,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int character_bandolier_id int character_bandolier_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -177,6 +179,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
CharacterBandolier character_bandolier_entry CharacterBandolier character_bandolier_entry
) )
{ {
@ -191,7 +194,7 @@ public:
update_values.push_back(columns[4] + " = " + std::to_string(character_bandolier_entry.icon)); update_values.push_back(columns[4] + " = " + std::to_string(character_bandolier_entry.icon));
update_values.push_back(columns[5] + " = '" + EscapeString(character_bandolier_entry.bandolier_name) + "'"); update_values.push_back(columns[5] + " = '" + EscapeString(character_bandolier_entry.bandolier_name) + "'");
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -205,6 +208,7 @@ public:
} }
static CharacterBandolier InsertOne( static CharacterBandolier InsertOne(
Database& db,
CharacterBandolier character_bandolier_entry CharacterBandolier character_bandolier_entry
) )
{ {
@ -236,6 +240,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<CharacterBandolier> character_bandolier_entries std::vector<CharacterBandolier> character_bandolier_entries
) )
{ {
@ -256,7 +261,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -267,11 +272,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<CharacterBandolier> All() static std::vector<CharacterBandolier> All(Database& db)
{ {
std::vector<CharacterBandolier> all_entries; std::vector<CharacterBandolier> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -296,11 +301,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<CharacterBandolier> GetWhere(std::string where_filter) static std::vector<CharacterBandolier> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<CharacterBandolier> all_entries; std::vector<CharacterBandolier> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -326,9 +331,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -339,9 +344,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -138,10 +138,11 @@ public:
} }
static CharacterBind FindOne( static CharacterBind FindOne(
Database& db,
int character_bind_id int character_bind_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -169,10 +170,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int character_bind_id int character_bind_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -185,6 +187,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
CharacterBind character_bind_entry CharacterBind character_bind_entry
) )
{ {
@ -200,7 +203,7 @@ public:
update_values.push_back(columns[6] + " = " + std::to_string(character_bind_entry.z)); update_values.push_back(columns[6] + " = " + std::to_string(character_bind_entry.z));
update_values.push_back(columns[7] + " = " + std::to_string(character_bind_entry.heading)); update_values.push_back(columns[7] + " = " + std::to_string(character_bind_entry.heading));
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -214,6 +217,7 @@ public:
} }
static CharacterBind InsertOne( static CharacterBind InsertOne(
Database& db,
CharacterBind character_bind_entry CharacterBind character_bind_entry
) )
{ {
@ -246,6 +250,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<CharacterBind> character_bind_entries std::vector<CharacterBind> character_bind_entries
) )
{ {
@ -267,7 +272,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -278,11 +283,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<CharacterBind> All() static std::vector<CharacterBind> All(Database& db)
{ {
std::vector<CharacterBind> all_entries; std::vector<CharacterBind> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -309,11 +314,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<CharacterBind> GetWhere(std::string where_filter) static std::vector<CharacterBind> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<CharacterBind> all_entries; std::vector<CharacterBind> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -341,9 +346,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -354,9 +359,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -165,10 +165,11 @@ public:
} }
static CharacterBuffs FindOne( static CharacterBuffs FindOne(
Database& db,
int character_buffs_id int character_buffs_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -205,10 +206,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int character_buffs_id int character_buffs_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -221,6 +223,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
CharacterBuffs character_buffs_entry CharacterBuffs character_buffs_entry
) )
{ {
@ -246,7 +249,7 @@ public:
update_values.push_back(columns[15] + " = " + std::to_string(character_buffs_entry.ExtraDIChance)); update_values.push_back(columns[15] + " = " + std::to_string(character_buffs_entry.ExtraDIChance));
update_values.push_back(columns[16] + " = " + std::to_string(character_buffs_entry.instrument_mod)); update_values.push_back(columns[16] + " = " + std::to_string(character_buffs_entry.instrument_mod));
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -260,6 +263,7 @@ public:
} }
static CharacterBuffs InsertOne( static CharacterBuffs InsertOne(
Database& db,
CharacterBuffs character_buffs_entry CharacterBuffs character_buffs_entry
) )
{ {
@ -302,6 +306,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<CharacterBuffs> character_buffs_entries std::vector<CharacterBuffs> character_buffs_entries
) )
{ {
@ -333,7 +338,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -344,11 +349,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<CharacterBuffs> All() static std::vector<CharacterBuffs> All(Database& db)
{ {
std::vector<CharacterBuffs> all_entries; std::vector<CharacterBuffs> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -384,11 +389,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<CharacterBuffs> GetWhere(std::string where_filter) static std::vector<CharacterBuffs> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<CharacterBuffs> all_entries; std::vector<CharacterBuffs> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -425,9 +430,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -438,9 +443,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -147,10 +147,11 @@ public:
} }
static CharacterCorpseItems FindOne( static CharacterCorpseItems FindOne(
Database& db,
int character_corpse_items_id int character_corpse_items_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -181,10 +182,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int character_corpse_items_id int character_corpse_items_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -197,6 +199,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
CharacterCorpseItems character_corpse_items_entry CharacterCorpseItems character_corpse_items_entry
) )
{ {
@ -216,7 +219,7 @@ public:
update_values.push_back(columns[9] + " = " + std::to_string(character_corpse_items_entry.aug_6)); update_values.push_back(columns[9] + " = " + std::to_string(character_corpse_items_entry.aug_6));
update_values.push_back(columns[10] + " = " + std::to_string(character_corpse_items_entry.attuned)); update_values.push_back(columns[10] + " = " + std::to_string(character_corpse_items_entry.attuned));
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -230,6 +233,7 @@ public:
} }
static CharacterCorpseItems InsertOne( static CharacterCorpseItems InsertOne(
Database& db,
CharacterCorpseItems character_corpse_items_entry CharacterCorpseItems character_corpse_items_entry
) )
{ {
@ -266,6 +270,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<CharacterCorpseItems> character_corpse_items_entries std::vector<CharacterCorpseItems> character_corpse_items_entries
) )
{ {
@ -291,7 +296,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -302,11 +307,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<CharacterCorpseItems> All() static std::vector<CharacterCorpseItems> All(Database& db)
{ {
std::vector<CharacterCorpseItems> all_entries; std::vector<CharacterCorpseItems> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -336,11 +341,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<CharacterCorpseItems> GetWhere(std::string where_filter) static std::vector<CharacterCorpseItems> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<CharacterCorpseItems> all_entries; std::vector<CharacterCorpseItems> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -371,9 +376,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -384,9 +389,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -255,10 +255,11 @@ public:
} }
static CharacterCorpses FindOne( static CharacterCorpses FindOne(
Database& db,
int character_corpses_id int character_corpses_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -325,10 +326,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int character_corpses_id int character_corpses_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -341,6 +343,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
CharacterCorpses character_corpses_entry CharacterCorpses character_corpses_entry
) )
{ {
@ -395,7 +398,7 @@ public:
update_values.push_back(columns[45] + " = " + std::to_string(character_corpses_entry.wc_8)); update_values.push_back(columns[45] + " = " + std::to_string(character_corpses_entry.wc_8));
update_values.push_back(columns[46] + " = " + std::to_string(character_corpses_entry.wc_9)); update_values.push_back(columns[46] + " = " + std::to_string(character_corpses_entry.wc_9));
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -409,6 +412,7 @@ public:
} }
static CharacterCorpses InsertOne( static CharacterCorpses InsertOne(
Database& db,
CharacterCorpses character_corpses_entry CharacterCorpses character_corpses_entry
) )
{ {
@ -480,6 +484,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<CharacterCorpses> character_corpses_entries std::vector<CharacterCorpses> character_corpses_entries
) )
{ {
@ -540,7 +545,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -551,11 +556,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<CharacterCorpses> All() static std::vector<CharacterCorpses> All(Database& db)
{ {
std::vector<CharacterCorpses> all_entries; std::vector<CharacterCorpses> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -621,11 +626,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<CharacterCorpses> GetWhere(std::string where_filter) static std::vector<CharacterCorpses> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<CharacterCorpses> all_entries; std::vector<CharacterCorpses> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -692,9 +697,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -705,9 +710,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -165,10 +165,11 @@ public:
} }
static CharacterCurrency FindOne( static CharacterCurrency FindOne(
Database& db,
int character_currency_id int character_currency_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -205,10 +206,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int character_currency_id int character_currency_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -221,6 +223,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
CharacterCurrency character_currency_entry CharacterCurrency character_currency_entry
) )
{ {
@ -246,7 +249,7 @@ public:
update_values.push_back(columns[15] + " = " + std::to_string(character_currency_entry.ebon_crystals)); update_values.push_back(columns[15] + " = " + std::to_string(character_currency_entry.ebon_crystals));
update_values.push_back(columns[16] + " = " + std::to_string(character_currency_entry.career_ebon_crystals)); update_values.push_back(columns[16] + " = " + std::to_string(character_currency_entry.career_ebon_crystals));
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -260,6 +263,7 @@ public:
} }
static CharacterCurrency InsertOne( static CharacterCurrency InsertOne(
Database& db,
CharacterCurrency character_currency_entry CharacterCurrency character_currency_entry
) )
{ {
@ -302,6 +306,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<CharacterCurrency> character_currency_entries std::vector<CharacterCurrency> character_currency_entries
) )
{ {
@ -333,7 +338,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -344,11 +349,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<CharacterCurrency> All() static std::vector<CharacterCurrency> All(Database& db)
{ {
std::vector<CharacterCurrency> all_entries; std::vector<CharacterCurrency> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -384,11 +389,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<CharacterCurrency> GetWhere(std::string where_filter) static std::vector<CharacterCurrency> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<CharacterCurrency> all_entries; std::vector<CharacterCurrency> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -425,9 +430,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -438,9 +443,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -420,10 +420,11 @@ public:
} }
static CharacterData FindOne( static CharacterData FindOne(
Database& db,
int character_data_id int character_data_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -545,10 +546,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int character_data_id int character_data_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -561,6 +563,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
CharacterData character_data_entry CharacterData character_data_entry
) )
{ {
@ -670,7 +673,7 @@ public:
update_values.push_back(columns[100] + " = " + std::to_string(character_data_entry.e_last_invsnapshot)); update_values.push_back(columns[100] + " = " + std::to_string(character_data_entry.e_last_invsnapshot));
update_values.push_back(columns[101] + " = '" + EscapeString(character_data_entry.deleted_at) + "'"); update_values.push_back(columns[101] + " = '" + EscapeString(character_data_entry.deleted_at) + "'");
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -684,6 +687,7 @@ public:
} }
static CharacterData InsertOne( static CharacterData InsertOne(
Database& db,
CharacterData character_data_entry CharacterData character_data_entry
) )
{ {
@ -810,6 +814,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<CharacterData> character_data_entries std::vector<CharacterData> character_data_entries
) )
{ {
@ -925,7 +930,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -936,11 +941,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<CharacterData> All() static std::vector<CharacterData> All(Database& db)
{ {
std::vector<CharacterData> all_entries; std::vector<CharacterData> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -1061,11 +1066,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<CharacterData> GetWhere(std::string where_filter) static std::vector<CharacterData> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<CharacterData> all_entries; std::vector<CharacterData> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -1187,9 +1192,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -1200,9 +1205,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -123,10 +123,11 @@ public:
} }
static CharacterDisciplines FindOne( static CharacterDisciplines FindOne(
Database& db,
int character_disciplines_id int character_disciplines_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -149,10 +150,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int character_disciplines_id int character_disciplines_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -165,6 +167,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
CharacterDisciplines character_disciplines_entry CharacterDisciplines character_disciplines_entry
) )
{ {
@ -176,7 +179,7 @@ public:
update_values.push_back(columns[1] + " = " + std::to_string(character_disciplines_entry.slot_id)); update_values.push_back(columns[1] + " = " + std::to_string(character_disciplines_entry.slot_id));
update_values.push_back(columns[2] + " = " + std::to_string(character_disciplines_entry.disc_id)); update_values.push_back(columns[2] + " = " + std::to_string(character_disciplines_entry.disc_id));
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -190,6 +193,7 @@ public:
} }
static CharacterDisciplines InsertOne( static CharacterDisciplines InsertOne(
Database& db,
CharacterDisciplines character_disciplines_entry CharacterDisciplines character_disciplines_entry
) )
{ {
@ -218,6 +222,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<CharacterDisciplines> character_disciplines_entries std::vector<CharacterDisciplines> character_disciplines_entries
) )
{ {
@ -235,7 +240,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -246,11 +251,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<CharacterDisciplines> All() static std::vector<CharacterDisciplines> All(Database& db)
{ {
std::vector<CharacterDisciplines> all_entries; std::vector<CharacterDisciplines> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -272,11 +277,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<CharacterDisciplines> GetWhere(std::string where_filter) static std::vector<CharacterDisciplines> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<CharacterDisciplines> all_entries; std::vector<CharacterDisciplines> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -299,9 +304,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -312,9 +317,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -135,10 +135,11 @@ public:
} }
static CharacterExpeditionLockouts FindOne( static CharacterExpeditionLockouts FindOne(
Database& db,
int character_expedition_lockouts_id int character_expedition_lockouts_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -165,10 +166,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int character_expedition_lockouts_id int character_expedition_lockouts_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -181,6 +183,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
CharacterExpeditionLockouts character_expedition_lockouts_entry CharacterExpeditionLockouts character_expedition_lockouts_entry
) )
{ {
@ -195,7 +198,7 @@ public:
update_values.push_back(columns[5] + " = " + std::to_string(character_expedition_lockouts_entry.duration)); update_values.push_back(columns[5] + " = " + std::to_string(character_expedition_lockouts_entry.duration));
update_values.push_back(columns[6] + " = '" + EscapeString(character_expedition_lockouts_entry.from_expedition_uuid) + "'"); update_values.push_back(columns[6] + " = '" + EscapeString(character_expedition_lockouts_entry.from_expedition_uuid) + "'");
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -209,6 +212,7 @@ public:
} }
static CharacterExpeditionLockouts InsertOne( static CharacterExpeditionLockouts InsertOne(
Database& db,
CharacterExpeditionLockouts character_expedition_lockouts_entry CharacterExpeditionLockouts character_expedition_lockouts_entry
) )
{ {
@ -240,6 +244,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<CharacterExpeditionLockouts> character_expedition_lockouts_entries std::vector<CharacterExpeditionLockouts> character_expedition_lockouts_entries
) )
{ {
@ -260,7 +265,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -271,11 +276,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<CharacterExpeditionLockouts> All() static std::vector<CharacterExpeditionLockouts> All(Database& db)
{ {
std::vector<CharacterExpeditionLockouts> all_entries; std::vector<CharacterExpeditionLockouts> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -301,11 +306,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<CharacterExpeditionLockouts> GetWhere(std::string where_filter) static std::vector<CharacterExpeditionLockouts> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<CharacterExpeditionLockouts> all_entries; std::vector<CharacterExpeditionLockouts> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -332,9 +337,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -345,9 +350,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -120,10 +120,11 @@ public:
} }
static CharacterInspectMessages FindOne( static CharacterInspectMessages FindOne(
Database& db,
int character_inspect_messages_id int character_inspect_messages_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -145,10 +146,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int character_inspect_messages_id int character_inspect_messages_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -161,6 +163,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
CharacterInspectMessages character_inspect_messages_entry CharacterInspectMessages character_inspect_messages_entry
) )
{ {
@ -171,7 +174,7 @@ public:
update_values.push_back(columns[0] + " = " + std::to_string(character_inspect_messages_entry.id)); update_values.push_back(columns[0] + " = " + std::to_string(character_inspect_messages_entry.id));
update_values.push_back(columns[1] + " = '" + EscapeString(character_inspect_messages_entry.inspect_message) + "'"); update_values.push_back(columns[1] + " = '" + EscapeString(character_inspect_messages_entry.inspect_message) + "'");
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -185,6 +188,7 @@ public:
} }
static CharacterInspectMessages InsertOne( static CharacterInspectMessages InsertOne(
Database& db,
CharacterInspectMessages character_inspect_messages_entry CharacterInspectMessages character_inspect_messages_entry
) )
{ {
@ -212,6 +216,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<CharacterInspectMessages> character_inspect_messages_entries std::vector<CharacterInspectMessages> character_inspect_messages_entries
) )
{ {
@ -228,7 +233,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -239,11 +244,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<CharacterInspectMessages> All() static std::vector<CharacterInspectMessages> All(Database& db)
{ {
std::vector<CharacterInspectMessages> all_entries; std::vector<CharacterInspectMessages> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -264,11 +269,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<CharacterInspectMessages> GetWhere(std::string where_filter) static std::vector<CharacterInspectMessages> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<CharacterInspectMessages> all_entries; std::vector<CharacterInspectMessages> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -290,9 +295,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -303,9 +308,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -123,10 +123,11 @@ public:
} }
static CharacterItemRecast FindOne( static CharacterItemRecast FindOne(
Database& db,
int character_item_recast_id int character_item_recast_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -149,10 +150,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int character_item_recast_id int character_item_recast_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -165,6 +167,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
CharacterItemRecast character_item_recast_entry CharacterItemRecast character_item_recast_entry
) )
{ {
@ -176,7 +179,7 @@ public:
update_values.push_back(columns[1] + " = " + std::to_string(character_item_recast_entry.recast_type)); update_values.push_back(columns[1] + " = " + std::to_string(character_item_recast_entry.recast_type));
update_values.push_back(columns[2] + " = " + std::to_string(character_item_recast_entry.timestamp)); update_values.push_back(columns[2] + " = " + std::to_string(character_item_recast_entry.timestamp));
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -190,6 +193,7 @@ public:
} }
static CharacterItemRecast InsertOne( static CharacterItemRecast InsertOne(
Database& db,
CharacterItemRecast character_item_recast_entry CharacterItemRecast character_item_recast_entry
) )
{ {
@ -218,6 +222,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<CharacterItemRecast> character_item_recast_entries std::vector<CharacterItemRecast> character_item_recast_entries
) )
{ {
@ -235,7 +240,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -246,11 +251,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<CharacterItemRecast> All() static std::vector<CharacterItemRecast> All(Database& db)
{ {
std::vector<CharacterItemRecast> all_entries; std::vector<CharacterItemRecast> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -272,11 +277,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<CharacterItemRecast> GetWhere(std::string where_filter) static std::vector<CharacterItemRecast> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<CharacterItemRecast> all_entries; std::vector<CharacterItemRecast> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -299,9 +304,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -312,9 +317,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -123,10 +123,11 @@ public:
} }
static CharacterLanguages FindOne( static CharacterLanguages FindOne(
Database& db,
int character_languages_id int character_languages_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -149,10 +150,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int character_languages_id int character_languages_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -165,6 +167,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
CharacterLanguages character_languages_entry CharacterLanguages character_languages_entry
) )
{ {
@ -175,7 +178,7 @@ public:
update_values.push_back(columns[1] + " = " + std::to_string(character_languages_entry.lang_id)); update_values.push_back(columns[1] + " = " + std::to_string(character_languages_entry.lang_id));
update_values.push_back(columns[2] + " = " + std::to_string(character_languages_entry.value)); update_values.push_back(columns[2] + " = " + std::to_string(character_languages_entry.value));
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -189,6 +192,7 @@ public:
} }
static CharacterLanguages InsertOne( static CharacterLanguages InsertOne(
Database& db,
CharacterLanguages character_languages_entry CharacterLanguages character_languages_entry
) )
{ {
@ -216,6 +220,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<CharacterLanguages> character_languages_entries std::vector<CharacterLanguages> character_languages_entries
) )
{ {
@ -232,7 +237,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -243,11 +248,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<CharacterLanguages> All() static std::vector<CharacterLanguages> All(Database& db)
{ {
std::vector<CharacterLanguages> all_entries; std::vector<CharacterLanguages> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -269,11 +274,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<CharacterLanguages> GetWhere(std::string where_filter) static std::vector<CharacterLanguages> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<CharacterLanguages> all_entries; std::vector<CharacterLanguages> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -296,9 +301,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -309,9 +314,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -123,10 +123,11 @@ public:
} }
static CharacterLeadershipAbilities FindOne( static CharacterLeadershipAbilities FindOne(
Database& db,
int character_leadership_abilities_id int character_leadership_abilities_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -149,10 +150,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int character_leadership_abilities_id int character_leadership_abilities_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -165,6 +167,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
CharacterLeadershipAbilities character_leadership_abilities_entry CharacterLeadershipAbilities character_leadership_abilities_entry
) )
{ {
@ -176,7 +179,7 @@ public:
update_values.push_back(columns[1] + " = " + std::to_string(character_leadership_abilities_entry.slot)); update_values.push_back(columns[1] + " = " + std::to_string(character_leadership_abilities_entry.slot));
update_values.push_back(columns[2] + " = " + std::to_string(character_leadership_abilities_entry.rank)); update_values.push_back(columns[2] + " = " + std::to_string(character_leadership_abilities_entry.rank));
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -190,6 +193,7 @@ public:
} }
static CharacterLeadershipAbilities InsertOne( static CharacterLeadershipAbilities InsertOne(
Database& db,
CharacterLeadershipAbilities character_leadership_abilities_entry CharacterLeadershipAbilities character_leadership_abilities_entry
) )
{ {
@ -218,6 +222,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<CharacterLeadershipAbilities> character_leadership_abilities_entries std::vector<CharacterLeadershipAbilities> character_leadership_abilities_entries
) )
{ {
@ -235,7 +240,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -246,11 +251,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<CharacterLeadershipAbilities> All() static std::vector<CharacterLeadershipAbilities> All(Database& db)
{ {
std::vector<CharacterLeadershipAbilities> all_entries; std::vector<CharacterLeadershipAbilities> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -272,11 +277,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<CharacterLeadershipAbilities> GetWhere(std::string where_filter) static std::vector<CharacterLeadershipAbilities> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<CharacterLeadershipAbilities> all_entries; std::vector<CharacterLeadershipAbilities> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -299,9 +304,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -312,9 +317,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -135,10 +135,11 @@ public:
} }
static CharacterMaterial FindOne( static CharacterMaterial FindOne(
Database& db,
int character_material_id int character_material_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -165,10 +166,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int character_material_id int character_material_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -181,6 +183,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
CharacterMaterial character_material_entry CharacterMaterial character_material_entry
) )
{ {
@ -195,7 +198,7 @@ public:
update_values.push_back(columns[5] + " = " + std::to_string(character_material_entry.use_tint)); update_values.push_back(columns[5] + " = " + std::to_string(character_material_entry.use_tint));
update_values.push_back(columns[6] + " = " + std::to_string(character_material_entry.color)); update_values.push_back(columns[6] + " = " + std::to_string(character_material_entry.color));
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -209,6 +212,7 @@ public:
} }
static CharacterMaterial InsertOne( static CharacterMaterial InsertOne(
Database& db,
CharacterMaterial character_material_entry CharacterMaterial character_material_entry
) )
{ {
@ -240,6 +244,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<CharacterMaterial> character_material_entries std::vector<CharacterMaterial> character_material_entries
) )
{ {
@ -260,7 +265,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -271,11 +276,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<CharacterMaterial> All() static std::vector<CharacterMaterial> All(Database& db)
{ {
std::vector<CharacterMaterial> all_entries; std::vector<CharacterMaterial> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -301,11 +306,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<CharacterMaterial> GetWhere(std::string where_filter) static std::vector<CharacterMaterial> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<CharacterMaterial> all_entries; std::vector<CharacterMaterial> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -332,9 +337,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -345,9 +350,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -123,10 +123,11 @@ public:
} }
static CharacterMemmedSpells FindOne( static CharacterMemmedSpells FindOne(
Database& db,
int character_memmed_spells_id int character_memmed_spells_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -149,10 +150,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int character_memmed_spells_id int character_memmed_spells_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -165,6 +167,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
CharacterMemmedSpells character_memmed_spells_entry CharacterMemmedSpells character_memmed_spells_entry
) )
{ {
@ -176,7 +179,7 @@ public:
update_values.push_back(columns[1] + " = " + std::to_string(character_memmed_spells_entry.slot_id)); update_values.push_back(columns[1] + " = " + std::to_string(character_memmed_spells_entry.slot_id));
update_values.push_back(columns[2] + " = " + std::to_string(character_memmed_spells_entry.spell_id)); update_values.push_back(columns[2] + " = " + std::to_string(character_memmed_spells_entry.spell_id));
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -190,6 +193,7 @@ public:
} }
static CharacterMemmedSpells InsertOne( static CharacterMemmedSpells InsertOne(
Database& db,
CharacterMemmedSpells character_memmed_spells_entry CharacterMemmedSpells character_memmed_spells_entry
) )
{ {
@ -218,6 +222,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<CharacterMemmedSpells> character_memmed_spells_entries std::vector<CharacterMemmedSpells> character_memmed_spells_entries
) )
{ {
@ -235,7 +240,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -246,11 +251,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<CharacterMemmedSpells> All() static std::vector<CharacterMemmedSpells> All(Database& db)
{ {
std::vector<CharacterMemmedSpells> all_entries; std::vector<CharacterMemmedSpells> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -272,11 +277,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<CharacterMemmedSpells> GetWhere(std::string where_filter) static std::vector<CharacterMemmedSpells> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<CharacterMemmedSpells> all_entries; std::vector<CharacterMemmedSpells> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -299,9 +304,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -312,9 +317,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -147,10 +147,11 @@ public:
} }
static CharacterPetBuffs FindOne( static CharacterPetBuffs FindOne(
Database& db,
int character_pet_buffs_id int character_pet_buffs_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -181,10 +182,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int character_pet_buffs_id int character_pet_buffs_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -197,6 +199,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
CharacterPetBuffs character_pet_buffs_entry CharacterPetBuffs character_pet_buffs_entry
) )
{ {
@ -216,7 +219,7 @@ public:
update_values.push_back(columns[9] + " = " + std::to_string(character_pet_buffs_entry.rune)); update_values.push_back(columns[9] + " = " + std::to_string(character_pet_buffs_entry.rune));
update_values.push_back(columns[10] + " = " + std::to_string(character_pet_buffs_entry.instrument_mod)); update_values.push_back(columns[10] + " = " + std::to_string(character_pet_buffs_entry.instrument_mod));
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -230,6 +233,7 @@ public:
} }
static CharacterPetBuffs InsertOne( static CharacterPetBuffs InsertOne(
Database& db,
CharacterPetBuffs character_pet_buffs_entry CharacterPetBuffs character_pet_buffs_entry
) )
{ {
@ -266,6 +270,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<CharacterPetBuffs> character_pet_buffs_entries std::vector<CharacterPetBuffs> character_pet_buffs_entries
) )
{ {
@ -291,7 +296,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -302,11 +307,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<CharacterPetBuffs> All() static std::vector<CharacterPetBuffs> All(Database& db)
{ {
std::vector<CharacterPetBuffs> all_entries; std::vector<CharacterPetBuffs> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -336,11 +341,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<CharacterPetBuffs> GetWhere(std::string where_filter) static std::vector<CharacterPetBuffs> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<CharacterPetBuffs> all_entries; std::vector<CharacterPetBuffs> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -371,9 +376,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -384,9 +389,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -141,10 +141,11 @@ public:
} }
static CharacterPetInfo FindOne( static CharacterPetInfo FindOne(
Database& db,
int character_pet_info_id int character_pet_info_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -173,10 +174,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int character_pet_info_id int character_pet_info_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -189,6 +191,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
CharacterPetInfo character_pet_info_entry CharacterPetInfo character_pet_info_entry
) )
{ {
@ -206,7 +209,7 @@ public:
update_values.push_back(columns[7] + " = " + std::to_string(character_pet_info_entry.size)); update_values.push_back(columns[7] + " = " + std::to_string(character_pet_info_entry.size));
update_values.push_back(columns[8] + " = " + std::to_string(character_pet_info_entry.taunting)); update_values.push_back(columns[8] + " = " + std::to_string(character_pet_info_entry.taunting));
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -220,6 +223,7 @@ public:
} }
static CharacterPetInfo InsertOne( static CharacterPetInfo InsertOne(
Database& db,
CharacterPetInfo character_pet_info_entry CharacterPetInfo character_pet_info_entry
) )
{ {
@ -254,6 +258,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<CharacterPetInfo> character_pet_info_entries std::vector<CharacterPetInfo> character_pet_info_entries
) )
{ {
@ -277,7 +282,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -288,11 +293,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<CharacterPetInfo> All() static std::vector<CharacterPetInfo> All(Database& db)
{ {
std::vector<CharacterPetInfo> all_entries; std::vector<CharacterPetInfo> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -320,11 +325,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<CharacterPetInfo> GetWhere(std::string where_filter) static std::vector<CharacterPetInfo> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<CharacterPetInfo> all_entries; std::vector<CharacterPetInfo> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -353,9 +358,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -366,9 +371,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -126,10 +126,11 @@ public:
} }
static CharacterPetInventory FindOne( static CharacterPetInventory FindOne(
Database& db,
int character_pet_inventory_id int character_pet_inventory_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -153,10 +154,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int character_pet_inventory_id int character_pet_inventory_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -169,6 +171,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
CharacterPetInventory character_pet_inventory_entry CharacterPetInventory character_pet_inventory_entry
) )
{ {
@ -181,7 +184,7 @@ public:
update_values.push_back(columns[2] + " = " + std::to_string(character_pet_inventory_entry.slot)); update_values.push_back(columns[2] + " = " + std::to_string(character_pet_inventory_entry.slot));
update_values.push_back(columns[3] + " = " + std::to_string(character_pet_inventory_entry.item_id)); update_values.push_back(columns[3] + " = " + std::to_string(character_pet_inventory_entry.item_id));
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -195,6 +198,7 @@ public:
} }
static CharacterPetInventory InsertOne( static CharacterPetInventory InsertOne(
Database& db,
CharacterPetInventory character_pet_inventory_entry CharacterPetInventory character_pet_inventory_entry
) )
{ {
@ -224,6 +228,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<CharacterPetInventory> character_pet_inventory_entries std::vector<CharacterPetInventory> character_pet_inventory_entries
) )
{ {
@ -242,7 +247,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -253,11 +258,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<CharacterPetInventory> All() static std::vector<CharacterPetInventory> All(Database& db)
{ {
std::vector<CharacterPetInventory> all_entries; std::vector<CharacterPetInventory> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -280,11 +285,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<CharacterPetInventory> GetWhere(std::string where_filter) static std::vector<CharacterPetInventory> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<CharacterPetInventory> all_entries; std::vector<CharacterPetInventory> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -308,9 +313,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -321,9 +326,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -126,10 +126,11 @@ public:
} }
static CharacterPotionbelt FindOne( static CharacterPotionbelt FindOne(
Database& db,
int character_potionbelt_id int character_potionbelt_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -153,10 +154,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int character_potionbelt_id int character_potionbelt_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -169,6 +171,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
CharacterPotionbelt character_potionbelt_entry CharacterPotionbelt character_potionbelt_entry
) )
{ {
@ -181,7 +184,7 @@ public:
update_values.push_back(columns[2] + " = " + std::to_string(character_potionbelt_entry.item_id)); update_values.push_back(columns[2] + " = " + std::to_string(character_potionbelt_entry.item_id));
update_values.push_back(columns[3] + " = " + std::to_string(character_potionbelt_entry.icon)); update_values.push_back(columns[3] + " = " + std::to_string(character_potionbelt_entry.icon));
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -195,6 +198,7 @@ public:
} }
static CharacterPotionbelt InsertOne( static CharacterPotionbelt InsertOne(
Database& db,
CharacterPotionbelt character_potionbelt_entry CharacterPotionbelt character_potionbelt_entry
) )
{ {
@ -224,6 +228,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<CharacterPotionbelt> character_potionbelt_entries std::vector<CharacterPotionbelt> character_potionbelt_entries
) )
{ {
@ -242,7 +247,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -253,11 +258,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<CharacterPotionbelt> All() static std::vector<CharacterPotionbelt> All(Database& db)
{ {
std::vector<CharacterPotionbelt> all_entries; std::vector<CharacterPotionbelt> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -280,11 +285,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<CharacterPotionbelt> GetWhere(std::string where_filter) static std::vector<CharacterPotionbelt> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<CharacterPotionbelt> all_entries; std::vector<CharacterPotionbelt> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -308,9 +313,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -321,9 +326,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -123,10 +123,11 @@ public:
} }
static CharacterSkills FindOne( static CharacterSkills FindOne(
Database& db,
int character_skills_id int character_skills_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -149,10 +150,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int character_skills_id int character_skills_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -165,6 +167,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
CharacterSkills character_skills_entry CharacterSkills character_skills_entry
) )
{ {
@ -175,7 +178,7 @@ public:
update_values.push_back(columns[1] + " = " + std::to_string(character_skills_entry.skill_id)); update_values.push_back(columns[1] + " = " + std::to_string(character_skills_entry.skill_id));
update_values.push_back(columns[2] + " = " + std::to_string(character_skills_entry.value)); update_values.push_back(columns[2] + " = " + std::to_string(character_skills_entry.value));
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -189,6 +192,7 @@ public:
} }
static CharacterSkills InsertOne( static CharacterSkills InsertOne(
Database& db,
CharacterSkills character_skills_entry CharacterSkills character_skills_entry
) )
{ {
@ -216,6 +220,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<CharacterSkills> character_skills_entries std::vector<CharacterSkills> character_skills_entries
) )
{ {
@ -232,7 +237,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -243,11 +248,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<CharacterSkills> All() static std::vector<CharacterSkills> All(Database& db)
{ {
std::vector<CharacterSkills> all_entries; std::vector<CharacterSkills> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -269,11 +274,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<CharacterSkills> GetWhere(std::string where_filter) static std::vector<CharacterSkills> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<CharacterSkills> all_entries; std::vector<CharacterSkills> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -296,9 +301,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -309,9 +314,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -123,10 +123,11 @@ public:
} }
static CharacterSpells FindOne( static CharacterSpells FindOne(
Database& db,
int character_spells_id int character_spells_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -149,10 +150,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int character_spells_id int character_spells_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -165,6 +167,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
CharacterSpells character_spells_entry CharacterSpells character_spells_entry
) )
{ {
@ -175,7 +178,7 @@ public:
update_values.push_back(columns[1] + " = " + std::to_string(character_spells_entry.slot_id)); update_values.push_back(columns[1] + " = " + std::to_string(character_spells_entry.slot_id));
update_values.push_back(columns[2] + " = " + std::to_string(character_spells_entry.spell_id)); update_values.push_back(columns[2] + " = " + std::to_string(character_spells_entry.spell_id));
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -189,6 +192,7 @@ public:
} }
static CharacterSpells InsertOne( static CharacterSpells InsertOne(
Database& db,
CharacterSpells character_spells_entry CharacterSpells character_spells_entry
) )
{ {
@ -216,6 +220,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<CharacterSpells> character_spells_entries std::vector<CharacterSpells> character_spells_entries
) )
{ {
@ -232,7 +237,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -243,11 +248,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<CharacterSpells> All() static std::vector<CharacterSpells> All(Database& db)
{ {
std::vector<CharacterSpells> all_entries; std::vector<CharacterSpells> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -269,11 +274,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<CharacterSpells> GetWhere(std::string where_filter) static std::vector<CharacterSpells> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<CharacterSpells> all_entries; std::vector<CharacterSpells> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -296,9 +301,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -309,9 +314,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -129,10 +129,11 @@ public:
} }
static CharacterTasks FindOne( static CharacterTasks FindOne(
Database& db,
int character_tasks_id int character_tasks_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -157,10 +158,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int character_tasks_id int character_tasks_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -173,6 +175,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
CharacterTasks character_tasks_entry CharacterTasks character_tasks_entry
) )
{ {
@ -186,7 +189,7 @@ public:
update_values.push_back(columns[3] + " = " + std::to_string(character_tasks_entry.type)); update_values.push_back(columns[3] + " = " + std::to_string(character_tasks_entry.type));
update_values.push_back(columns[4] + " = " + std::to_string(character_tasks_entry.acceptedtime)); update_values.push_back(columns[4] + " = " + std::to_string(character_tasks_entry.acceptedtime));
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -200,6 +203,7 @@ public:
} }
static CharacterTasks InsertOne( static CharacterTasks InsertOne(
Database& db,
CharacterTasks character_tasks_entry CharacterTasks character_tasks_entry
) )
{ {
@ -230,6 +234,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<CharacterTasks> character_tasks_entries std::vector<CharacterTasks> character_tasks_entries
) )
{ {
@ -249,7 +254,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -260,11 +265,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<CharacterTasks> All() static std::vector<CharacterTasks> All(Database& db)
{ {
std::vector<CharacterTasks> all_entries; std::vector<CharacterTasks> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -288,11 +293,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<CharacterTasks> GetWhere(std::string where_filter) static std::vector<CharacterTasks> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<CharacterTasks> all_entries; std::vector<CharacterTasks> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -317,9 +322,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -330,9 +335,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -126,10 +126,11 @@ public:
} }
static CompletedTasks FindOne( static CompletedTasks FindOne(
Database& db,
int completed_tasks_id int completed_tasks_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -153,10 +154,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int completed_tasks_id int completed_tasks_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -169,6 +171,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
CompletedTasks completed_tasks_entry CompletedTasks completed_tasks_entry
) )
{ {
@ -181,7 +184,7 @@ public:
update_values.push_back(columns[2] + " = " + std::to_string(completed_tasks_entry.taskid)); update_values.push_back(columns[2] + " = " + std::to_string(completed_tasks_entry.taskid));
update_values.push_back(columns[3] + " = " + std::to_string(completed_tasks_entry.activityid)); update_values.push_back(columns[3] + " = " + std::to_string(completed_tasks_entry.activityid));
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -195,6 +198,7 @@ public:
} }
static CompletedTasks InsertOne( static CompletedTasks InsertOne(
Database& db,
CompletedTasks completed_tasks_entry CompletedTasks completed_tasks_entry
) )
{ {
@ -224,6 +228,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<CompletedTasks> completed_tasks_entries std::vector<CompletedTasks> completed_tasks_entries
) )
{ {
@ -242,7 +247,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -253,11 +258,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<CompletedTasks> All() static std::vector<CompletedTasks> All(Database& db)
{ {
std::vector<CompletedTasks> all_entries; std::vector<CompletedTasks> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -280,11 +285,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<CompletedTasks> GetWhere(std::string where_filter) static std::vector<CompletedTasks> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<CompletedTasks> all_entries; std::vector<CompletedTasks> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -308,9 +313,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -321,9 +326,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -126,10 +126,11 @@ public:
} }
static ContentFlags FindOne( static ContentFlags FindOne(
Database& db,
int content_flags_id int content_flags_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -153,10 +154,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int content_flags_id int content_flags_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -169,6 +171,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
ContentFlags content_flags_entry ContentFlags content_flags_entry
) )
{ {
@ -180,7 +183,7 @@ public:
update_values.push_back(columns[2] + " = " + std::to_string(content_flags_entry.enabled)); update_values.push_back(columns[2] + " = " + std::to_string(content_flags_entry.enabled));
update_values.push_back(columns[3] + " = '" + EscapeString(content_flags_entry.notes) + "'"); update_values.push_back(columns[3] + " = '" + EscapeString(content_flags_entry.notes) + "'");
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -194,6 +197,7 @@ public:
} }
static ContentFlags InsertOne( static ContentFlags InsertOne(
Database& db,
ContentFlags content_flags_entry ContentFlags content_flags_entry
) )
{ {
@ -222,6 +226,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<ContentFlags> content_flags_entries std::vector<ContentFlags> content_flags_entries
) )
{ {
@ -239,7 +244,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -250,11 +255,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<ContentFlags> All() static std::vector<ContentFlags> All(Database& db)
{ {
std::vector<ContentFlags> all_entries; std::vector<ContentFlags> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -277,11 +282,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<ContentFlags> GetWhere(std::string where_filter) static std::vector<ContentFlags> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<ContentFlags> all_entries; std::vector<ContentFlags> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -305,9 +310,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -318,9 +323,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -120,10 +120,11 @@ public:
} }
static Damageshieldtypes FindOne( static Damageshieldtypes FindOne(
Database& db,
int damageshieldtypes_id int damageshieldtypes_id
) )
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -145,10 +146,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int damageshieldtypes_id int damageshieldtypes_id
) )
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -161,6 +163,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
Damageshieldtypes damageshieldtypes_entry Damageshieldtypes damageshieldtypes_entry
) )
{ {
@ -171,7 +174,7 @@ public:
update_values.push_back(columns[0] + " = " + std::to_string(damageshieldtypes_entry.spellid)); update_values.push_back(columns[0] + " = " + std::to_string(damageshieldtypes_entry.spellid));
update_values.push_back(columns[1] + " = " + std::to_string(damageshieldtypes_entry.type)); update_values.push_back(columns[1] + " = " + std::to_string(damageshieldtypes_entry.type));
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -185,6 +188,7 @@ public:
} }
static Damageshieldtypes InsertOne( static Damageshieldtypes InsertOne(
Database& db,
Damageshieldtypes damageshieldtypes_entry Damageshieldtypes damageshieldtypes_entry
) )
{ {
@ -212,6 +216,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<Damageshieldtypes> damageshieldtypes_entries std::vector<Damageshieldtypes> damageshieldtypes_entries
) )
{ {
@ -228,7 +233,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -239,11 +244,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<Damageshieldtypes> All() static std::vector<Damageshieldtypes> All(Database& db)
{ {
std::vector<Damageshieldtypes> all_entries; std::vector<Damageshieldtypes> all_entries;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -264,11 +269,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<Damageshieldtypes> GetWhere(std::string where_filter) static std::vector<Damageshieldtypes> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<Damageshieldtypes> all_entries; std::vector<Damageshieldtypes> all_entries;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -290,9 +295,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -303,9 +308,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -126,10 +126,11 @@ public:
} }
static DataBuckets FindOne( static DataBuckets FindOne(
Database& db,
int data_buckets_id int data_buckets_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -153,10 +154,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int data_buckets_id int data_buckets_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -169,6 +171,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
DataBuckets data_buckets_entry DataBuckets data_buckets_entry
) )
{ {
@ -180,7 +183,7 @@ public:
update_values.push_back(columns[2] + " = '" + EscapeString(data_buckets_entry.value) + "'"); update_values.push_back(columns[2] + " = '" + EscapeString(data_buckets_entry.value) + "'");
update_values.push_back(columns[3] + " = " + std::to_string(data_buckets_entry.expires)); update_values.push_back(columns[3] + " = " + std::to_string(data_buckets_entry.expires));
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -194,6 +197,7 @@ public:
} }
static DataBuckets InsertOne( static DataBuckets InsertOne(
Database& db,
DataBuckets data_buckets_entry DataBuckets data_buckets_entry
) )
{ {
@ -222,6 +226,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<DataBuckets> data_buckets_entries std::vector<DataBuckets> data_buckets_entries
) )
{ {
@ -239,7 +244,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -250,11 +255,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<DataBuckets> All() static std::vector<DataBuckets> All(Database& db)
{ {
std::vector<DataBuckets> all_entries; std::vector<DataBuckets> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -277,11 +282,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<DataBuckets> GetWhere(std::string where_filter) static std::vector<DataBuckets> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<DataBuckets> all_entries; std::vector<DataBuckets> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -305,9 +310,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -318,9 +323,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -123,10 +123,11 @@ public:
} }
static DbStr FindOne( static DbStr FindOne(
Database& db,
int db_str_id int db_str_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -149,10 +150,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int db_str_id int db_str_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -165,6 +167,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
DbStr db_str_entry DbStr db_str_entry
) )
{ {
@ -176,7 +179,7 @@ public:
update_values.push_back(columns[1] + " = " + std::to_string(db_str_entry.type)); update_values.push_back(columns[1] + " = " + std::to_string(db_str_entry.type));
update_values.push_back(columns[2] + " = '" + EscapeString(db_str_entry.value) + "'"); update_values.push_back(columns[2] + " = '" + EscapeString(db_str_entry.value) + "'");
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -190,6 +193,7 @@ public:
} }
static DbStr InsertOne( static DbStr InsertOne(
Database& db,
DbStr db_str_entry DbStr db_str_entry
) )
{ {
@ -218,6 +222,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<DbStr> db_str_entries std::vector<DbStr> db_str_entries
) )
{ {
@ -235,7 +240,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -246,11 +251,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<DbStr> All() static std::vector<DbStr> All(Database& db)
{ {
std::vector<DbStr> all_entries; std::vector<DbStr> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -272,11 +277,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<DbStr> GetWhere(std::string where_filter) static std::vector<DbStr> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<DbStr> all_entries; std::vector<DbStr> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -299,9 +304,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -312,9 +317,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -126,10 +126,11 @@ public:
} }
static DiscoveredItems FindOne( static DiscoveredItems FindOne(
Database& db,
int discovered_items_id int discovered_items_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -153,10 +154,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int discovered_items_id int discovered_items_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -169,6 +171,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
DiscoveredItems discovered_items_entry DiscoveredItems discovered_items_entry
) )
{ {
@ -181,7 +184,7 @@ public:
update_values.push_back(columns[2] + " = " + std::to_string(discovered_items_entry.discovered_date)); update_values.push_back(columns[2] + " = " + std::to_string(discovered_items_entry.discovered_date));
update_values.push_back(columns[3] + " = " + std::to_string(discovered_items_entry.account_status)); update_values.push_back(columns[3] + " = " + std::to_string(discovered_items_entry.account_status));
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -195,6 +198,7 @@ public:
} }
static DiscoveredItems InsertOne( static DiscoveredItems InsertOne(
Database& db,
DiscoveredItems discovered_items_entry DiscoveredItems discovered_items_entry
) )
{ {
@ -224,6 +228,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<DiscoveredItems> discovered_items_entries std::vector<DiscoveredItems> discovered_items_entries
) )
{ {
@ -242,7 +247,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -253,11 +258,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<DiscoveredItems> All() static std::vector<DiscoveredItems> All(Database& db)
{ {
std::vector<DiscoveredItems> all_entries; std::vector<DiscoveredItems> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -280,11 +285,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<DiscoveredItems> GetWhere(std::string where_filter) static std::vector<DiscoveredItems> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<DiscoveredItems> all_entries; std::vector<DiscoveredItems> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -308,9 +313,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -321,9 +326,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -219,10 +219,11 @@ public:
} }
static Doors FindOne( static Doors FindOne(
Database& db,
int doors_id int doors_id
) )
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -277,10 +278,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int doors_id int doors_id
) )
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -293,6 +295,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
Doors doors_entry Doors doors_entry
) )
{ {
@ -335,7 +338,7 @@ public:
update_values.push_back(columns[33] + " = '" + EscapeString(doors_entry.content_flags) + "'"); update_values.push_back(columns[33] + " = '" + EscapeString(doors_entry.content_flags) + "'");
update_values.push_back(columns[34] + " = '" + EscapeString(doors_entry.content_flags_disabled) + "'"); update_values.push_back(columns[34] + " = '" + EscapeString(doors_entry.content_flags_disabled) + "'");
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -349,6 +352,7 @@ public:
} }
static Doors InsertOne( static Doors InsertOne(
Database& db,
Doors doors_entry Doors doors_entry
) )
{ {
@ -408,6 +412,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<Doors> doors_entries std::vector<Doors> doors_entries
) )
{ {
@ -456,7 +461,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -467,11 +472,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<Doors> All() static std::vector<Doors> All(Database& db)
{ {
std::vector<Doors> all_entries; std::vector<Doors> all_entries;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -525,11 +530,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<Doors> GetWhere(std::string where_filter) static std::vector<Doors> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<Doors> all_entries; std::vector<Doors> all_entries;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -584,9 +589,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -597,9 +602,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -165,10 +165,11 @@ public:
} }
static DynamicZones FindOne( static DynamicZones FindOne(
Database& db,
int dynamic_zones_id int dynamic_zones_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -205,10 +206,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int dynamic_zones_id int dynamic_zones_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -221,6 +223,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
DynamicZones dynamic_zones_entry DynamicZones dynamic_zones_entry
) )
{ {
@ -245,7 +248,7 @@ public:
update_values.push_back(columns[15] + " = " + std::to_string(dynamic_zones_entry.zone_in_heading)); update_values.push_back(columns[15] + " = " + std::to_string(dynamic_zones_entry.zone_in_heading));
update_values.push_back(columns[16] + " = " + std::to_string(dynamic_zones_entry.has_zone_in)); update_values.push_back(columns[16] + " = " + std::to_string(dynamic_zones_entry.has_zone_in));
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -259,6 +262,7 @@ public:
} }
static DynamicZones InsertOne( static DynamicZones InsertOne(
Database& db,
DynamicZones dynamic_zones_entry DynamicZones dynamic_zones_entry
) )
{ {
@ -300,6 +304,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<DynamicZones> dynamic_zones_entries std::vector<DynamicZones> dynamic_zones_entries
) )
{ {
@ -330,7 +335,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -341,11 +346,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<DynamicZones> All() static std::vector<DynamicZones> All(Database& db)
{ {
std::vector<DynamicZones> all_entries; std::vector<DynamicZones> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -381,11 +386,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<DynamicZones> GetWhere(std::string where_filter) static std::vector<DynamicZones> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<DynamicZones> all_entries; std::vector<DynamicZones> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -422,9 +427,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -435,9 +440,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -144,10 +144,11 @@ public:
} }
static Eventlog FindOne( static Eventlog FindOne(
Database& db,
int eventlog_id int eventlog_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -177,10 +178,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int eventlog_id int eventlog_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -193,6 +195,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
Eventlog eventlog_entry Eventlog eventlog_entry
) )
{ {
@ -210,7 +213,7 @@ public:
update_values.push_back(columns[8] + " = '" + EscapeString(eventlog_entry.description) + "'"); update_values.push_back(columns[8] + " = '" + EscapeString(eventlog_entry.description) + "'");
update_values.push_back(columns[9] + " = " + std::to_string(eventlog_entry.event_nid)); update_values.push_back(columns[9] + " = " + std::to_string(eventlog_entry.event_nid));
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -224,6 +227,7 @@ public:
} }
static Eventlog InsertOne( static Eventlog InsertOne(
Database& db,
Eventlog eventlog_entry Eventlog eventlog_entry
) )
{ {
@ -258,6 +262,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<Eventlog> eventlog_entries std::vector<Eventlog> eventlog_entries
) )
{ {
@ -281,7 +286,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -292,11 +297,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<Eventlog> All() static std::vector<Eventlog> All(Database& db)
{ {
std::vector<Eventlog> all_entries; std::vector<Eventlog> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -325,11 +330,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<Eventlog> GetWhere(std::string where_filter) static std::vector<Eventlog> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<Eventlog> all_entries; std::vector<Eventlog> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -359,9 +364,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -372,9 +377,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -132,10 +132,11 @@ public:
} }
static ExpeditionLockouts FindOne( static ExpeditionLockouts FindOne(
Database& db,
int expedition_lockouts_id int expedition_lockouts_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -161,10 +162,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int expedition_lockouts_id int expedition_lockouts_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -177,6 +179,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
ExpeditionLockouts expedition_lockouts_entry ExpeditionLockouts expedition_lockouts_entry
) )
{ {
@ -190,7 +193,7 @@ public:
update_values.push_back(columns[4] + " = " + std::to_string(expedition_lockouts_entry.duration)); update_values.push_back(columns[4] + " = " + std::to_string(expedition_lockouts_entry.duration));
update_values.push_back(columns[5] + " = '" + EscapeString(expedition_lockouts_entry.from_expedition_uuid) + "'"); update_values.push_back(columns[5] + " = '" + EscapeString(expedition_lockouts_entry.from_expedition_uuid) + "'");
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -204,6 +207,7 @@ public:
} }
static ExpeditionLockouts InsertOne( static ExpeditionLockouts InsertOne(
Database& db,
ExpeditionLockouts expedition_lockouts_entry ExpeditionLockouts expedition_lockouts_entry
) )
{ {
@ -234,6 +238,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<ExpeditionLockouts> expedition_lockouts_entries std::vector<ExpeditionLockouts> expedition_lockouts_entries
) )
{ {
@ -253,7 +258,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -264,11 +269,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<ExpeditionLockouts> All() static std::vector<ExpeditionLockouts> All(Database& db)
{ {
std::vector<ExpeditionLockouts> all_entries; std::vector<ExpeditionLockouts> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -293,11 +298,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<ExpeditionLockouts> GetWhere(std::string where_filter) static std::vector<ExpeditionLockouts> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<ExpeditionLockouts> all_entries; std::vector<ExpeditionLockouts> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -323,9 +328,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -336,9 +341,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -126,10 +126,11 @@ public:
} }
static ExpeditionMembers FindOne( static ExpeditionMembers FindOne(
Database& db,
int expedition_members_id int expedition_members_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -153,10 +154,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int expedition_members_id int expedition_members_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -169,6 +171,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
ExpeditionMembers expedition_members_entry ExpeditionMembers expedition_members_entry
) )
{ {
@ -180,7 +183,7 @@ public:
update_values.push_back(columns[2] + " = " + std::to_string(expedition_members_entry.character_id)); update_values.push_back(columns[2] + " = " + std::to_string(expedition_members_entry.character_id));
update_values.push_back(columns[3] + " = " + std::to_string(expedition_members_entry.is_current_member)); update_values.push_back(columns[3] + " = " + std::to_string(expedition_members_entry.is_current_member));
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -194,6 +197,7 @@ public:
} }
static ExpeditionMembers InsertOne( static ExpeditionMembers InsertOne(
Database& db,
ExpeditionMembers expedition_members_entry ExpeditionMembers expedition_members_entry
) )
{ {
@ -222,6 +226,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<ExpeditionMembers> expedition_members_entries std::vector<ExpeditionMembers> expedition_members_entries
) )
{ {
@ -239,7 +244,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -250,11 +255,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<ExpeditionMembers> All() static std::vector<ExpeditionMembers> All(Database& db)
{ {
std::vector<ExpeditionMembers> all_entries; std::vector<ExpeditionMembers> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -277,11 +282,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<ExpeditionMembers> GetWhere(std::string where_filter) static std::vector<ExpeditionMembers> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<ExpeditionMembers> all_entries; std::vector<ExpeditionMembers> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -305,9 +310,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -318,9 +323,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -141,10 +141,11 @@ public:
} }
static Expeditions FindOne( static Expeditions FindOne(
Database& db,
int expeditions_id int expeditions_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -173,10 +174,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int expeditions_id int expeditions_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -189,6 +191,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
Expeditions expeditions_entry Expeditions expeditions_entry
) )
{ {
@ -205,7 +208,7 @@ public:
update_values.push_back(columns[7] + " = " + std::to_string(expeditions_entry.add_replay_on_join)); update_values.push_back(columns[7] + " = " + std::to_string(expeditions_entry.add_replay_on_join));
update_values.push_back(columns[8] + " = " + std::to_string(expeditions_entry.is_locked)); update_values.push_back(columns[8] + " = " + std::to_string(expeditions_entry.is_locked));
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -219,6 +222,7 @@ public:
} }
static Expeditions InsertOne( static Expeditions InsertOne(
Database& db,
Expeditions expeditions_entry Expeditions expeditions_entry
) )
{ {
@ -252,6 +256,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<Expeditions> expeditions_entries std::vector<Expeditions> expeditions_entries
) )
{ {
@ -274,7 +279,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -285,11 +290,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<Expeditions> All() static std::vector<Expeditions> All(Database& db)
{ {
std::vector<Expeditions> all_entries; std::vector<Expeditions> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -317,11 +322,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<Expeditions> GetWhere(std::string where_filter) static std::vector<Expeditions> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<Expeditions> all_entries; std::vector<Expeditions> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -350,9 +355,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -363,9 +368,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -132,10 +132,11 @@ public:
} }
static FactionBaseData FindOne( static FactionBaseData FindOne(
Database& db,
int faction_base_data_id int faction_base_data_id
) )
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -161,10 +162,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int faction_base_data_id int faction_base_data_id
) )
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -177,6 +179,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
FactionBaseData faction_base_data_entry FactionBaseData faction_base_data_entry
) )
{ {
@ -191,7 +194,7 @@ public:
update_values.push_back(columns[4] + " = " + std::to_string(faction_base_data_entry.unk_hero2)); update_values.push_back(columns[4] + " = " + std::to_string(faction_base_data_entry.unk_hero2));
update_values.push_back(columns[5] + " = " + std::to_string(faction_base_data_entry.unk_hero3)); update_values.push_back(columns[5] + " = " + std::to_string(faction_base_data_entry.unk_hero3));
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -205,6 +208,7 @@ public:
} }
static FactionBaseData InsertOne( static FactionBaseData InsertOne(
Database& db,
FactionBaseData faction_base_data_entry FactionBaseData faction_base_data_entry
) )
{ {
@ -236,6 +240,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<FactionBaseData> faction_base_data_entries std::vector<FactionBaseData> faction_base_data_entries
) )
{ {
@ -256,7 +261,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -267,11 +272,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<FactionBaseData> All() static std::vector<FactionBaseData> All(Database& db)
{ {
std::vector<FactionBaseData> all_entries; std::vector<FactionBaseData> all_entries;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -296,11 +301,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<FactionBaseData> GetWhere(std::string where_filter) static std::vector<FactionBaseData> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<FactionBaseData> all_entries; std::vector<FactionBaseData> all_entries;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -326,9 +331,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -339,9 +344,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -126,10 +126,11 @@ public:
} }
static FactionListMod FindOne( static FactionListMod FindOne(
Database& db,
int faction_list_mod_id int faction_list_mod_id
) )
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -153,10 +154,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int faction_list_mod_id int faction_list_mod_id
) )
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -169,6 +171,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
FactionListMod faction_list_mod_entry FactionListMod faction_list_mod_entry
) )
{ {
@ -180,7 +183,7 @@ public:
update_values.push_back(columns[2] + " = " + std::to_string(faction_list_mod_entry.mod)); update_values.push_back(columns[2] + " = " + std::to_string(faction_list_mod_entry.mod));
update_values.push_back(columns[3] + " = '" + EscapeString(faction_list_mod_entry.mod_name) + "'"); update_values.push_back(columns[3] + " = '" + EscapeString(faction_list_mod_entry.mod_name) + "'");
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -194,6 +197,7 @@ public:
} }
static FactionListMod InsertOne( static FactionListMod InsertOne(
Database& db,
FactionListMod faction_list_mod_entry FactionListMod faction_list_mod_entry
) )
{ {
@ -222,6 +226,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<FactionListMod> faction_list_mod_entries std::vector<FactionListMod> faction_list_mod_entries
) )
{ {
@ -239,7 +244,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -250,11 +255,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<FactionListMod> All() static std::vector<FactionListMod> All(Database& db)
{ {
std::vector<FactionListMod> all_entries; std::vector<FactionListMod> all_entries;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -277,11 +282,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<FactionListMod> GetWhere(std::string where_filter) static std::vector<FactionListMod> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<FactionListMod> all_entries; std::vector<FactionListMod> all_entries;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -305,9 +310,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -318,9 +323,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -123,10 +123,11 @@ public:
} }
static FactionList FindOne( static FactionList FindOne(
Database& db,
int faction_list_id int faction_list_id
) )
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -149,10 +150,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int faction_list_id int faction_list_id
) )
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -165,6 +167,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
FactionList faction_list_entry FactionList faction_list_entry
) )
{ {
@ -176,7 +179,7 @@ public:
update_values.push_back(columns[1] + " = '" + EscapeString(faction_list_entry.name) + "'"); update_values.push_back(columns[1] + " = '" + EscapeString(faction_list_entry.name) + "'");
update_values.push_back(columns[2] + " = " + std::to_string(faction_list_entry.base)); update_values.push_back(columns[2] + " = " + std::to_string(faction_list_entry.base));
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -190,6 +193,7 @@ public:
} }
static FactionList InsertOne( static FactionList InsertOne(
Database& db,
FactionList faction_list_entry FactionList faction_list_entry
) )
{ {
@ -218,6 +222,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<FactionList> faction_list_entries std::vector<FactionList> faction_list_entries
) )
{ {
@ -235,7 +240,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -246,11 +251,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<FactionList> All() static std::vector<FactionList> All(Database& db)
{ {
std::vector<FactionList> all_entries; std::vector<FactionList> all_entries;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -272,11 +277,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<FactionList> GetWhere(std::string where_filter) static std::vector<FactionList> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<FactionList> all_entries; std::vector<FactionList> all_entries;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -299,9 +304,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -312,9 +317,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -126,10 +126,11 @@ public:
} }
static FactionValues FindOne( static FactionValues FindOne(
Database& db,
int faction_values_id int faction_values_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -153,10 +154,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int faction_values_id int faction_values_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -169,6 +171,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
FactionValues faction_values_entry FactionValues faction_values_entry
) )
{ {
@ -181,7 +184,7 @@ public:
update_values.push_back(columns[2] + " = " + std::to_string(faction_values_entry.current_value)); update_values.push_back(columns[2] + " = " + std::to_string(faction_values_entry.current_value));
update_values.push_back(columns[3] + " = " + std::to_string(faction_values_entry.temp)); update_values.push_back(columns[3] + " = " + std::to_string(faction_values_entry.temp));
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -195,6 +198,7 @@ public:
} }
static FactionValues InsertOne( static FactionValues InsertOne(
Database& db,
FactionValues faction_values_entry FactionValues faction_values_entry
) )
{ {
@ -224,6 +228,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<FactionValues> faction_values_entries std::vector<FactionValues> faction_values_entries
) )
{ {
@ -242,7 +247,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -253,11 +258,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<FactionValues> All() static std::vector<FactionValues> All(Database& db)
{ {
std::vector<FactionValues> all_entries; std::vector<FactionValues> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -280,11 +285,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<FactionValues> GetWhere(std::string where_filter) static std::vector<FactionValues> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<FactionValues> all_entries; std::vector<FactionValues> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -308,9 +313,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -321,9 +326,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -147,10 +147,11 @@ public:
} }
static Fishing FindOne( static Fishing FindOne(
Database& db,
int fishing_id int fishing_id
) )
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -181,10 +182,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int fishing_id int fishing_id
) )
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -197,6 +199,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
Fishing fishing_entry Fishing fishing_entry
) )
{ {
@ -215,7 +218,7 @@ public:
update_values.push_back(columns[9] + " = '" + EscapeString(fishing_entry.content_flags) + "'"); update_values.push_back(columns[9] + " = '" + EscapeString(fishing_entry.content_flags) + "'");
update_values.push_back(columns[10] + " = '" + EscapeString(fishing_entry.content_flags_disabled) + "'"); update_values.push_back(columns[10] + " = '" + EscapeString(fishing_entry.content_flags_disabled) + "'");
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -229,6 +232,7 @@ public:
} }
static Fishing InsertOne( static Fishing InsertOne(
Database& db,
Fishing fishing_entry Fishing fishing_entry
) )
{ {
@ -264,6 +268,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<Fishing> fishing_entries std::vector<Fishing> fishing_entries
) )
{ {
@ -288,7 +293,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -299,11 +304,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<Fishing> All() static std::vector<Fishing> All(Database& db)
{ {
std::vector<Fishing> all_entries; std::vector<Fishing> all_entries;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -333,11 +338,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<Fishing> GetWhere(std::string where_filter) static std::vector<Fishing> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<Fishing> all_entries; std::vector<Fishing> all_entries;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -368,9 +373,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -381,9 +386,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -141,10 +141,11 @@ public:
} }
static Forage FindOne( static Forage FindOne(
Database& db,
int forage_id int forage_id
) )
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -173,10 +174,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int forage_id int forage_id
) )
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -189,6 +191,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
Forage forage_entry Forage forage_entry
) )
{ {
@ -205,7 +208,7 @@ public:
update_values.push_back(columns[7] + " = '" + EscapeString(forage_entry.content_flags) + "'"); update_values.push_back(columns[7] + " = '" + EscapeString(forage_entry.content_flags) + "'");
update_values.push_back(columns[8] + " = '" + EscapeString(forage_entry.content_flags_disabled) + "'"); update_values.push_back(columns[8] + " = '" + EscapeString(forage_entry.content_flags_disabled) + "'");
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -219,6 +222,7 @@ public:
} }
static Forage InsertOne( static Forage InsertOne(
Database& db,
Forage forage_entry Forage forage_entry
) )
{ {
@ -252,6 +256,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<Forage> forage_entries std::vector<Forage> forage_entries
) )
{ {
@ -274,7 +279,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -285,11 +290,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<Forage> All() static std::vector<Forage> All(Database& db)
{ {
std::vector<Forage> all_entries; std::vector<Forage> all_entries;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -317,11 +322,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<Forage> GetWhere(std::string where_filter) static std::vector<Forage> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<Forage> all_entries; std::vector<Forage> all_entries;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -350,9 +355,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -363,9 +368,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -123,10 +123,11 @@ public:
} }
static Friends FindOne( static Friends FindOne(
Database& db,
int friends_id int friends_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -149,10 +150,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int friends_id int friends_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -165,6 +167,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
Friends friends_entry Friends friends_entry
) )
{ {
@ -176,7 +179,7 @@ public:
update_values.push_back(columns[1] + " = " + std::to_string(friends_entry.type)); update_values.push_back(columns[1] + " = " + std::to_string(friends_entry.type));
update_values.push_back(columns[2] + " = '" + EscapeString(friends_entry.name) + "'"); update_values.push_back(columns[2] + " = '" + EscapeString(friends_entry.name) + "'");
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -190,6 +193,7 @@ public:
} }
static Friends InsertOne( static Friends InsertOne(
Database& db,
Friends friends_entry Friends friends_entry
) )
{ {
@ -218,6 +222,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<Friends> friends_entries std::vector<Friends> friends_entries
) )
{ {
@ -235,7 +240,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -246,11 +251,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<Friends> All() static std::vector<Friends> All(Database& db)
{ {
std::vector<Friends> all_entries; std::vector<Friends> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -272,11 +277,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<Friends> GetWhere(std::string where_filter) static std::vector<Friends> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<Friends> all_entries; std::vector<Friends> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -299,9 +304,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -312,9 +317,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -165,10 +165,11 @@ public:
} }
static GlobalLoot FindOne( static GlobalLoot FindOne(
Database& db,
int global_loot_id int global_loot_id
) )
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -205,10 +206,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int global_loot_id int global_loot_id
) )
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -221,6 +223,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
GlobalLoot global_loot_entry GlobalLoot global_loot_entry
) )
{ {
@ -245,7 +248,7 @@ public:
update_values.push_back(columns[15] + " = '" + EscapeString(global_loot_entry.content_flags) + "'"); update_values.push_back(columns[15] + " = '" + EscapeString(global_loot_entry.content_flags) + "'");
update_values.push_back(columns[16] + " = '" + EscapeString(global_loot_entry.content_flags_disabled) + "'"); update_values.push_back(columns[16] + " = '" + EscapeString(global_loot_entry.content_flags_disabled) + "'");
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -259,6 +262,7 @@ public:
} }
static GlobalLoot InsertOne( static GlobalLoot InsertOne(
Database& db,
GlobalLoot global_loot_entry GlobalLoot global_loot_entry
) )
{ {
@ -300,6 +304,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<GlobalLoot> global_loot_entries std::vector<GlobalLoot> global_loot_entries
) )
{ {
@ -330,7 +335,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -341,11 +346,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<GlobalLoot> All() static std::vector<GlobalLoot> All(Database& db)
{ {
std::vector<GlobalLoot> all_entries; std::vector<GlobalLoot> all_entries;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -381,11 +386,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<GlobalLoot> GetWhere(std::string where_filter) static std::vector<GlobalLoot> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<GlobalLoot> all_entries; std::vector<GlobalLoot> all_entries;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -422,9 +427,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -435,9 +440,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -123,10 +123,11 @@ public:
} }
static GmIps FindOne( static GmIps FindOne(
Database& db,
int gm_ips_id int gm_ips_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -149,10 +150,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int gm_ips_id int gm_ips_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -165,6 +167,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
GmIps gm_ips_entry GmIps gm_ips_entry
) )
{ {
@ -176,7 +179,7 @@ public:
update_values.push_back(columns[1] + " = " + std::to_string(gm_ips_entry.account_id)); update_values.push_back(columns[1] + " = " + std::to_string(gm_ips_entry.account_id));
update_values.push_back(columns[2] + " = '" + EscapeString(gm_ips_entry.ip_address) + "'"); update_values.push_back(columns[2] + " = '" + EscapeString(gm_ips_entry.ip_address) + "'");
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -190,6 +193,7 @@ public:
} }
static GmIps InsertOne( static GmIps InsertOne(
Database& db,
GmIps gm_ips_entry GmIps gm_ips_entry
) )
{ {
@ -218,6 +222,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<GmIps> gm_ips_entries std::vector<GmIps> gm_ips_entries
) )
{ {
@ -235,7 +240,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -246,11 +251,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<GmIps> All() static std::vector<GmIps> All(Database& db)
{ {
std::vector<GmIps> all_entries; std::vector<GmIps> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -272,11 +277,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<GmIps> GetWhere(std::string where_filter) static std::vector<GmIps> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<GmIps> all_entries; std::vector<GmIps> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -299,9 +304,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -312,9 +317,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -120,10 +120,11 @@ public:
} }
static Goallists FindOne( static Goallists FindOne(
Database& db,
int goallists_id int goallists_id
) )
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -145,10 +146,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int goallists_id int goallists_id
) )
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -161,6 +163,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
Goallists goallists_entry Goallists goallists_entry
) )
{ {
@ -171,7 +174,7 @@ public:
update_values.push_back(columns[0] + " = " + std::to_string(goallists_entry.listid)); update_values.push_back(columns[0] + " = " + std::to_string(goallists_entry.listid));
update_values.push_back(columns[1] + " = " + std::to_string(goallists_entry.entry)); update_values.push_back(columns[1] + " = " + std::to_string(goallists_entry.entry));
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -185,6 +188,7 @@ public:
} }
static Goallists InsertOne( static Goallists InsertOne(
Database& db,
Goallists goallists_entry Goallists goallists_entry
) )
{ {
@ -212,6 +216,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<Goallists> goallists_entries std::vector<Goallists> goallists_entries
) )
{ {
@ -228,7 +233,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -239,11 +244,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<Goallists> All() static std::vector<Goallists> All(Database& db)
{ {
std::vector<Goallists> all_entries; std::vector<Goallists> all_entries;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -264,11 +269,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<Goallists> GetWhere(std::string where_filter) static std::vector<Goallists> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<Goallists> all_entries; std::vector<Goallists> all_entries;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -290,9 +295,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -303,9 +308,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -132,10 +132,11 @@ public:
} }
static Graveyard FindOne( static Graveyard FindOne(
Database& db,
int graveyard_id int graveyard_id
) )
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -161,10 +162,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int graveyard_id int graveyard_id
) )
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -177,6 +179,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
Graveyard graveyard_entry Graveyard graveyard_entry
) )
{ {
@ -190,7 +193,7 @@ public:
update_values.push_back(columns[4] + " = " + std::to_string(graveyard_entry.z)); update_values.push_back(columns[4] + " = " + std::to_string(graveyard_entry.z));
update_values.push_back(columns[5] + " = " + std::to_string(graveyard_entry.heading)); update_values.push_back(columns[5] + " = " + std::to_string(graveyard_entry.heading));
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -204,6 +207,7 @@ public:
} }
static Graveyard InsertOne( static Graveyard InsertOne(
Database& db,
Graveyard graveyard_entry Graveyard graveyard_entry
) )
{ {
@ -234,6 +238,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<Graveyard> graveyard_entries std::vector<Graveyard> graveyard_entries
) )
{ {
@ -253,7 +258,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -264,11 +269,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<Graveyard> All() static std::vector<Graveyard> All(Database& db)
{ {
std::vector<Graveyard> all_entries; std::vector<Graveyard> all_entries;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -293,11 +298,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<Graveyard> GetWhere(std::string where_filter) static std::vector<Graveyard> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<Graveyard> all_entries; std::vector<Graveyard> all_entries;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -323,9 +328,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -336,9 +341,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -168,10 +168,11 @@ public:
} }
static GroundSpawns FindOne( static GroundSpawns FindOne(
Database& db,
int ground_spawns_id int ground_spawns_id
) )
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -209,10 +210,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int ground_spawns_id int ground_spawns_id
) )
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -225,6 +227,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
GroundSpawns ground_spawns_entry GroundSpawns ground_spawns_entry
) )
{ {
@ -250,7 +253,7 @@ public:
update_values.push_back(columns[16] + " = '" + EscapeString(ground_spawns_entry.content_flags) + "'"); update_values.push_back(columns[16] + " = '" + EscapeString(ground_spawns_entry.content_flags) + "'");
update_values.push_back(columns[17] + " = '" + EscapeString(ground_spawns_entry.content_flags_disabled) + "'"); update_values.push_back(columns[17] + " = '" + EscapeString(ground_spawns_entry.content_flags_disabled) + "'");
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -264,6 +267,7 @@ public:
} }
static GroundSpawns InsertOne( static GroundSpawns InsertOne(
Database& db,
GroundSpawns ground_spawns_entry GroundSpawns ground_spawns_entry
) )
{ {
@ -306,6 +310,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<GroundSpawns> ground_spawns_entries std::vector<GroundSpawns> ground_spawns_entries
) )
{ {
@ -337,7 +342,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -348,11 +353,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<GroundSpawns> All() static std::vector<GroundSpawns> All(Database& db)
{ {
std::vector<GroundSpawns> all_entries; std::vector<GroundSpawns> all_entries;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -389,11 +394,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<GroundSpawns> GetWhere(std::string where_filter) static std::vector<GroundSpawns> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<GroundSpawns> all_entries; std::vector<GroundSpawns> all_entries;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -431,9 +436,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -444,9 +449,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -126,10 +126,11 @@ public:
} }
static GroupId FindOne( static GroupId FindOne(
Database& db,
int group_id_id int group_id_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -153,10 +154,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int group_id_id int group_id_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -169,6 +171,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
GroupId group_id_entry GroupId group_id_entry
) )
{ {
@ -181,7 +184,7 @@ public:
update_values.push_back(columns[2] + " = '" + EscapeString(group_id_entry.name) + "'"); update_values.push_back(columns[2] + " = '" + EscapeString(group_id_entry.name) + "'");
update_values.push_back(columns[3] + " = " + std::to_string(group_id_entry.ismerc)); update_values.push_back(columns[3] + " = " + std::to_string(group_id_entry.ismerc));
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -195,6 +198,7 @@ public:
} }
static GroupId InsertOne( static GroupId InsertOne(
Database& db,
GroupId group_id_entry GroupId group_id_entry
) )
{ {
@ -224,6 +228,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<GroupId> group_id_entries std::vector<GroupId> group_id_entries
) )
{ {
@ -242,7 +247,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -253,11 +258,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<GroupId> All() static std::vector<GroupId> All(Database& db)
{ {
std::vector<GroupId> all_entries; std::vector<GroupId> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -280,11 +285,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<GroupId> GetWhere(std::string where_filter) static std::vector<GroupId> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<GroupId> all_entries; std::vector<GroupId> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -308,9 +313,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -321,9 +326,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -141,10 +141,11 @@ public:
} }
static GroupLeaders FindOne( static GroupLeaders FindOne(
Database& db,
int group_leaders_id int group_leaders_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -173,10 +174,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int group_leaders_id int group_leaders_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -189,6 +191,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
GroupLeaders group_leaders_entry GroupLeaders group_leaders_entry
) )
{ {
@ -206,7 +209,7 @@ public:
update_values.push_back(columns[7] + " = '" + EscapeString(group_leaders_entry.mentoree) + "'"); update_values.push_back(columns[7] + " = '" + EscapeString(group_leaders_entry.mentoree) + "'");
update_values.push_back(columns[8] + " = " + std::to_string(group_leaders_entry.mentor_percent)); update_values.push_back(columns[8] + " = " + std::to_string(group_leaders_entry.mentor_percent));
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -220,6 +223,7 @@ public:
} }
static GroupLeaders InsertOne( static GroupLeaders InsertOne(
Database& db,
GroupLeaders group_leaders_entry GroupLeaders group_leaders_entry
) )
{ {
@ -254,6 +258,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<GroupLeaders> group_leaders_entries std::vector<GroupLeaders> group_leaders_entries
) )
{ {
@ -277,7 +282,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -288,11 +293,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<GroupLeaders> All() static std::vector<GroupLeaders> All(Database& db)
{ {
std::vector<GroupLeaders> all_entries; std::vector<GroupLeaders> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -320,11 +325,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<GroupLeaders> GetWhere(std::string where_filter) static std::vector<GroupLeaders> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<GroupLeaders> all_entries; std::vector<GroupLeaders> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -353,9 +358,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -366,9 +371,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -141,10 +141,11 @@ public:
} }
static GuildMembers FindOne( static GuildMembers FindOne(
Database& db,
int guild_members_id int guild_members_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -173,10 +174,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int guild_members_id int guild_members_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -189,6 +191,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
GuildMembers guild_members_entry GuildMembers guild_members_entry
) )
{ {
@ -206,7 +209,7 @@ public:
update_values.push_back(columns[7] + " = '" + EscapeString(guild_members_entry.public_note) + "'"); update_values.push_back(columns[7] + " = '" + EscapeString(guild_members_entry.public_note) + "'");
update_values.push_back(columns[8] + " = " + std::to_string(guild_members_entry.alt)); update_values.push_back(columns[8] + " = " + std::to_string(guild_members_entry.alt));
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -220,6 +223,7 @@ public:
} }
static GuildMembers InsertOne( static GuildMembers InsertOne(
Database& db,
GuildMembers guild_members_entry GuildMembers guild_members_entry
) )
{ {
@ -254,6 +258,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<GuildMembers> guild_members_entries std::vector<GuildMembers> guild_members_entries
) )
{ {
@ -277,7 +282,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -288,11 +293,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<GuildMembers> All() static std::vector<GuildMembers> All(Database& db)
{ {
std::vector<GuildMembers> all_entries; std::vector<GuildMembers> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -320,11 +325,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<GuildMembers> GetWhere(std::string where_filter) static std::vector<GuildMembers> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<GuildMembers> all_entries; std::vector<GuildMembers> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -353,9 +358,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -366,9 +371,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -147,10 +147,11 @@ public:
} }
static GuildRanks FindOne( static GuildRanks FindOne(
Database& db,
int guild_ranks_id int guild_ranks_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -181,10 +182,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int guild_ranks_id int guild_ranks_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -197,6 +199,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
GuildRanks guild_ranks_entry GuildRanks guild_ranks_entry
) )
{ {
@ -216,7 +219,7 @@ public:
update_values.push_back(columns[9] + " = " + std::to_string(guild_ranks_entry.can_motd)); update_values.push_back(columns[9] + " = " + std::to_string(guild_ranks_entry.can_motd));
update_values.push_back(columns[10] + " = " + std::to_string(guild_ranks_entry.can_warpeace)); update_values.push_back(columns[10] + " = " + std::to_string(guild_ranks_entry.can_warpeace));
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -230,6 +233,7 @@ public:
} }
static GuildRanks InsertOne( static GuildRanks InsertOne(
Database& db,
GuildRanks guild_ranks_entry GuildRanks guild_ranks_entry
) )
{ {
@ -266,6 +270,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<GuildRanks> guild_ranks_entries std::vector<GuildRanks> guild_ranks_entries
) )
{ {
@ -291,7 +296,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -302,11 +307,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<GuildRanks> All() static std::vector<GuildRanks> All(Database& db)
{ {
std::vector<GuildRanks> all_entries; std::vector<GuildRanks> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -336,11 +341,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<GuildRanks> GetWhere(std::string where_filter) static std::vector<GuildRanks> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<GuildRanks> all_entries; std::vector<GuildRanks> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -371,9 +376,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -384,9 +389,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -123,10 +123,11 @@ public:
} }
static GuildRelations FindOne( static GuildRelations FindOne(
Database& db,
int guild_relations_id int guild_relations_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -149,10 +150,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int guild_relations_id int guild_relations_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -165,6 +167,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
GuildRelations guild_relations_entry GuildRelations guild_relations_entry
) )
{ {
@ -176,7 +179,7 @@ public:
update_values.push_back(columns[1] + " = " + std::to_string(guild_relations_entry.guild2)); update_values.push_back(columns[1] + " = " + std::to_string(guild_relations_entry.guild2));
update_values.push_back(columns[2] + " = " + std::to_string(guild_relations_entry.relation)); update_values.push_back(columns[2] + " = " + std::to_string(guild_relations_entry.relation));
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -190,6 +193,7 @@ public:
} }
static GuildRelations InsertOne( static GuildRelations InsertOne(
Database& db,
GuildRelations guild_relations_entry GuildRelations guild_relations_entry
) )
{ {
@ -218,6 +222,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<GuildRelations> guild_relations_entries std::vector<GuildRelations> guild_relations_entries
) )
{ {
@ -235,7 +240,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -246,11 +251,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<GuildRelations> All() static std::vector<GuildRelations> All(Database& db)
{ {
std::vector<GuildRelations> all_entries; std::vector<GuildRelations> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -272,11 +277,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<GuildRelations> GetWhere(std::string where_filter) static std::vector<GuildRelations> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<GuildRelations> all_entries; std::vector<GuildRelations> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -299,9 +304,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -312,9 +317,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -141,10 +141,11 @@ public:
} }
static Guilds FindOne( static Guilds FindOne(
Database& db,
int guilds_id int guilds_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -173,10 +174,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int guilds_id int guilds_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -189,6 +191,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
Guilds guilds_entry Guilds guilds_entry
) )
{ {
@ -205,7 +208,7 @@ public:
update_values.push_back(columns[7] + " = '" + EscapeString(guilds_entry.channel) + "'"); update_values.push_back(columns[7] + " = '" + EscapeString(guilds_entry.channel) + "'");
update_values.push_back(columns[8] + " = '" + EscapeString(guilds_entry.url) + "'"); update_values.push_back(columns[8] + " = '" + EscapeString(guilds_entry.url) + "'");
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -219,6 +222,7 @@ public:
} }
static Guilds InsertOne( static Guilds InsertOne(
Database& db,
Guilds guilds_entry Guilds guilds_entry
) )
{ {
@ -252,6 +256,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<Guilds> guilds_entries std::vector<Guilds> guilds_entries
) )
{ {
@ -274,7 +279,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -285,11 +290,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<Guilds> All() static std::vector<Guilds> All(Database& db)
{ {
std::vector<Guilds> all_entries; std::vector<Guilds> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -317,11 +322,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<Guilds> GetWhere(std::string where_filter) static std::vector<Guilds> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<Guilds> all_entries; std::vector<Guilds> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -350,9 +355,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -363,9 +368,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -132,10 +132,11 @@ public:
} }
static Hackers FindOne( static Hackers FindOne(
Database& db,
int hackers_id int hackers_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -161,10 +162,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int hackers_id int hackers_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -177,6 +179,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
Hackers hackers_entry Hackers hackers_entry
) )
{ {
@ -190,7 +193,7 @@ public:
update_values.push_back(columns[4] + " = '" + EscapeString(hackers_entry.zone) + "'"); update_values.push_back(columns[4] + " = '" + EscapeString(hackers_entry.zone) + "'");
update_values.push_back(columns[5] + " = '" + EscapeString(hackers_entry.date) + "'"); update_values.push_back(columns[5] + " = '" + EscapeString(hackers_entry.date) + "'");
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -204,6 +207,7 @@ public:
} }
static Hackers InsertOne( static Hackers InsertOne(
Database& db,
Hackers hackers_entry Hackers hackers_entry
) )
{ {
@ -234,6 +238,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<Hackers> hackers_entries std::vector<Hackers> hackers_entries
) )
{ {
@ -253,7 +258,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -264,11 +269,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<Hackers> All() static std::vector<Hackers> All(Database& db)
{ {
std::vector<Hackers> all_entries; std::vector<Hackers> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -293,11 +298,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<Hackers> GetWhere(std::string where_filter) static std::vector<Hackers> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<Hackers> all_entries; std::vector<Hackers> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -323,9 +328,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -336,9 +341,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -120,10 +120,11 @@ public:
} }
static InstanceListPlayer FindOne( static InstanceListPlayer FindOne(
Database& db,
int instance_list_player_id int instance_list_player_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -145,10 +146,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int instance_list_player_id int instance_list_player_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -161,6 +163,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
InstanceListPlayer instance_list_player_entry InstanceListPlayer instance_list_player_entry
) )
{ {
@ -171,7 +174,7 @@ public:
update_values.push_back(columns[0] + " = " + std::to_string(instance_list_player_entry.id)); update_values.push_back(columns[0] + " = " + std::to_string(instance_list_player_entry.id));
update_values.push_back(columns[1] + " = " + std::to_string(instance_list_player_entry.charid)); update_values.push_back(columns[1] + " = " + std::to_string(instance_list_player_entry.charid));
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -185,6 +188,7 @@ public:
} }
static InstanceListPlayer InsertOne( static InstanceListPlayer InsertOne(
Database& db,
InstanceListPlayer instance_list_player_entry InstanceListPlayer instance_list_player_entry
) )
{ {
@ -212,6 +216,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<InstanceListPlayer> instance_list_player_entries std::vector<InstanceListPlayer> instance_list_player_entries
) )
{ {
@ -228,7 +233,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -239,11 +244,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<InstanceListPlayer> All() static std::vector<InstanceListPlayer> All(Database& db)
{ {
std::vector<InstanceListPlayer> all_entries; std::vector<InstanceListPlayer> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -264,11 +269,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<InstanceListPlayer> GetWhere(std::string where_filter) static std::vector<InstanceListPlayer> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<InstanceListPlayer> all_entries; std::vector<InstanceListPlayer> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -290,9 +295,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -303,9 +308,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -135,10 +135,11 @@ public:
} }
static InstanceList FindOne( static InstanceList FindOne(
Database& db,
int instance_list_id int instance_list_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -165,10 +166,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int instance_list_id int instance_list_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -181,6 +183,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
InstanceList instance_list_entry InstanceList instance_list_entry
) )
{ {
@ -195,7 +198,7 @@ public:
update_values.push_back(columns[5] + " = " + std::to_string(instance_list_entry.duration)); update_values.push_back(columns[5] + " = " + std::to_string(instance_list_entry.duration));
update_values.push_back(columns[6] + " = " + std::to_string(instance_list_entry.never_expires)); update_values.push_back(columns[6] + " = " + std::to_string(instance_list_entry.never_expires));
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -209,6 +212,7 @@ public:
} }
static InstanceList InsertOne( static InstanceList InsertOne(
Database& db,
InstanceList instance_list_entry InstanceList instance_list_entry
) )
{ {
@ -240,6 +244,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<InstanceList> instance_list_entries std::vector<InstanceList> instance_list_entries
) )
{ {
@ -260,7 +265,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -271,11 +276,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<InstanceList> All() static std::vector<InstanceList> All(Database& db)
{ {
std::vector<InstanceList> all_entries; std::vector<InstanceList> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -301,11 +306,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<InstanceList> GetWhere(std::string where_filter) static std::vector<InstanceList> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<InstanceList> all_entries; std::vector<InstanceList> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -332,9 +337,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -345,9 +350,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -162,10 +162,11 @@ public:
} }
static Inventory FindOne( static Inventory FindOne(
Database& db,
int inventory_id int inventory_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -201,10 +202,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int inventory_id int inventory_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -217,6 +219,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
Inventory inventory_entry Inventory inventory_entry
) )
{ {
@ -241,7 +244,7 @@ public:
update_values.push_back(columns[14] + " = " + std::to_string(inventory_entry.ornamentidfile)); update_values.push_back(columns[14] + " = " + std::to_string(inventory_entry.ornamentidfile));
update_values.push_back(columns[15] + " = " + std::to_string(inventory_entry.ornament_hero_model)); update_values.push_back(columns[15] + " = " + std::to_string(inventory_entry.ornament_hero_model));
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -255,6 +258,7 @@ public:
} }
static Inventory InsertOne( static Inventory InsertOne(
Database& db,
Inventory inventory_entry Inventory inventory_entry
) )
{ {
@ -296,6 +300,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<Inventory> inventory_entries std::vector<Inventory> inventory_entries
) )
{ {
@ -326,7 +331,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -337,11 +342,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<Inventory> All() static std::vector<Inventory> All(Database& db)
{ {
std::vector<Inventory> all_entries; std::vector<Inventory> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -376,11 +381,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<Inventory> GetWhere(std::string where_filter) static std::vector<Inventory> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<Inventory> all_entries; std::vector<Inventory> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -416,9 +421,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -429,9 +434,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -165,10 +165,11 @@ public:
} }
static InventorySnapshots FindOne( static InventorySnapshots FindOne(
Database& db,
int inventory_snapshots_id int inventory_snapshots_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -205,10 +206,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int inventory_snapshots_id int inventory_snapshots_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -221,6 +223,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
InventorySnapshots inventory_snapshots_entry InventorySnapshots inventory_snapshots_entry
) )
{ {
@ -246,7 +249,7 @@ public:
update_values.push_back(columns[15] + " = " + std::to_string(inventory_snapshots_entry.ornamentidfile)); update_values.push_back(columns[15] + " = " + std::to_string(inventory_snapshots_entry.ornamentidfile));
update_values.push_back(columns[16] + " = " + std::to_string(inventory_snapshots_entry.ornament_hero_model)); update_values.push_back(columns[16] + " = " + std::to_string(inventory_snapshots_entry.ornament_hero_model));
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -260,6 +263,7 @@ public:
} }
static InventorySnapshots InsertOne( static InventorySnapshots InsertOne(
Database& db,
InventorySnapshots inventory_snapshots_entry InventorySnapshots inventory_snapshots_entry
) )
{ {
@ -302,6 +306,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<InventorySnapshots> inventory_snapshots_entries std::vector<InventorySnapshots> inventory_snapshots_entries
) )
{ {
@ -333,7 +338,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -344,11 +349,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<InventorySnapshots> All() static std::vector<InventorySnapshots> All(Database& db)
{ {
std::vector<InventorySnapshots> all_entries; std::vector<InventorySnapshots> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -384,11 +389,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<InventorySnapshots> GetWhere(std::string where_filter) static std::vector<InventorySnapshots> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<InventorySnapshots> all_entries; std::vector<InventorySnapshots> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -425,9 +430,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -438,9 +443,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -123,10 +123,11 @@ public:
} }
static IpExemptions FindOne( static IpExemptions FindOne(
Database& db,
int ip_exemptions_id int ip_exemptions_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -149,10 +150,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int ip_exemptions_id int ip_exemptions_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -165,6 +167,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
IpExemptions ip_exemptions_entry IpExemptions ip_exemptions_entry
) )
{ {
@ -175,7 +178,7 @@ public:
update_values.push_back(columns[1] + " = '" + EscapeString(ip_exemptions_entry.exemption_ip) + "'"); update_values.push_back(columns[1] + " = '" + EscapeString(ip_exemptions_entry.exemption_ip) + "'");
update_values.push_back(columns[2] + " = " + std::to_string(ip_exemptions_entry.exemption_amount)); update_values.push_back(columns[2] + " = " + std::to_string(ip_exemptions_entry.exemption_amount));
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -189,6 +192,7 @@ public:
} }
static IpExemptions InsertOne( static IpExemptions InsertOne(
Database& db,
IpExemptions ip_exemptions_entry IpExemptions ip_exemptions_entry
) )
{ {
@ -216,6 +220,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<IpExemptions> ip_exemptions_entries std::vector<IpExemptions> ip_exemptions_entries
) )
{ {
@ -232,7 +237,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -243,11 +248,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<IpExemptions> All() static std::vector<IpExemptions> All(Database& db)
{ {
std::vector<IpExemptions> all_entries; std::vector<IpExemptions> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -269,11 +274,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<IpExemptions> GetWhere(std::string where_filter) static std::vector<IpExemptions> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<IpExemptions> all_entries; std::vector<IpExemptions> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -296,9 +301,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -309,9 +314,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -132,10 +132,11 @@ public:
} }
static ItemTick FindOne( static ItemTick FindOne(
Database& db,
int item_tick_id int item_tick_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -161,10 +162,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int item_tick_id int item_tick_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -177,6 +179,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
ItemTick item_tick_entry ItemTick item_tick_entry
) )
{ {
@ -190,7 +193,7 @@ public:
update_values.push_back(columns[4] + " = '" + EscapeString(item_tick_entry.it_qglobal) + "'"); update_values.push_back(columns[4] + " = '" + EscapeString(item_tick_entry.it_qglobal) + "'");
update_values.push_back(columns[5] + " = " + std::to_string(item_tick_entry.it_bagslot)); update_values.push_back(columns[5] + " = " + std::to_string(item_tick_entry.it_bagslot));
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -204,6 +207,7 @@ public:
} }
static ItemTick InsertOne( static ItemTick InsertOne(
Database& db,
ItemTick item_tick_entry ItemTick item_tick_entry
) )
{ {
@ -234,6 +238,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<ItemTick> item_tick_entries std::vector<ItemTick> item_tick_entries
) )
{ {
@ -253,7 +258,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -264,11 +269,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<ItemTick> All() static std::vector<ItemTick> All(Database& db)
{ {
std::vector<ItemTick> all_entries; std::vector<ItemTick> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -293,11 +298,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<ItemTick> GetWhere(std::string where_filter) static std::vector<ItemTick> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<ItemTick> all_entries; std::vector<ItemTick> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -323,9 +328,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -336,9 +341,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -969,10 +969,11 @@ public:
} }
static Items FindOne( static Items FindOne(
Database& db,
int items_id int items_id
) )
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -1277,10 +1278,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int items_id int items_id
) )
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -1293,6 +1295,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
Items items_entry Items items_entry
) )
{ {
@ -1586,7 +1589,7 @@ public:
update_values.push_back(columns[283] + " = " + std::to_string(items_entry.UNK241)); update_values.push_back(columns[283] + " = " + std::to_string(items_entry.UNK241));
update_values.push_back(columns[284] + " = " + std::to_string(items_entry.epicitem)); update_values.push_back(columns[284] + " = " + std::to_string(items_entry.epicitem));
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -1600,6 +1603,7 @@ public:
} }
static Items InsertOne( static Items InsertOne(
Database& db,
Items items_entry Items items_entry
) )
{ {
@ -1910,6 +1914,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<Items> items_entries std::vector<Items> items_entries
) )
{ {
@ -2209,7 +2214,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -2220,11 +2225,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<Items> All() static std::vector<Items> All(Database& db)
{ {
std::vector<Items> all_entries; std::vector<Items> all_entries;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -2528,11 +2533,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<Items> GetWhere(std::string where_filter) static std::vector<Items> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<Items> all_entries; std::vector<Items> all_entries;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -2837,9 +2842,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -2850,9 +2855,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -120,10 +120,11 @@ public:
} }
static LdonTrapEntries FindOne( static LdonTrapEntries FindOne(
Database& db,
int ldon_trap_entries_id int ldon_trap_entries_id
) )
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -145,10 +146,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int ldon_trap_entries_id int ldon_trap_entries_id
) )
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -161,6 +163,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
LdonTrapEntries ldon_trap_entries_entry LdonTrapEntries ldon_trap_entries_entry
) )
{ {
@ -171,7 +174,7 @@ public:
update_values.push_back(columns[0] + " = " + std::to_string(ldon_trap_entries_entry.id)); update_values.push_back(columns[0] + " = " + std::to_string(ldon_trap_entries_entry.id));
update_values.push_back(columns[1] + " = " + std::to_string(ldon_trap_entries_entry.trap_id)); update_values.push_back(columns[1] + " = " + std::to_string(ldon_trap_entries_entry.trap_id));
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -185,6 +188,7 @@ public:
} }
static LdonTrapEntries InsertOne( static LdonTrapEntries InsertOne(
Database& db,
LdonTrapEntries ldon_trap_entries_entry LdonTrapEntries ldon_trap_entries_entry
) )
{ {
@ -212,6 +216,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<LdonTrapEntries> ldon_trap_entries_entries std::vector<LdonTrapEntries> ldon_trap_entries_entries
) )
{ {
@ -228,7 +233,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -239,11 +244,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<LdonTrapEntries> All() static std::vector<LdonTrapEntries> All(Database& db)
{ {
std::vector<LdonTrapEntries> all_entries; std::vector<LdonTrapEntries> all_entries;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -264,11 +269,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<LdonTrapEntries> GetWhere(std::string where_filter) static std::vector<LdonTrapEntries> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<LdonTrapEntries> all_entries; std::vector<LdonTrapEntries> all_entries;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -290,9 +295,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -303,9 +308,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -129,10 +129,11 @@ public:
} }
static LdonTrapTemplates FindOne( static LdonTrapTemplates FindOne(
Database& db,
int ldon_trap_templates_id int ldon_trap_templates_id
) )
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -157,10 +158,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int ldon_trap_templates_id int ldon_trap_templates_id
) )
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -173,6 +175,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
LdonTrapTemplates ldon_trap_templates_entry LdonTrapTemplates ldon_trap_templates_entry
) )
{ {
@ -186,7 +189,7 @@ public:
update_values.push_back(columns[3] + " = " + std::to_string(ldon_trap_templates_entry.skill)); update_values.push_back(columns[3] + " = " + std::to_string(ldon_trap_templates_entry.skill));
update_values.push_back(columns[4] + " = " + std::to_string(ldon_trap_templates_entry.locked)); update_values.push_back(columns[4] + " = " + std::to_string(ldon_trap_templates_entry.locked));
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -200,6 +203,7 @@ public:
} }
static LdonTrapTemplates InsertOne( static LdonTrapTemplates InsertOne(
Database& db,
LdonTrapTemplates ldon_trap_templates_entry LdonTrapTemplates ldon_trap_templates_entry
) )
{ {
@ -230,6 +234,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<LdonTrapTemplates> ldon_trap_templates_entries std::vector<LdonTrapTemplates> ldon_trap_templates_entries
) )
{ {
@ -249,7 +254,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -260,11 +265,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<LdonTrapTemplates> All() static std::vector<LdonTrapTemplates> All(Database& db)
{ {
std::vector<LdonTrapTemplates> all_entries; std::vector<LdonTrapTemplates> all_entries;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -288,11 +293,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<LdonTrapTemplates> GetWhere(std::string where_filter) static std::vector<LdonTrapTemplates> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<LdonTrapTemplates> all_entries; std::vector<LdonTrapTemplates> all_entries;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -317,9 +322,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -330,9 +335,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -123,10 +123,11 @@ public:
} }
static LevelExpMods FindOne( static LevelExpMods FindOne(
Database& db,
int level_exp_mods_id int level_exp_mods_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -149,10 +150,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int level_exp_mods_id int level_exp_mods_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -165,6 +167,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
LevelExpMods level_exp_mods_entry LevelExpMods level_exp_mods_entry
) )
{ {
@ -176,7 +179,7 @@ public:
update_values.push_back(columns[1] + " = " + std::to_string(level_exp_mods_entry.exp_mod)); update_values.push_back(columns[1] + " = " + std::to_string(level_exp_mods_entry.exp_mod));
update_values.push_back(columns[2] + " = " + std::to_string(level_exp_mods_entry.aa_exp_mod)); update_values.push_back(columns[2] + " = " + std::to_string(level_exp_mods_entry.aa_exp_mod));
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -190,6 +193,7 @@ public:
} }
static LevelExpMods InsertOne( static LevelExpMods InsertOne(
Database& db,
LevelExpMods level_exp_mods_entry LevelExpMods level_exp_mods_entry
) )
{ {
@ -218,6 +222,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<LevelExpMods> level_exp_mods_entries std::vector<LevelExpMods> level_exp_mods_entries
) )
{ {
@ -235,7 +240,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -246,11 +251,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<LevelExpMods> All() static std::vector<LevelExpMods> All(Database& db)
{ {
std::vector<LevelExpMods> all_entries; std::vector<LevelExpMods> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -272,11 +277,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<LevelExpMods> GetWhere(std::string where_filter) static std::vector<LevelExpMods> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<LevelExpMods> all_entries; std::vector<LevelExpMods> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -299,9 +304,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -312,9 +317,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -141,10 +141,11 @@ public:
} }
static Lfguild FindOne( static Lfguild FindOne(
Database& db,
int lfguild_id int lfguild_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -173,10 +174,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int lfguild_id int lfguild_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -189,6 +191,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
Lfguild lfguild_entry Lfguild lfguild_entry
) )
{ {
@ -206,7 +209,7 @@ public:
update_values.push_back(columns[7] + " = " + std::to_string(lfguild_entry.timezone)); update_values.push_back(columns[7] + " = " + std::to_string(lfguild_entry.timezone));
update_values.push_back(columns[8] + " = " + std::to_string(lfguild_entry.timeposted)); update_values.push_back(columns[8] + " = " + std::to_string(lfguild_entry.timeposted));
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -220,6 +223,7 @@ public:
} }
static Lfguild InsertOne( static Lfguild InsertOne(
Database& db,
Lfguild lfguild_entry Lfguild lfguild_entry
) )
{ {
@ -254,6 +258,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<Lfguild> lfguild_entries std::vector<Lfguild> lfguild_entries
) )
{ {
@ -277,7 +282,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -288,11 +293,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<Lfguild> All() static std::vector<Lfguild> All(Database& db)
{ {
std::vector<Lfguild> all_entries; std::vector<Lfguild> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -320,11 +325,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<Lfguild> GetWhere(std::string where_filter) static std::vector<Lfguild> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<Lfguild> all_entries; std::vector<Lfguild> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -353,9 +358,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -366,9 +371,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -141,10 +141,11 @@ public:
} }
static LoginAccounts FindOne( static LoginAccounts FindOne(
Database& db,
int login_accounts_id int login_accounts_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -173,10 +174,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int login_accounts_id int login_accounts_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -189,6 +191,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
LoginAccounts login_accounts_entry LoginAccounts login_accounts_entry
) )
{ {
@ -206,7 +209,7 @@ public:
update_values.push_back(columns[7] + " = '" + EscapeString(login_accounts_entry.created_at) + "'"); update_values.push_back(columns[7] + " = '" + EscapeString(login_accounts_entry.created_at) + "'");
update_values.push_back(columns[8] + " = '" + EscapeString(login_accounts_entry.updated_at) + "'"); update_values.push_back(columns[8] + " = '" + EscapeString(login_accounts_entry.updated_at) + "'");
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -220,6 +223,7 @@ public:
} }
static LoginAccounts InsertOne( static LoginAccounts InsertOne(
Database& db,
LoginAccounts login_accounts_entry LoginAccounts login_accounts_entry
) )
{ {
@ -254,6 +258,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<LoginAccounts> login_accounts_entries std::vector<LoginAccounts> login_accounts_entries
) )
{ {
@ -277,7 +282,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -288,11 +293,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<LoginAccounts> All() static std::vector<LoginAccounts> All(Database& db)
{ {
std::vector<LoginAccounts> all_entries; std::vector<LoginAccounts> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -320,11 +325,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<LoginAccounts> GetWhere(std::string where_filter) static std::vector<LoginAccounts> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<LoginAccounts> all_entries; std::vector<LoginAccounts> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -353,9 +358,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -366,9 +371,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -132,10 +132,11 @@ public:
} }
static LoginApiTokens FindOne( static LoginApiTokens FindOne(
Database& db,
int login_api_tokens_id int login_api_tokens_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -161,10 +162,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int login_api_tokens_id int login_api_tokens_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -177,6 +179,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
LoginApiTokens login_api_tokens_entry LoginApiTokens login_api_tokens_entry
) )
{ {
@ -190,7 +193,7 @@ public:
update_values.push_back(columns[4] + " = '" + EscapeString(login_api_tokens_entry.created_at) + "'"); update_values.push_back(columns[4] + " = '" + EscapeString(login_api_tokens_entry.created_at) + "'");
update_values.push_back(columns[5] + " = '" + EscapeString(login_api_tokens_entry.updated_at) + "'"); update_values.push_back(columns[5] + " = '" + EscapeString(login_api_tokens_entry.updated_at) + "'");
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -204,6 +207,7 @@ public:
} }
static LoginApiTokens InsertOne( static LoginApiTokens InsertOne(
Database& db,
LoginApiTokens login_api_tokens_entry LoginApiTokens login_api_tokens_entry
) )
{ {
@ -234,6 +238,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<LoginApiTokens> login_api_tokens_entries std::vector<LoginApiTokens> login_api_tokens_entries
) )
{ {
@ -253,7 +258,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -264,11 +269,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<LoginApiTokens> All() static std::vector<LoginApiTokens> All(Database& db)
{ {
std::vector<LoginApiTokens> all_entries; std::vector<LoginApiTokens> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -293,11 +298,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<LoginApiTokens> GetWhere(std::string where_filter) static std::vector<LoginApiTokens> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<LoginApiTokens> all_entries; std::vector<LoginApiTokens> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -323,9 +328,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -336,9 +341,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -138,10 +138,11 @@ public:
} }
static LoginServerAdmins FindOne( static LoginServerAdmins FindOne(
Database& db,
int login_server_admins_id int login_server_admins_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -169,10 +170,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int login_server_admins_id int login_server_admins_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -185,6 +187,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
LoginServerAdmins login_server_admins_entry LoginServerAdmins login_server_admins_entry
) )
{ {
@ -200,7 +203,7 @@ public:
update_values.push_back(columns[6] + " = '" + EscapeString(login_server_admins_entry.registration_date) + "'"); update_values.push_back(columns[6] + " = '" + EscapeString(login_server_admins_entry.registration_date) + "'");
update_values.push_back(columns[7] + " = '" + EscapeString(login_server_admins_entry.registration_ip_address) + "'"); update_values.push_back(columns[7] + " = '" + EscapeString(login_server_admins_entry.registration_ip_address) + "'");
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -214,6 +217,7 @@ public:
} }
static LoginServerAdmins InsertOne( static LoginServerAdmins InsertOne(
Database& db,
LoginServerAdmins login_server_admins_entry LoginServerAdmins login_server_admins_entry
) )
{ {
@ -246,6 +250,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<LoginServerAdmins> login_server_admins_entries std::vector<LoginServerAdmins> login_server_admins_entries
) )
{ {
@ -267,7 +272,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -278,11 +283,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<LoginServerAdmins> All() static std::vector<LoginServerAdmins> All(Database& db)
{ {
std::vector<LoginServerAdmins> all_entries; std::vector<LoginServerAdmins> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -309,11 +314,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<LoginServerAdmins> GetWhere(std::string where_filter) static std::vector<LoginServerAdmins> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<LoginServerAdmins> all_entries; std::vector<LoginServerAdmins> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -341,9 +346,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -354,9 +359,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -120,10 +120,11 @@ public:
} }
static LoginServerListTypes FindOne( static LoginServerListTypes FindOne(
Database& db,
int login_server_list_types_id int login_server_list_types_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -145,10 +146,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int login_server_list_types_id int login_server_list_types_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -161,6 +163,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
LoginServerListTypes login_server_list_types_entry LoginServerListTypes login_server_list_types_entry
) )
{ {
@ -171,7 +174,7 @@ public:
update_values.push_back(columns[0] + " = " + std::to_string(login_server_list_types_entry.id)); update_values.push_back(columns[0] + " = " + std::to_string(login_server_list_types_entry.id));
update_values.push_back(columns[1] + " = '" + EscapeString(login_server_list_types_entry.description) + "'"); update_values.push_back(columns[1] + " = '" + EscapeString(login_server_list_types_entry.description) + "'");
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -185,6 +188,7 @@ public:
} }
static LoginServerListTypes InsertOne( static LoginServerListTypes InsertOne(
Database& db,
LoginServerListTypes login_server_list_types_entry LoginServerListTypes login_server_list_types_entry
) )
{ {
@ -212,6 +216,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<LoginServerListTypes> login_server_list_types_entries std::vector<LoginServerListTypes> login_server_list_types_entries
) )
{ {
@ -228,7 +233,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -239,11 +244,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<LoginServerListTypes> All() static std::vector<LoginServerListTypes> All(Database& db)
{ {
std::vector<LoginServerListTypes> all_entries; std::vector<LoginServerListTypes> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -264,11 +269,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<LoginServerListTypes> GetWhere(std::string where_filter) static std::vector<LoginServerListTypes> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<LoginServerListTypes> all_entries; std::vector<LoginServerListTypes> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -290,9 +295,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -303,9 +308,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -144,10 +144,11 @@ public:
} }
static LoginWorldServers FindOne( static LoginWorldServers FindOne(
Database& db,
int login_world_servers_id int login_world_servers_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -177,10 +178,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int login_world_servers_id int login_world_servers_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -193,6 +195,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
LoginWorldServers login_world_servers_entry LoginWorldServers login_world_servers_entry
) )
{ {
@ -210,7 +213,7 @@ public:
update_values.push_back(columns[8] + " = " + std::to_string(login_world_servers_entry.is_server_trusted)); update_values.push_back(columns[8] + " = " + std::to_string(login_world_servers_entry.is_server_trusted));
update_values.push_back(columns[9] + " = '" + EscapeString(login_world_servers_entry.note) + "'"); update_values.push_back(columns[9] + " = '" + EscapeString(login_world_servers_entry.note) + "'");
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -224,6 +227,7 @@ public:
} }
static LoginWorldServers InsertOne( static LoginWorldServers InsertOne(
Database& db,
LoginWorldServers login_world_servers_entry LoginWorldServers login_world_servers_entry
) )
{ {
@ -258,6 +262,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<LoginWorldServers> login_world_servers_entries std::vector<LoginWorldServers> login_world_servers_entries
) )
{ {
@ -281,7 +286,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -292,11 +297,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<LoginWorldServers> All() static std::vector<LoginWorldServers> All(Database& db)
{ {
std::vector<LoginWorldServers> all_entries; std::vector<LoginWorldServers> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -325,11 +330,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<LoginWorldServers> GetWhere(std::string where_filter) static std::vector<LoginWorldServers> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<LoginWorldServers> all_entries; std::vector<LoginWorldServers> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -359,9 +364,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -372,9 +377,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -129,10 +129,11 @@ public:
} }
static LogsysCategories FindOne( static LogsysCategories FindOne(
Database& db,
int logsys_categories_id int logsys_categories_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -157,10 +158,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int logsys_categories_id int logsys_categories_id
) )
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -173,6 +175,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
LogsysCategories logsys_categories_entry LogsysCategories logsys_categories_entry
) )
{ {
@ -186,7 +189,7 @@ public:
update_values.push_back(columns[3] + " = " + std::to_string(logsys_categories_entry.log_to_file)); update_values.push_back(columns[3] + " = " + std::to_string(logsys_categories_entry.log_to_file));
update_values.push_back(columns[4] + " = " + std::to_string(logsys_categories_entry.log_to_gmsay)); update_values.push_back(columns[4] + " = " + std::to_string(logsys_categories_entry.log_to_gmsay));
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -200,6 +203,7 @@ public:
} }
static LogsysCategories InsertOne( static LogsysCategories InsertOne(
Database& db,
LogsysCategories logsys_categories_entry LogsysCategories logsys_categories_entry
) )
{ {
@ -230,6 +234,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<LogsysCategories> logsys_categories_entries std::vector<LogsysCategories> logsys_categories_entries
) )
{ {
@ -249,7 +254,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -260,11 +265,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<LogsysCategories> All() static std::vector<LogsysCategories> All(Database& db)
{ {
std::vector<LogsysCategories> all_entries; std::vector<LogsysCategories> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -288,11 +293,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<LogsysCategories> GetWhere(std::string where_filter) static std::vector<LogsysCategories> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<LogsysCategories> all_entries; std::vector<LogsysCategories> all_entries;
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -317,9 +322,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -330,9 +335,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = database.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -147,10 +147,11 @@ public:
} }
static LootdropEntries FindOne( static LootdropEntries FindOne(
Database& db,
int lootdrop_entries_id int lootdrop_entries_id
) )
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -181,10 +182,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int lootdrop_entries_id int lootdrop_entries_id
) )
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -197,6 +199,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
LootdropEntries lootdrop_entries_entry LootdropEntries lootdrop_entries_entry
) )
{ {
@ -216,7 +219,7 @@ public:
update_values.push_back(columns[9] + " = " + std::to_string(lootdrop_entries_entry.npc_min_level)); update_values.push_back(columns[9] + " = " + std::to_string(lootdrop_entries_entry.npc_min_level));
update_values.push_back(columns[10] + " = " + std::to_string(lootdrop_entries_entry.npc_max_level)); update_values.push_back(columns[10] + " = " + std::to_string(lootdrop_entries_entry.npc_max_level));
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -230,6 +233,7 @@ public:
} }
static LootdropEntries InsertOne( static LootdropEntries InsertOne(
Database& db,
LootdropEntries lootdrop_entries_entry LootdropEntries lootdrop_entries_entry
) )
{ {
@ -266,6 +270,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<LootdropEntries> lootdrop_entries_entries std::vector<LootdropEntries> lootdrop_entries_entries
) )
{ {
@ -291,7 +296,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -302,11 +307,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<LootdropEntries> All() static std::vector<LootdropEntries> All(Database& db)
{ {
std::vector<LootdropEntries> all_entries; std::vector<LootdropEntries> all_entries;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -336,11 +341,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<LootdropEntries> GetWhere(std::string where_filter) static std::vector<LootdropEntries> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<LootdropEntries> all_entries; std::vector<LootdropEntries> all_entries;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -371,9 +376,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -384,9 +389,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

View File

@ -132,10 +132,11 @@ public:
} }
static Lootdrop FindOne( static Lootdrop FindOne(
Database& db,
int lootdrop_id int lootdrop_id
) )
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@ -161,10 +162,11 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int lootdrop_id int lootdrop_id
) )
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@ -177,6 +179,7 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
Lootdrop lootdrop_entry Lootdrop lootdrop_entry
) )
{ {
@ -190,7 +193,7 @@ public:
update_values.push_back(columns[4] + " = '" + EscapeString(lootdrop_entry.content_flags) + "'"); update_values.push_back(columns[4] + " = '" + EscapeString(lootdrop_entry.content_flags) + "'");
update_values.push_back(columns[5] + " = '" + EscapeString(lootdrop_entry.content_flags_disabled) + "'"); update_values.push_back(columns[5] + " = '" + EscapeString(lootdrop_entry.content_flags_disabled) + "'");
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@ -204,6 +207,7 @@ public:
} }
static Lootdrop InsertOne( static Lootdrop InsertOne(
Database& db,
Lootdrop lootdrop_entry Lootdrop lootdrop_entry
) )
{ {
@ -234,6 +238,7 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<Lootdrop> lootdrop_entries std::vector<Lootdrop> lootdrop_entries
) )
{ {
@ -253,7 +258,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@ -264,11 +269,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<Lootdrop> All() static std::vector<Lootdrop> All(Database& db)
{ {
std::vector<Lootdrop> all_entries; std::vector<Lootdrop> all_entries;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@ -293,11 +298,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<Lootdrop> GetWhere(std::string where_filter) static std::vector<Lootdrop> GetWhere(Database& db, std::string where_filter)
{ {
std::vector<Lootdrop> all_entries; std::vector<Lootdrop> all_entries;
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@ -323,9 +328,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(std::string where_filter) static int DeleteWhere(Database& db, std::string where_filter)
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@ -336,9 +341,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate() static int Truncate(Database& db)
{ {
auto results = content_db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

Some files were not shown because too many files have changed in this diff Show More