diff options
| author | Shauren <shauren.trinity@gmail.com> | 2020-08-14 17:06:03 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2020-08-14 17:06:03 +0200 |
| commit | 1c52d5fff738aa01bd27fd117076ac33515acef5 (patch) | |
| tree | ff7d2113e023a0fd47fbdde8ea94c0fe4bb9a804 /src/server/database/Database | |
| parent | 02fd3a1f15840203d8515dae12920d9b66655076 (diff) | |
Core/Misc: Replace NULL with nullptr
Diffstat (limited to 'src/server/database/Database')
| -rw-r--r-- | src/server/database/Database/AdhocStatement.cpp | 2 | ||||
| -rw-r--r-- | src/server/database/Database/DatabaseWorkerPool.cpp | 4 | ||||
| -rw-r--r-- | src/server/database/Database/Field.cpp | 2 | ||||
| -rw-r--r-- | src/server/database/Database/MySQLConnection.cpp | 24 | ||||
| -rw-r--r-- | src/server/database/Database/MySQLPreparedStatement.cpp | 10 | ||||
| -rw-r--r-- | src/server/database/Database/MySQLThreading.cpp | 2 | ||||
| -rw-r--r-- | src/server/database/Database/PreparedStatement.cpp | 2 | ||||
| -rw-r--r-- | src/server/database/Database/QueryHolder.cpp | 2 | ||||
| -rw-r--r-- | src/server/database/Database/QueryResult.cpp | 8 | ||||
| -rw-r--r-- | src/server/database/Database/SQLOperation.h | 2 |
10 files changed, 29 insertions, 29 deletions
diff --git a/src/server/database/Database/AdhocStatement.cpp b/src/server/database/Database/AdhocStatement.cpp index 325dc274cba..5c94ee7c1ef 100644 --- a/src/server/database/Database/AdhocStatement.cpp +++ b/src/server/database/Database/AdhocStatement.cpp @@ -47,7 +47,7 @@ bool BasicStatementTask::Execute() if (!result || !result->GetRowCount() || !result->NextRow()) { delete result; - m_result->set_value(QueryResult(NULL)); + m_result->set_value(QueryResult(nullptr)); return false; } diff --git a/src/server/database/Database/DatabaseWorkerPool.cpp b/src/server/database/Database/DatabaseWorkerPool.cpp index 39330288a8d..94b041b4b87 100644 --- a/src/server/database/Database/DatabaseWorkerPool.cpp +++ b/src/server/database/Database/DatabaseWorkerPool.cpp @@ -177,7 +177,7 @@ QueryResult DatabaseWorkerPool<T>::Query(const char* sql, T* connection /*= null if (!result || !result->GetRowCount() || !result->NextRow()) { delete result; - return QueryResult(NULL); + return QueryResult(nullptr); } return QueryResult(result); @@ -196,7 +196,7 @@ PreparedQueryResult DatabaseWorkerPool<T>::Query(PreparedStatement<T>* stmt) if (!ret || !ret->GetRowCount()) { delete ret; - return PreparedQueryResult(NULL); + return PreparedQueryResult(nullptr); } return PreparedQueryResult(ret); diff --git a/src/server/database/Database/Field.cpp b/src/server/database/Database/Field.cpp index 657cc062409..4504587521c 100644 --- a/src/server/database/Database/Field.cpp +++ b/src/server/database/Database/Field.cpp @@ -219,7 +219,7 @@ char const* Field::GetCString() const if (IsNumeric() && data.raw) { LogWrongType(__FUNCTION__); - return NULL; + return nullptr; } #endif return static_cast<char const*>(data.value); diff --git a/src/server/database/Database/MySQLConnection.cpp b/src/server/database/Database/MySQLConnection.cpp index f141663b824..083eadef93d 100644 --- a/src/server/database/Database/MySQLConnection.cpp +++ b/src/server/database/Database/MySQLConnection.cpp @@ -49,8 +49,8 @@ MySQLConnectionInfo::MySQLConnectionInfo(std::string const& infoString) MySQLConnection::MySQLConnection(MySQLConnectionInfo& connInfo) : m_reconnecting(false), m_prepareError(false), -m_queue(NULL), -m_Mysql(NULL), +m_queue(nullptr), +m_Mysql(nullptr), m_connectionInfo(connInfo), m_connectionFlags(CONNECTION_SYNCH) { } @@ -58,7 +58,7 @@ MySQLConnection::MySQLConnection(ProducerConsumerQueue<SQLOperation*>* queue, My m_reconnecting(false), m_prepareError(false), m_queue(queue), -m_Mysql(NULL), +m_Mysql(nullptr), m_connectionInfo(connInfo), m_connectionFlags(CONNECTION_ASYNC) { @@ -87,7 +87,7 @@ void MySQLConnection::Close() uint32 MySQLConnection::Open() { MYSQL *mysqlInit; - mysqlInit = mysql_init(NULL); + mysqlInit = mysql_init(nullptr); if (!mysqlInit) { TC_LOG_ERROR("sql.sql", "Could not initialize Mysql connection to database `%s`", m_connectionInfo.database.c_str()); @@ -106,12 +106,12 @@ uint32 MySQLConnection::Open() unsigned int opt = MYSQL_PROTOCOL_PIPE; mysql_options(mysqlInit, MYSQL_OPT_PROTOCOL, (char const*)&opt); port = 0; - unix_socket = 0; + unix_socket = nullptr; } else // generic case { port = atoi(m_connectionInfo.port_or_socket.c_str()); - unix_socket = 0; + unix_socket = nullptr; } #else if (m_connectionInfo.host == ".") // socket use option (Unix/Linux) @@ -297,15 +297,15 @@ bool MySQLConnection::_Query(PreparedStatementBase* stmt, MySQLResult** pResult, ResultSet* MySQLConnection::Query(const char* sql) { if (!sql) - return NULL; + return nullptr; - MySQLResult* result = NULL; - MySQLField* fields = NULL; + MySQLResult* result = nullptr; + MySQLField* fields = nullptr; uint64 rowCount = 0; uint32 fieldCount = 0; if (!_Query(sql, &result, &fields, &rowCount, &fieldCount)) - return NULL; + return nullptr; return new ResultSet(result, fields, rowCount, fieldCount); } @@ -492,12 +492,12 @@ void MySQLConnection::PrepareStatement(uint32 index, std::string const& sql, Con PreparedResultSet* MySQLConnection::Query(PreparedStatementBase* stmt) { - MySQLResult* result = NULL; + MySQLResult* result = nullptr; uint64 rowCount = 0; uint32 fieldCount = 0; if (!_Query(stmt, &result, &rowCount, &fieldCount)) - return NULL; + return nullptr; if (mysql_more_results(m_Mysql)) { diff --git a/src/server/database/Database/MySQLPreparedStatement.cpp b/src/server/database/Database/MySQLPreparedStatement.cpp index 1c66e259c48..2e848804902 100644 --- a/src/server/database/Database/MySQLPreparedStatement.cpp +++ b/src/server/database/Database/MySQLPreparedStatement.cpp @@ -53,9 +53,9 @@ void MySQLPreparedStatement::ClearParameters() for (uint32 i=0; i < m_paramCount; ++i) { delete m_bind[i].length; - m_bind[i].length = NULL; + m_bind[i].length = nullptr; delete[] (char*) m_bind[i].buffer; - m_bind[i].buffer = NULL; + m_bind[i].buffer = nullptr; m_paramsSet[i] = false; } } @@ -73,7 +73,7 @@ static void SetParameterValue(MYSQL_BIND* param, enum_field_types type, const vo param->buffer = new char[len]; param->buffer_length = 0; param->is_null_value = 0; - param->length = NULL; // Only != NULL for strings + param->length = nullptr; // Only != NULL for strings param->is_unsigned = isUnsigned; memcpy(param->buffer, value, len); @@ -95,11 +95,11 @@ void MySQLPreparedStatement::setNull(const uint8 index) MYSQL_BIND* param = &m_bind[index]; param->buffer_type = MYSQL_TYPE_NULL; delete[] static_cast<char *>(param->buffer); - param->buffer = NULL; + param->buffer = nullptr; param->buffer_length = 0; param->is_null_value = 1; delete param->length; - param->length = NULL; + param->length = nullptr; } void MySQLPreparedStatement::setBool(const uint8 index, const bool value) diff --git a/src/server/database/Database/MySQLThreading.cpp b/src/server/database/Database/MySQLThreading.cpp index 6f671167361..d373393f284 100644 --- a/src/server/database/Database/MySQLThreading.cpp +++ b/src/server/database/Database/MySQLThreading.cpp @@ -20,7 +20,7 @@ void MySQL::Library_Init() { - mysql_library_init(-1, NULL, NULL); + mysql_library_init(-1, nullptr, nullptr); } void MySQL::Library_End() diff --git a/src/server/database/Database/PreparedStatement.cpp b/src/server/database/Database/PreparedStatement.cpp index f287937b8bf..32590c95adf 100644 --- a/src/server/database/Database/PreparedStatement.cpp +++ b/src/server/database/Database/PreparedStatement.cpp @@ -225,7 +225,7 @@ bool PreparedStatementTask::Execute() if (!result || !result->GetRowCount()) { delete result; - m_result->set_value(PreparedQueryResult(NULL)); + m_result->set_value(PreparedQueryResult(nullptr)); return false; } m_result->set_value(PreparedQueryResult(result)); diff --git a/src/server/database/Database/QueryHolder.cpp b/src/server/database/Database/QueryHolder.cpp index 97cb186f990..953a54fecaa 100644 --- a/src/server/database/Database/QueryHolder.cpp +++ b/src/server/database/Database/QueryHolder.cpp @@ -47,7 +47,7 @@ void SQLQueryHolderBase::SetPreparedResult(size_t index, PreparedResultSet* resu if (result && !result->GetRowCount()) { delete result; - result = NULL; + result = nullptr; } /// store the result in the holder diff --git a/src/server/database/Database/QueryResult.cpp b/src/server/database/Database/QueryResult.cpp index 4fd69b908c7..2bc85fc5006 100644 --- a/src/server/database/Database/QueryResult.cpp +++ b/src/server/database/Database/QueryResult.cpp @@ -183,7 +183,7 @@ PreparedResultSet::PreparedResultSet(MySQLStmt* stmt, MySQLResult* result, uint6 m_rowCount(rowCount), m_rowPosition(0), m_fieldCount(fieldCount), -m_rBind(NULL), +m_rBind(nullptr), m_stmt(stmt), m_metadataResult(result) { @@ -235,7 +235,7 @@ m_metadataResult(result) m_rBind[i].buffer_length = size; m_rBind[i].length = &m_length[i]; m_rBind[i].is_null = &m_isNull[i]; - m_rBind[i].error = NULL; + m_rBind[i].error = nullptr; m_rBind[i].is_unsigned = field[i].flags & UNSIGNED_FLAG; } @@ -375,13 +375,13 @@ void ResultSet::CleanUp() if (_currentRow) { delete [] _currentRow; - _currentRow = NULL; + _currentRow = nullptr; } if (_result) { mysql_free_result(_result); - _result = NULL; + _result = nullptr; } } diff --git a/src/server/database/Database/SQLOperation.h b/src/server/database/Database/SQLOperation.h index a9d8ebc120e..ba855e57e72 100644 --- a/src/server/database/Database/SQLOperation.h +++ b/src/server/database/Database/SQLOperation.h @@ -54,7 +54,7 @@ class MySQLConnection; class TC_DATABASE_API SQLOperation { public: - SQLOperation(): m_conn(NULL) { } + SQLOperation(): m_conn(nullptr) { } virtual ~SQLOperation() { } virtual int call() |
