mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-01 01:52:02 +00:00
Explicitly pass database pointers to repository methods
This commit is contained in:
@@ -219,10 +219,11 @@ public:
|
||||
}
|
||||
|
||||
static Doors FindOne(
|
||||
Database& db,
|
||||
int doors_id
|
||||
)
|
||||
{
|
||||
auto results = content_db.QueryDatabase(
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
@@ -277,10 +278,11 @@ public:
|
||||
}
|
||||
|
||||
static int DeleteOne(
|
||||
Database& db,
|
||||
int doors_id
|
||||
)
|
||||
{
|
||||
auto results = content_db.QueryDatabase(
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {} = {}",
|
||||
TableName(),
|
||||
@@ -293,6 +295,7 @@ public:
|
||||
}
|
||||
|
||||
static int UpdateOne(
|
||||
Database& db,
|
||||
Doors doors_entry
|
||||
)
|
||||
{
|
||||
@@ -335,7 +338,7 @@ public:
|
||||
update_values.push_back(columns[33] + " = '" + EscapeString(doors_entry.content_flags) + "'");
|
||||
update_values.push_back(columns[34] + " = '" + EscapeString(doors_entry.content_flags_disabled) + "'");
|
||||
|
||||
auto results = content_db.QueryDatabase(
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"UPDATE {} SET {} WHERE {} = {}",
|
||||
TableName(),
|
||||
@@ -349,6 +352,7 @@ public:
|
||||
}
|
||||
|
||||
static Doors InsertOne(
|
||||
Database& db,
|
||||
Doors doors_entry
|
||||
)
|
||||
{
|
||||
@@ -408,6 +412,7 @@ public:
|
||||
}
|
||||
|
||||
static int InsertMany(
|
||||
Database& db,
|
||||
std::vector<Doors> doors_entries
|
||||
)
|
||||
{
|
||||
@@ -456,7 +461,7 @@ public:
|
||||
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
auto results = content_db.QueryDatabase(
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES {}",
|
||||
BaseInsert(),
|
||||
@@ -467,11 +472,11 @@ public:
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static std::vector<Doors> All()
|
||||
static std::vector<Doors> All(Database& db)
|
||||
{
|
||||
std::vector<Doors> all_entries;
|
||||
|
||||
auto results = content_db.QueryDatabase(
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{}",
|
||||
BaseSelect()
|
||||
@@ -525,11 +530,11 @@ public:
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static std::vector<Doors> GetWhere(std::string where_filter)
|
||||
static std::vector<Doors> GetWhere(Database& db, std::string where_filter)
|
||||
{
|
||||
std::vector<Doors> all_entries;
|
||||
|
||||
auto results = content_db.QueryDatabase(
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE {}",
|
||||
BaseSelect(),
|
||||
@@ -584,9 +589,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(),
|
||||
@@ -597,9 +602,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