[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:
Chris Miles
2022-07-14 02:10:52 -05:00
committed by GitHub
parent 44c85a0dd7
commit dfd8f84cac
573 changed files with 5197 additions and 5137 deletions
@@ -13,7 +13,7 @@
#define EQEMU_BASE_SPELL_GLOBALS_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
#include "../../strings.h"
#include <ctime>
class BaseSpellGlobalsRepository {
@@ -52,12 +52,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()
@@ -164,15 +164,15 @@ public:
auto columns = Columns();
update_values.push_back(columns[0] + " = " + std::to_string(spell_globals_entry.spellid));
update_values.push_back(columns[1] + " = '" + EscapeString(spell_globals_entry.spell_name) + "'");
update_values.push_back(columns[2] + " = '" + EscapeString(spell_globals_entry.qglobal) + "'");
update_values.push_back(columns[3] + " = '" + EscapeString(spell_globals_entry.value) + "'");
update_values.push_back(columns[1] + " = '" + Strings::Escape(spell_globals_entry.spell_name) + "'");
update_values.push_back(columns[2] + " = '" + Strings::Escape(spell_globals_entry.qglobal) + "'");
update_values.push_back(columns[3] + " = '" + Strings::Escape(spell_globals_entry.value) + "'");
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
Strings::Implode(", ", update_values),
PrimaryKey(),
spell_globals_entry.spellid
)
@@ -189,15 +189,15 @@ public:
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(spell_globals_entry.spellid));
insert_values.push_back("'" + EscapeString(spell_globals_entry.spell_name) + "'");
insert_values.push_back("'" + EscapeString(spell_globals_entry.qglobal) + "'");
insert_values.push_back("'" + EscapeString(spell_globals_entry.value) + "'");
insert_values.push_back("'" + Strings::Escape(spell_globals_entry.spell_name) + "'");
insert_values.push_back("'" + Strings::Escape(spell_globals_entry.qglobal) + "'");
insert_values.push_back("'" + Strings::Escape(spell_globals_entry.value) + "'");
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
Strings::Implode(",", insert_values)
)
);
@@ -222,11 +222,11 @@ public:
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(spell_globals_entry.spellid));
insert_values.push_back("'" + EscapeString(spell_globals_entry.spell_name) + "'");
insert_values.push_back("'" + EscapeString(spell_globals_entry.qglobal) + "'");
insert_values.push_back("'" + EscapeString(spell_globals_entry.value) + "'");
insert_values.push_back("'" + Strings::Escape(spell_globals_entry.spell_name) + "'");
insert_values.push_back("'" + Strings::Escape(spell_globals_entry.qglobal) + "'");
insert_values.push_back("'" + Strings::Escape(spell_globals_entry.value) + "'");
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
insert_chunks.push_back("(" + Strings::Implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
@@ -235,7 +235,7 @@ public:
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
Strings::Implode(",", insert_chunks)
)
);