mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-31 00:46:46 +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:
@@ -30,7 +30,7 @@
|
||||
#define EQEMU_BASE_VARIABLES_REPOSITORY_H
|
||||
|
||||
#include "../../database.h"
|
||||
#include "../../string_util.h"
|
||||
#include "../../strings.h"
|
||||
|
||||
class BaseVariablesRepository {
|
||||
public:
|
||||
@@ -58,7 +58,7 @@ public:
|
||||
|
||||
static std::string ColumnsRaw()
|
||||
{
|
||||
return std::string(implode(", ", Columns()));
|
||||
return std::string(Strings::Implode(", ", Columns()));
|
||||
}
|
||||
|
||||
static std::string InsertColumnsRaw()
|
||||
@@ -73,7 +73,7 @@ public:
|
||||
insert_columns.push_back(column);
|
||||
}
|
||||
|
||||
return std::string(implode(", ", insert_columns));
|
||||
return std::string(Strings::Implode(", ", insert_columns));
|
||||
}
|
||||
|
||||
static std::string TableName()
|
||||
@@ -176,16 +176,16 @@ public:
|
||||
|
||||
auto columns = Columns();
|
||||
|
||||
update_values.push_back(columns[0] + " = '" + EscapeString(variables_entry.varname) + "'");
|
||||
update_values.push_back(columns[1] + " = '" + EscapeString(variables_entry.value) + "'");
|
||||
update_values.push_back(columns[2] + " = '" + EscapeString(variables_entry.information) + "'");
|
||||
update_values.push_back(columns[3] + " = '" + EscapeString(variables_entry.ts) + "'");
|
||||
update_values.push_back(columns[0] + " = '" + Strings::Escape(variables_entry.varname) + "'");
|
||||
update_values.push_back(columns[1] + " = '" + Strings::Escape(variables_entry.value) + "'");
|
||||
update_values.push_back(columns[2] + " = '" + Strings::Escape(variables_entry.information) + "'");
|
||||
update_values.push_back(columns[3] + " = '" + Strings::Escape(variables_entry.ts) + "'");
|
||||
|
||||
auto results = database.QueryDatabase(
|
||||
fmt::format(
|
||||
"UPDATE {} SET {} WHERE {} = {}",
|
||||
TableName(),
|
||||
implode(", ", update_values),
|
||||
Strings::Implode(", ", update_values),
|
||||
PrimaryKey(),
|
||||
variables_entry.varname
|
||||
)
|
||||
@@ -200,16 +200,16 @@ public:
|
||||
{
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
insert_values.push_back("'" + EscapeString(variables_entry.varname) + "'");
|
||||
insert_values.push_back("'" + EscapeString(variables_entry.value) + "'");
|
||||
insert_values.push_back("'" + EscapeString(variables_entry.information) + "'");
|
||||
insert_values.push_back("'" + EscapeString(variables_entry.ts) + "'");
|
||||
insert_values.push_back("'" + Strings::Escape(variables_entry.varname) + "'");
|
||||
insert_values.push_back("'" + Strings::Escape(variables_entry.value) + "'");
|
||||
insert_values.push_back("'" + Strings::Escape(variables_entry.information) + "'");
|
||||
insert_values.push_back("'" + Strings::Escape(variables_entry.ts) + "'");
|
||||
|
||||
auto results = database.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES ({})",
|
||||
BaseInsert(),
|
||||
implode(",", insert_values)
|
||||
Strings::Implode(",", insert_values)
|
||||
)
|
||||
);
|
||||
|
||||
@@ -232,12 +232,12 @@ public:
|
||||
for (auto &variables_entry: variables_entries) {
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
insert_values.push_back("'" + EscapeString(variables_entry.varname) + "'");
|
||||
insert_values.push_back("'" + EscapeString(variables_entry.value) + "'");
|
||||
insert_values.push_back("'" + EscapeString(variables_entry.information) + "'");
|
||||
insert_values.push_back("'" + EscapeString(variables_entry.ts) + "'");
|
||||
insert_values.push_back("'" + Strings::Escape(variables_entry.varname) + "'");
|
||||
insert_values.push_back("'" + Strings::Escape(variables_entry.value) + "'");
|
||||
insert_values.push_back("'" + Strings::Escape(variables_entry.information) + "'");
|
||||
insert_values.push_back("'" + Strings::Escape(variables_entry.ts) + "'");
|
||||
|
||||
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
|
||||
insert_chunks.push_back("(" + Strings::Implode(",", insert_values) + ")");
|
||||
}
|
||||
|
||||
std::vector<std::string> insert_values;
|
||||
@@ -246,7 +246,7 @@ public:
|
||||
fmt::format(
|
||||
"{} VALUES {}",
|
||||
BaseInsert(),
|
||||
implode(",", insert_chunks)
|
||||
Strings::Implode(",", insert_chunks)
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user