mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-25 02:08:23 +00:00
Explicitly pass database pointers to repository methods
This commit is contained in:
@@ -147,10 +147,11 @@ public:
|
||||
}
|
||||
|
||||
static AdventureStats FindOne(
|
||||
Database& db,
|
||||
int adventure_stats_id
|
||||
)
|
||||
{
|
||||
auto results = database.QueryDatabase(
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
@@ -181,10 +182,11 @@ public:
|
||||
}
|
||||
|
||||
static int DeleteOne(
|
||||
Database& db,
|
||||
int adventure_stats_id
|
||||
)
|
||||
{
|
||||
auto results = database.QueryDatabase(
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {} = {}",
|
||||
TableName(),
|
||||
@@ -197,6 +199,7 @@ public:
|
||||
}
|
||||
|
||||
static int UpdateOne(
|
||||
Database& db,
|
||||
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[10] + " = " + std::to_string(adventure_stats_entry.tak_losses));
|
||||
|
||||
auto results = database.QueryDatabase(
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"UPDATE {} SET {} WHERE {} = {}",
|
||||
TableName(),
|
||||
@@ -230,6 +233,7 @@ public:
|
||||
}
|
||||
|
||||
static AdventureStats InsertOne(
|
||||
Database& db,
|
||||
AdventureStats adventure_stats_entry
|
||||
)
|
||||
{
|
||||
@@ -266,6 +270,7 @@ public:
|
||||
}
|
||||
|
||||
static int InsertMany(
|
||||
Database& db,
|
||||
std::vector<AdventureStats> adventure_stats_entries
|
||||
)
|
||||
{
|
||||
@@ -291,7 +296,7 @@ public:
|
||||
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
auto results = database.QueryDatabase(
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES {}",
|
||||
BaseInsert(),
|
||||
@@ -302,11 +307,11 @@ public:
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static std::vector<AdventureStats> All()
|
||||
static std::vector<AdventureStats> All(Database& db)
|
||||
{
|
||||
std::vector<AdventureStats> all_entries;
|
||||
|
||||
auto results = database.QueryDatabase(
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{}",
|
||||
BaseSelect()
|
||||
@@ -336,11 +341,11 @@ public:
|
||||
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;
|
||||
|
||||
auto results = database.QueryDatabase(
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE {}",
|
||||
BaseSelect(),
|
||||
@@ -371,9 +376,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(),
|
||||
@@ -384,9 +389,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