mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-15 18:10:26 +00:00
Merge branch 'master' into Playerbot
This commit is contained in:
@@ -155,11 +155,11 @@ bool DatabaseWorkerPool<T>::PrepareStatements()
|
||||
else
|
||||
connection->Unlock();
|
||||
|
||||
size_t const preparedSize = connection->m_stmts.size();
|
||||
std::size_t const preparedSize = connection->m_stmts.size();
|
||||
if (_preparedStatementSize.size() < preparedSize)
|
||||
_preparedStatementSize.resize(preparedSize);
|
||||
|
||||
for (size_t i = 0; i < preparedSize; ++i)
|
||||
for (std::size_t i = 0; i < preparedSize; ++i)
|
||||
{
|
||||
// already set by another connection
|
||||
// (each connection only has prepared statements of it's own type sync/async)
|
||||
@@ -489,7 +489,7 @@ void DatabaseWorkerPool<T>::Enqueue(SQLOperation* op)
|
||||
}
|
||||
|
||||
template <class T>
|
||||
size_t DatabaseWorkerPool<T>::QueueSize() const
|
||||
std::size_t DatabaseWorkerPool<T>::QueueSize() const
|
||||
{
|
||||
return _queue->Size();
|
||||
}
|
||||
|
||||
@@ -227,7 +227,7 @@ public:
|
||||
#endif
|
||||
}
|
||||
|
||||
[[nodiscard]] size_t QueueSize() const;
|
||||
[[nodiscard]] std::size_t QueueSize() const;
|
||||
|
||||
private:
|
||||
uint32 OpenConnections(InternalIndex type, uint8 numConnections);
|
||||
|
||||
@@ -144,7 +144,7 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
void Field::GetBinarySizeChecked(uint8* buf, size_t length) const
|
||||
void Field::GetBinarySizeChecked(uint8* buf, std::size_t length) const
|
||||
{
|
||||
ASSERT(data.value && (data.length == length), "Expected {}-byte binary blob, got {}data ({} bytes) instead", length, data.value ? "" : "no ", data.length);
|
||||
memcpy(buf, data.value, length);
|
||||
|
||||
@@ -133,7 +133,7 @@ public:
|
||||
return GetDataBinary();
|
||||
}
|
||||
|
||||
template <typename T, size_t S>
|
||||
template <typename T, std::size_t S>
|
||||
inline std::enable_if_t<std::is_same_v<Binary, T>, std::array<uint8, S>> Get() const
|
||||
{
|
||||
std::array<uint8, S> buf = {};
|
||||
@@ -173,7 +173,7 @@ private:
|
||||
QueryResultFieldMetadata const* meta;
|
||||
void LogWrongType(std::string_view getter, std::string_view typeName) const;
|
||||
void SetMetadata(QueryResultFieldMetadata const* fieldMeta);
|
||||
void GetBinarySizeChecked(uint8* buf, size_t size) const;
|
||||
void GetBinarySizeChecked(uint8* buf, std::size_t size) const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -84,6 +84,7 @@ void LoginDatabaseConnection::DoPrepareStatements()
|
||||
PrepareStatement(LOGIN_UPD_EXPANSION, "UPDATE account SET expansion = ? WHERE id = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(LOGIN_UPD_ACCOUNT_LOCK, "UPDATE account SET locked = ? WHERE id = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(LOGIN_UPD_ACCOUNT_LOCK_COUNTRY, "UPDATE account SET lock_country = ? WHERE id = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(LOGIN_UPD_EMAIL, "UPDATE account SET email = ? WHERE id = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(LOGIN_UPD_USERNAME, "UPDATE account SET username = ? WHERE id = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(LOGIN_UPD_MUTE_TIME, "UPDATE account SET mutetime = ? , mutereason = ? , muteby = ? WHERE id = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(LOGIN_UPD_MUTE_TIME_LOGIN, "UPDATE account SET mutetime = ? WHERE id = ?", CONNECTION_ASYNC);
|
||||
|
||||
@@ -68,6 +68,7 @@ enum LoginDatabaseStatements : uint32
|
||||
LOGIN_UPD_EXPANSION,
|
||||
LOGIN_UPD_ACCOUNT_LOCK,
|
||||
LOGIN_UPD_ACCOUNT_LOCK_COUNTRY,
|
||||
LOGIN_UPD_EMAIL,
|
||||
LOGIN_UPD_USERNAME,
|
||||
LOGIN_UPD_MUTE_TIME,
|
||||
LOGIN_UPD_MUTE_TIME_LOGIN,
|
||||
|
||||
@@ -464,7 +464,7 @@ int MySQLConnection::ExecuteTransaction(std::shared_ptr<TransactionBase> transac
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t MySQLConnection::EscapeString(char* to, const char* from, size_t length)
|
||||
std::size_t MySQLConnection::EscapeString(char* to, const char* from, std::size_t length)
|
||||
{
|
||||
return mysql_real_escape_string(m_Mysql, to, from, length);
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ public:
|
||||
void RollbackTransaction();
|
||||
void CommitTransaction();
|
||||
int ExecuteTransaction(std::shared_ptr<TransactionBase> transaction);
|
||||
size_t EscapeString(char* to, const char* from, size_t length);
|
||||
std::size_t EscapeString(char* to, const char* from, std::size_t length);
|
||||
void Ping();
|
||||
|
||||
uint32 GetLastError();
|
||||
|
||||
@@ -190,7 +190,7 @@ std::string MySQLPreparedStatement::getQueryString() const
|
||||
{
|
||||
std::string queryString(m_queryString);
|
||||
|
||||
size_t pos = 0;
|
||||
std::size_t pos = 0;
|
||||
|
||||
for (PreparedStatementData const& data : m_stmt->GetParameters())
|
||||
{
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include "PreparedStatement.h"
|
||||
#include "QueryResult.h"
|
||||
|
||||
bool SQLQueryHolderBase::SetPreparedQueryImpl(size_t index, PreparedStatementBase* stmt)
|
||||
bool SQLQueryHolderBase::SetPreparedQueryImpl(std::size_t index, PreparedStatementBase* stmt)
|
||||
{
|
||||
if (m_queries.size() <= index)
|
||||
{
|
||||
@@ -34,7 +34,7 @@ bool SQLQueryHolderBase::SetPreparedQueryImpl(size_t index, PreparedStatementBas
|
||||
return true;
|
||||
}
|
||||
|
||||
PreparedQueryResult SQLQueryHolderBase::GetPreparedResult(size_t index) const
|
||||
PreparedQueryResult SQLQueryHolderBase::GetPreparedResult(std::size_t index) const
|
||||
{
|
||||
// Don't call to this function if the index is of a prepared statement
|
||||
ASSERT(index < m_queries.size(), "Query holder result index out of range, tried to access index {} but there are only {} results",
|
||||
@@ -43,7 +43,7 @@ PreparedQueryResult SQLQueryHolderBase::GetPreparedResult(size_t index) const
|
||||
return m_queries[index].second;
|
||||
}
|
||||
|
||||
void SQLQueryHolderBase::SetPreparedResult(size_t index, PreparedResultSet* result)
|
||||
void SQLQueryHolderBase::SetPreparedResult(std::size_t index, PreparedResultSet* result)
|
||||
{
|
||||
if (result && !result->GetRowCount())
|
||||
{
|
||||
@@ -66,7 +66,7 @@ SQLQueryHolderBase::~SQLQueryHolderBase()
|
||||
}
|
||||
}
|
||||
|
||||
void SQLQueryHolderBase::SetSize(size_t size)
|
||||
void SQLQueryHolderBase::SetSize(std::size_t size)
|
||||
{
|
||||
/// to optimize push_back, reserve the number of queries about to be executed
|
||||
m_queries.resize(size);
|
||||
@@ -77,7 +77,7 @@ SQLQueryHolderTask::~SQLQueryHolderTask() = default;
|
||||
bool SQLQueryHolderTask::Execute()
|
||||
{
|
||||
/// execute all queries in the holder and pass the results
|
||||
for (size_t i = 0; i < m_holder->m_queries.size(); ++i)
|
||||
for (std::size_t i = 0; i < m_holder->m_queries.size(); ++i)
|
||||
if (PreparedStatementBase* stmt = m_holder->m_queries[i].first)
|
||||
m_holder->SetPreparedResult(i, m_conn->Query(stmt));
|
||||
|
||||
|
||||
@@ -28,12 +28,12 @@ friend class SQLQueryHolderTask;
|
||||
public:
|
||||
SQLQueryHolderBase() = default;
|
||||
virtual ~SQLQueryHolderBase();
|
||||
void SetSize(size_t size);
|
||||
PreparedQueryResult GetPreparedResult(size_t index) const;
|
||||
void SetPreparedResult(size_t index, PreparedResultSet* result);
|
||||
void SetSize(std::size_t size);
|
||||
PreparedQueryResult GetPreparedResult(std::size_t index) const;
|
||||
void SetPreparedResult(std::size_t index, PreparedResultSet* result);
|
||||
|
||||
protected:
|
||||
bool SetPreparedQueryImpl(size_t index, PreparedStatementBase* stmt);
|
||||
bool SetPreparedQueryImpl(std::size_t index, PreparedStatementBase* stmt);
|
||||
|
||||
private:
|
||||
std::vector<std::pair<PreparedStatementBase*, PreparedQueryResult>> m_queries;
|
||||
@@ -43,7 +43,7 @@ template<typename T>
|
||||
class SQLQueryHolder : public SQLQueryHolderBase
|
||||
{
|
||||
public:
|
||||
bool SetPreparedQuery(size_t index, PreparedStatement<T>* stmt)
|
||||
bool SetPreparedQuery(std::size_t index, PreparedStatement<T>* stmt)
|
||||
{
|
||||
return SetPreparedQueryImpl(index, stmt);
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "DatabaseEnv.h"
|
||||
#include "LogMessage.h"
|
||||
#include "PreparedStatement.h"
|
||||
#include <vector>
|
||||
|
||||
AppenderDB::AppenderDB(uint8 id, std::string const& name, LogLevel level, AppenderFlags /*flags*/, std::vector<std::string_view> const& /*args*/)
|
||||
: Appender(id, name, level), realmId(0), enabled(false) { }
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#define APPENDERDB_H
|
||||
|
||||
#include "Appender.h"
|
||||
#include <vector>
|
||||
|
||||
class AppenderDB : public Appender
|
||||
{
|
||||
|
||||
@@ -240,8 +240,8 @@ UpdateResult UpdateFetcher::Update(bool const redundancyChecks,
|
||||
|
||||
AppliedFileStorage applied = ReceiveAppliedFiles();
|
||||
|
||||
size_t countRecentUpdates = 0;
|
||||
size_t countArchivedUpdates = 0;
|
||||
std::size_t countRecentUpdates = 0;
|
||||
std::size_t countArchivedUpdates = 0;
|
||||
|
||||
// Count updates
|
||||
for (auto const& entry : applied)
|
||||
@@ -255,7 +255,7 @@ UpdateResult UpdateFetcher::Update(bool const redundancyChecks,
|
||||
for (auto& entry : applied)
|
||||
hashToName.insert(std::make_pair(entry.second.hash, entry.first));
|
||||
|
||||
size_t importedUpdates = 0;
|
||||
std::size_t importedUpdates = 0;
|
||||
|
||||
auto ApplyUpdateFile = [&](LocaleFileEntry const& sqlFile)
|
||||
{
|
||||
@@ -483,7 +483,7 @@ void UpdateFetcher::CleanUp(AppliedFileStorage const& storage) const
|
||||
return;
|
||||
|
||||
std::stringstream update;
|
||||
size_t remaining = storage.size();
|
||||
std::size_t remaining = storage.size();
|
||||
|
||||
update << "DELETE FROM `updates` WHERE `name` IN(";
|
||||
|
||||
|
||||
@@ -31,12 +31,12 @@ struct AC_DATABASE_API UpdateResult
|
||||
UpdateResult()
|
||||
: updated(0), recent(0), archived(0) { }
|
||||
|
||||
UpdateResult(size_t const updated_, size_t const recent_, size_t const archived_)
|
||||
UpdateResult(std::size_t const updated_, std::size_t const recent_, std::size_t const archived_)
|
||||
: updated(updated_), recent(recent_), archived(archived_) { }
|
||||
|
||||
size_t updated;
|
||||
size_t recent;
|
||||
size_t archived;
|
||||
std::size_t updated;
|
||||
std::size_t recent;
|
||||
std::size_t archived;
|
||||
};
|
||||
|
||||
class AC_DATABASE_API UpdateFetcher
|
||||
|
||||
Reference in New Issue
Block a user