mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-01 10:11:37 +00:00
Explicitly pass database pointers to repository methods
This commit is contained in:
@@ -141,10 +141,11 @@ public:
|
||||
}
|
||||
|
||||
static LoginAccounts FindOne(
|
||||
Database& db,
|
||||
int login_accounts_id
|
||||
)
|
||||
{
|
||||
auto results = database.QueryDatabase(
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
@@ -173,10 +174,11 @@ public:
|
||||
}
|
||||
|
||||
static int DeleteOne(
|
||||
Database& db,
|
||||
int login_accounts_id
|
||||
)
|
||||
{
|
||||
auto results = database.QueryDatabase(
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {} = {}",
|
||||
TableName(),
|
||||
@@ -189,6 +191,7 @@ public:
|
||||
}
|
||||
|
||||
static int UpdateOne(
|
||||
Database& db,
|
||||
LoginAccounts login_accounts_entry
|
||||
)
|
||||
{
|
||||
@@ -206,7 +209,7 @@ public:
|
||||
update_values.push_back(columns[7] + " = '" + EscapeString(login_accounts_entry.created_at) + "'");
|
||||
update_values.push_back(columns[8] + " = '" + EscapeString(login_accounts_entry.updated_at) + "'");
|
||||
|
||||
auto results = database.QueryDatabase(
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"UPDATE {} SET {} WHERE {} = {}",
|
||||
TableName(),
|
||||
@@ -220,6 +223,7 @@ public:
|
||||
}
|
||||
|
||||
static LoginAccounts InsertOne(
|
||||
Database& db,
|
||||
LoginAccounts login_accounts_entry
|
||||
)
|
||||
{
|
||||
@@ -254,6 +258,7 @@ public:
|
||||
}
|
||||
|
||||
static int InsertMany(
|
||||
Database& db,
|
||||
std::vector<LoginAccounts> login_accounts_entries
|
||||
)
|
||||
{
|
||||
@@ -277,7 +282,7 @@ public:
|
||||
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
auto results = database.QueryDatabase(
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES {}",
|
||||
BaseInsert(),
|
||||
@@ -288,11 +293,11 @@ public:
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static std::vector<LoginAccounts> All()
|
||||
static std::vector<LoginAccounts> All(Database& db)
|
||||
{
|
||||
std::vector<LoginAccounts> all_entries;
|
||||
|
||||
auto results = database.QueryDatabase(
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{}",
|
||||
BaseSelect()
|
||||
@@ -320,11 +325,11 @@ public:
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static std::vector<LoginAccounts> GetWhere(std::string where_filter)
|
||||
static std::vector<LoginAccounts> GetWhere(Database& db, std::string where_filter)
|
||||
{
|
||||
std::vector<LoginAccounts> all_entries;
|
||||
|
||||
auto results = database.QueryDatabase(
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE {}",
|
||||
BaseSelect(),
|
||||
@@ -353,9 +358,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(),
|
||||
@@ -366,9 +371,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