mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-31 04:56:20 +00:00
[Strings] Refactor Strings Usage (#2305)
* Initial commit checkpoint * More functions converted * Commify * More functions * Fin * Sort declarations * Split functions between files * Bots * Update strings.h * Split * Revert find replaces * Repository template * Money * Misc function * Update CMakeLists.txt * Saylink * Update strings.cpp * Swap Strings::Saylink for Saylink::Create since saylink is coupled to zone database * API casings
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
#define EQEMU_BASE_EXPEDITION_LOCKOUTS_REPOSITORY_H
|
||||
|
||||
#include "../../database.h"
|
||||
#include "../../string_util.h"
|
||||
#include "../../strings.h"
|
||||
#include <ctime>
|
||||
|
||||
class BaseExpeditionLockoutsRepository {
|
||||
@@ -58,12 +58,12 @@ public:
|
||||
|
||||
static std::string ColumnsRaw()
|
||||
{
|
||||
return std::string(implode(", ", Columns()));
|
||||
return std::string(Strings::Implode(", ", Columns()));
|
||||
}
|
||||
|
||||
static std::string SelectColumnsRaw()
|
||||
{
|
||||
return std::string(implode(", ", SelectColumns()));
|
||||
return std::string(Strings::Implode(", ", SelectColumns()));
|
||||
}
|
||||
|
||||
static std::string TableName()
|
||||
@@ -174,16 +174,16 @@ public:
|
||||
auto columns = Columns();
|
||||
|
||||
update_values.push_back(columns[1] + " = " + std::to_string(expedition_lockouts_entry.expedition_id));
|
||||
update_values.push_back(columns[2] + " = '" + EscapeString(expedition_lockouts_entry.event_name) + "'");
|
||||
update_values.push_back(columns[2] + " = '" + Strings::Escape(expedition_lockouts_entry.event_name) + "'");
|
||||
update_values.push_back(columns[3] + " = FROM_UNIXTIME(" + (expedition_lockouts_entry.expire_time > 0 ? std::to_string(expedition_lockouts_entry.expire_time) : "null") + ")");
|
||||
update_values.push_back(columns[4] + " = " + std::to_string(expedition_lockouts_entry.duration));
|
||||
update_values.push_back(columns[5] + " = '" + EscapeString(expedition_lockouts_entry.from_expedition_uuid) + "'");
|
||||
update_values.push_back(columns[5] + " = '" + Strings::Escape(expedition_lockouts_entry.from_expedition_uuid) + "'");
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"UPDATE {} SET {} WHERE {} = {}",
|
||||
TableName(),
|
||||
implode(", ", update_values),
|
||||
Strings::Implode(", ", update_values),
|
||||
PrimaryKey(),
|
||||
expedition_lockouts_entry.id
|
||||
)
|
||||
@@ -201,16 +201,16 @@ public:
|
||||
|
||||
insert_values.push_back(std::to_string(expedition_lockouts_entry.id));
|
||||
insert_values.push_back(std::to_string(expedition_lockouts_entry.expedition_id));
|
||||
insert_values.push_back("'" + EscapeString(expedition_lockouts_entry.event_name) + "'");
|
||||
insert_values.push_back("'" + Strings::Escape(expedition_lockouts_entry.event_name) + "'");
|
||||
insert_values.push_back("FROM_UNIXTIME(" + (expedition_lockouts_entry.expire_time > 0 ? std::to_string(expedition_lockouts_entry.expire_time) : "null") + ")");
|
||||
insert_values.push_back(std::to_string(expedition_lockouts_entry.duration));
|
||||
insert_values.push_back("'" + EscapeString(expedition_lockouts_entry.from_expedition_uuid) + "'");
|
||||
insert_values.push_back("'" + Strings::Escape(expedition_lockouts_entry.from_expedition_uuid) + "'");
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES ({})",
|
||||
BaseInsert(),
|
||||
implode(",", insert_values)
|
||||
Strings::Implode(",", insert_values)
|
||||
)
|
||||
);
|
||||
|
||||
@@ -236,12 +236,12 @@ public:
|
||||
|
||||
insert_values.push_back(std::to_string(expedition_lockouts_entry.id));
|
||||
insert_values.push_back(std::to_string(expedition_lockouts_entry.expedition_id));
|
||||
insert_values.push_back("'" + EscapeString(expedition_lockouts_entry.event_name) + "'");
|
||||
insert_values.push_back("'" + Strings::Escape(expedition_lockouts_entry.event_name) + "'");
|
||||
insert_values.push_back("FROM_UNIXTIME(" + (expedition_lockouts_entry.expire_time > 0 ? std::to_string(expedition_lockouts_entry.expire_time) : "null") + ")");
|
||||
insert_values.push_back(std::to_string(expedition_lockouts_entry.duration));
|
||||
insert_values.push_back("'" + EscapeString(expedition_lockouts_entry.from_expedition_uuid) + "'");
|
||||
insert_values.push_back("'" + Strings::Escape(expedition_lockouts_entry.from_expedition_uuid) + "'");
|
||||
|
||||
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
|
||||
insert_chunks.push_back("(" + Strings::Implode(",", insert_values) + ")");
|
||||
}
|
||||
|
||||
std::vector<std::string> insert_values;
|
||||
@@ -250,7 +250,7 @@ public:
|
||||
fmt::format(
|
||||
"{} VALUES {}",
|
||||
BaseInsert(),
|
||||
implode(",", insert_chunks)
|
||||
Strings::Implode(",", insert_chunks)
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user