mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-26 11:27:17 +00:00
Explicitly pass database pointers to repository methods
This commit is contained in:
@@ -135,10 +135,11 @@ public:
|
||||
}
|
||||
|
||||
static CharacterMaterial FindOne(
|
||||
Database& db,
|
||||
int character_material_id
|
||||
)
|
||||
{
|
||||
auto results = database.QueryDatabase(
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
@@ -165,10 +166,11 @@ public:
|
||||
}
|
||||
|
||||
static int DeleteOne(
|
||||
Database& db,
|
||||
int character_material_id
|
||||
)
|
||||
{
|
||||
auto results = database.QueryDatabase(
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {} = {}",
|
||||
TableName(),
|
||||
@@ -181,6 +183,7 @@ public:
|
||||
}
|
||||
|
||||
static int UpdateOne(
|
||||
Database& db,
|
||||
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[6] + " = " + std::to_string(character_material_entry.color));
|
||||
|
||||
auto results = database.QueryDatabase(
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"UPDATE {} SET {} WHERE {} = {}",
|
||||
TableName(),
|
||||
@@ -209,6 +212,7 @@ public:
|
||||
}
|
||||
|
||||
static CharacterMaterial InsertOne(
|
||||
Database& db,
|
||||
CharacterMaterial character_material_entry
|
||||
)
|
||||
{
|
||||
@@ -240,6 +244,7 @@ public:
|
||||
}
|
||||
|
||||
static int InsertMany(
|
||||
Database& db,
|
||||
std::vector<CharacterMaterial> character_material_entries
|
||||
)
|
||||
{
|
||||
@@ -260,7 +265,7 @@ public:
|
||||
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
auto results = database.QueryDatabase(
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES {}",
|
||||
BaseInsert(),
|
||||
@@ -271,11 +276,11 @@ public:
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static std::vector<CharacterMaterial> All()
|
||||
static std::vector<CharacterMaterial> All(Database& db)
|
||||
{
|
||||
std::vector<CharacterMaterial> all_entries;
|
||||
|
||||
auto results = database.QueryDatabase(
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{}",
|
||||
BaseSelect()
|
||||
@@ -301,11 +306,11 @@ public:
|
||||
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;
|
||||
|
||||
auto results = database.QueryDatabase(
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE {}",
|
||||
BaseSelect(),
|
||||
@@ -332,9 +337,9 @@ public:
|
||||
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(
|
||||
"DELETE FROM {} WHERE {}",
|
||||
TableName(),
|
||||
@@ -345,9 +350,9 @@ public:
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int Truncate()
|
||||
static int Truncate(Database& db)
|
||||
{
|
||||
auto results = database.QueryDatabase(
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"TRUNCATE TABLE {}",
|
||||
TableName()
|
||||
|
||||
Reference in New Issue
Block a user