mirror of
https://github.com/EQEmu/Server.git
synced 2026-09-06 12:26:37 +00:00
Explicitly pass database pointers to repository methods
This commit is contained in:
@@ -186,10 +186,11 @@ public:
|
||||
}
|
||||
|
||||
static ZonePoints FindOne(
|
||||
Database& db,
|
||||
int zone_points_id
|
||||
)
|
||||
{
|
||||
auto results = content_db.QueryDatabase(
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
@@ -233,10 +234,11 @@ public:
|
||||
}
|
||||
|
||||
static int DeleteOne(
|
||||
Database& db,
|
||||
int zone_points_id
|
||||
)
|
||||
{
|
||||
auto results = content_db.QueryDatabase(
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {} = {}",
|
||||
TableName(),
|
||||
@@ -249,6 +251,7 @@ public:
|
||||
}
|
||||
|
||||
static int UpdateOne(
|
||||
Database& db,
|
||||
ZonePoints zone_points_entry
|
||||
)
|
||||
{
|
||||
@@ -280,7 +283,7 @@ public:
|
||||
update_values.push_back(columns[22] + " = " + std::to_string(zone_points_entry.height));
|
||||
update_values.push_back(columns[23] + " = " + std::to_string(zone_points_entry.width));
|
||||
|
||||
auto results = content_db.QueryDatabase(
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"UPDATE {} SET {} WHERE {} = {}",
|
||||
TableName(),
|
||||
@@ -294,6 +297,7 @@ public:
|
||||
}
|
||||
|
||||
static ZonePoints InsertOne(
|
||||
Database& db,
|
||||
ZonePoints zone_points_entry
|
||||
)
|
||||
{
|
||||
@@ -342,6 +346,7 @@ public:
|
||||
}
|
||||
|
||||
static int InsertMany(
|
||||
Database& db,
|
||||
std::vector<ZonePoints> zone_points_entries
|
||||
)
|
||||
{
|
||||
@@ -379,7 +384,7 @@ public:
|
||||
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
auto results = content_db.QueryDatabase(
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES {}",
|
||||
BaseInsert(),
|
||||
@@ -390,11 +395,11 @@ public:
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static std::vector<ZonePoints> All()
|
||||
static std::vector<ZonePoints> All(Database& db)
|
||||
{
|
||||
std::vector<ZonePoints> all_entries;
|
||||
|
||||
auto results = content_db.QueryDatabase(
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{}",
|
||||
BaseSelect()
|
||||
@@ -437,11 +442,11 @@ public:
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static std::vector<ZonePoints> GetWhere(std::string where_filter)
|
||||
static std::vector<ZonePoints> GetWhere(Database& db, std::string where_filter)
|
||||
{
|
||||
std::vector<ZonePoints> all_entries;
|
||||
|
||||
auto results = content_db.QueryDatabase(
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE {}",
|
||||
BaseSelect(),
|
||||
@@ -485,9 +490,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(),
|
||||
@@ -498,9 +503,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