mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-31 04:56:20 +00:00
Explicitly pass database pointers to repository methods
This commit is contained in:
@@ -144,10 +144,11 @@ public:
|
||||
}
|
||||
|
||||
static BaseData FindOne(
|
||||
Database& db,
|
||||
int base_data_id
|
||||
)
|
||||
{
|
||||
auto results = content_db.QueryDatabase(
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
@@ -177,10 +178,11 @@ public:
|
||||
}
|
||||
|
||||
static int DeleteOne(
|
||||
Database& db,
|
||||
int base_data_id
|
||||
)
|
||||
{
|
||||
auto results = content_db.QueryDatabase(
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {} = {}",
|
||||
TableName(),
|
||||
@@ -193,6 +195,7 @@ public:
|
||||
}
|
||||
|
||||
static int UpdateOne(
|
||||
Database& db,
|
||||
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[9] + " = " + std::to_string(base_data_entry.end_fac));
|
||||
|
||||
auto results = content_db.QueryDatabase(
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"UPDATE {} SET {} WHERE {} = {}",
|
||||
TableName(),
|
||||
@@ -225,6 +228,7 @@ public:
|
||||
}
|
||||
|
||||
static BaseData InsertOne(
|
||||
Database& db,
|
||||
BaseData base_data_entry
|
||||
)
|
||||
{
|
||||
@@ -260,6 +264,7 @@ public:
|
||||
}
|
||||
|
||||
static int InsertMany(
|
||||
Database& db,
|
||||
std::vector<BaseData> base_data_entries
|
||||
)
|
||||
{
|
||||
@@ -284,7 +289,7 @@ public:
|
||||
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
auto results = content_db.QueryDatabase(
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES {}",
|
||||
BaseInsert(),
|
||||
@@ -295,11 +300,11 @@ public:
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static std::vector<BaseData> All()
|
||||
static std::vector<BaseData> All(Database& db)
|
||||
{
|
||||
std::vector<BaseData> all_entries;
|
||||
|
||||
auto results = content_db.QueryDatabase(
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{}",
|
||||
BaseSelect()
|
||||
@@ -328,11 +333,11 @@ public:
|
||||
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;
|
||||
|
||||
auto results = content_db.QueryDatabase(
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE {}",
|
||||
BaseSelect(),
|
||||
@@ -362,9 +367,9 @@ public:
|
||||
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(
|
||||
"DELETE FROM {} WHERE {}",
|
||||
TableName(),
|
||||
@@ -375,9 +380,9 @@ public:
|
||||
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(
|
||||
"TRUNCATE TABLE {}",
|
||||
TableName()
|
||||
|
||||
Reference in New Issue
Block a user