refactor(Core/Misc): Acore::StringFormat to fmt format (#19838)

refactor(Core/Utilities): Acore::StringFormat to fmt format

* closes https://github.com/azerothcore/azerothcore-wotlk/issues/10356
This commit is contained in:
Kitzunu
2024-09-03 12:59:37 +02:00
committed by GitHub
parent f6fd978a7a
commit de2bcbdabf
36 changed files with 100 additions and 115 deletions

View File

@@ -103,7 +103,7 @@ public:
if (sql.empty())
return;
Execute(Acore::StringFormatFmt(sql, std::forward<Args>(args)...));
Execute(Acore::StringFormat(sql, std::forward<Args>(args)...));
}
//! Enqueues a one-way SQL operation in prepared statement format that will be executed asynchronously.
@@ -126,7 +126,7 @@ public:
if (sql.empty())
return;
DirectExecute(Acore::StringFormatFmt(sql, std::forward<Args>(args)...));
DirectExecute(Acore::StringFormat(sql, std::forward<Args>(args)...));
}
//! Directly executes a one-way SQL operation in prepared statement format, that will block the calling thread until finished.
@@ -149,7 +149,7 @@ public:
if (sql.empty())
return QueryResult(nullptr);
return Query(Acore::StringFormatFmt(sql, std::forward<Args>(args)...));
return Query(Acore::StringFormat(sql, std::forward<Args>(args)...));
}
//! Directly executes an SQL query in prepared format that will block the calling thread until finished.

View File

@@ -104,7 +104,7 @@ bool PreparedStatementTask::Execute()
template<typename T>
std::string PreparedStatementData::ToString(T value)
{
return Acore::StringFormatFmt("{}", value);
return Acore::StringFormat("{}", value);
}
template<>

View File

@@ -45,7 +45,7 @@ public:
template<typename... Args>
void Append(std::string_view sql, Args&&... args)
{
Append(Acore::StringFormatFmt(sql, std::forward<Args>(args)...));
Append(Acore::StringFormat(sql, std::forward<Args>(args)...));
}
[[nodiscard]] std::size_t GetSize() const { return m_queries.size(); }

View File

@@ -235,7 +235,7 @@ bool DBUpdater<T>::Update(DatabaseWorkerPool<T>& pool, std::string_view modulesL
auto CheckUpdateTable = [&](std::string const& tableName)
{
auto checkTable = DBUpdater<T>::Retrieve(pool, Acore::StringFormatFmt("SHOW TABLES LIKE '{}'", tableName));
auto checkTable = DBUpdater<T>::Retrieve(pool, Acore::StringFormat("SHOW TABLES LIKE '{}'", tableName));
if (!checkTable)
{
LOG_WARN("sql.updates", "> Table '{}' not exist! Try add based table", tableName);
@@ -279,7 +279,7 @@ bool DBUpdater<T>::Update(DatabaseWorkerPool<T>& pool, std::string_view modulesL
return false;
}
std::string const info = Acore::StringFormatFmt("Containing {} new and {} archived updates.", result.recent, result.archived);
std::string const info = Acore::StringFormat("Containing {} new and {} archived updates.", result.recent, result.archived);
if (!result.updated)
LOG_INFO("sql.updates", ">> {} database is up-to-date! {}", DBUpdater<T>::GetTableName(), info);
@@ -307,7 +307,7 @@ bool DBUpdater<T>::Update(DatabaseWorkerPool<T>& pool, std::vector<std::string>
auto CheckUpdateTable = [&](std::string const& tableName)
{
auto checkTable = DBUpdater<T>::Retrieve(pool, Acore::StringFormatFmt("SHOW TABLES LIKE '{}'", tableName));
auto checkTable = DBUpdater<T>::Retrieve(pool, Acore::StringFormat("SHOW TABLES LIKE '{}'", tableName));
if (!checkTable)
{
Path const temp(GetBaseFilesDirectory() + tableName + ".sql");
@@ -507,7 +507,7 @@ void DBUpdater<T>::ApplyFile(DatabaseWorkerPool<T>& pool, std::string const& hos
// Execute sql file
args.emplace_back("-e");
args.emplace_back(Acore::StringFormat("BEGIN; SOURCE %s; COMMIT;", path.generic_string().c_str()));
args.emplace_back(Acore::StringFormat("BEGIN; SOURCE {}; COMMIT;", path.generic_string()));
// Database
if (!database.empty())