mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-01 14:21:37 +00:00
Explicitly pass database pointers to repository methods
This commit is contained in:
@@ -165,10 +165,11 @@ public:
|
||||
}
|
||||
|
||||
static CharacterCurrency FindOne(
|
||||
Database& db,
|
||||
int character_currency_id
|
||||
)
|
||||
{
|
||||
auto results = database.QueryDatabase(
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
@@ -205,10 +206,11 @@ public:
|
||||
}
|
||||
|
||||
static int DeleteOne(
|
||||
Database& db,
|
||||
int character_currency_id
|
||||
)
|
||||
{
|
||||
auto results = database.QueryDatabase(
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {} = {}",
|
||||
TableName(),
|
||||
@@ -221,6 +223,7 @@ public:
|
||||
}
|
||||
|
||||
static int UpdateOne(
|
||||
Database& db,
|
||||
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[16] + " = " + std::to_string(character_currency_entry.career_ebon_crystals));
|
||||
|
||||
auto results = database.QueryDatabase(
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"UPDATE {} SET {} WHERE {} = {}",
|
||||
TableName(),
|
||||
@@ -260,6 +263,7 @@ public:
|
||||
}
|
||||
|
||||
static CharacterCurrency InsertOne(
|
||||
Database& db,
|
||||
CharacterCurrency character_currency_entry
|
||||
)
|
||||
{
|
||||
@@ -302,6 +306,7 @@ public:
|
||||
}
|
||||
|
||||
static int InsertMany(
|
||||
Database& db,
|
||||
std::vector<CharacterCurrency> character_currency_entries
|
||||
)
|
||||
{
|
||||
@@ -333,7 +338,7 @@ public:
|
||||
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
auto results = database.QueryDatabase(
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES {}",
|
||||
BaseInsert(),
|
||||
@@ -344,11 +349,11 @@ public:
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static std::vector<CharacterCurrency> All()
|
||||
static std::vector<CharacterCurrency> All(Database& db)
|
||||
{
|
||||
std::vector<CharacterCurrency> all_entries;
|
||||
|
||||
auto results = database.QueryDatabase(
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{}",
|
||||
BaseSelect()
|
||||
@@ -384,11 +389,11 @@ public:
|
||||
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;
|
||||
|
||||
auto results = database.QueryDatabase(
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE {}",
|
||||
BaseSelect(),
|
||||
@@ -425,9 +430,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(),
|
||||
@@ -438,9 +443,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