diff options
Diffstat (limited to 'src/server/shared')
-rw-r--r-- | src/server/shared/DataStores/DBCFileLoader.h | 3 | ||||
-rw-r--r-- | src/server/shared/DataStores/DBCStore.h | 7 | ||||
-rw-r--r-- | src/server/shared/Database/DatabaseWorker.h | 5 | ||||
-rw-r--r-- | src/server/shared/Database/DatabaseWorkerPool.h | 16 | ||||
-rw-r--r-- | src/server/shared/Database/MySQLConnection.h | 6 | ||||
-rw-r--r-- | src/server/shared/Database/PreparedStatement.h | 6 | ||||
-rw-r--r-- | src/server/shared/Database/QueryResult.h | 5 | ||||
-rw-r--r-- | src/server/shared/Database/SQLOperation.h | 4 | ||||
-rw-r--r-- | src/server/shared/Define.h | 2 | ||||
-rw-r--r-- | src/server/shared/Packets/ByteBuffer.h | 2 | ||||
-rw-r--r-- | src/server/shared/Threading/Callback.h | 6 |
11 files changed, 52 insertions, 10 deletions
diff --git a/src/server/shared/DataStores/DBCFileLoader.h b/src/server/shared/DataStores/DBCFileLoader.h index 0084e3b9381..fac6ef4eef0 100644 --- a/src/server/shared/DataStores/DBCFileLoader.h +++ b/src/server/shared/DataStores/DBCFileLoader.h @@ -91,5 +91,8 @@ class DBCFileLoader uint32 *fieldsOffset; unsigned char *data; unsigned char *stringTable; + + DBCFileLoader(DBCFileLoader const& right) DELETE_MEMBER; + DBCFileLoader& operator=(DBCFileLoader const& right) DELETE_MEMBER; }; #endif diff --git a/src/server/shared/DataStores/DBCStore.h b/src/server/shared/DataStores/DBCStore.h index 5f252318c8d..198f64c5ebf 100644 --- a/src/server/shared/DataStores/DBCStore.h +++ b/src/server/shared/DataStores/DBCStore.h @@ -63,6 +63,10 @@ struct SqlDbc } } } + +private: + SqlDbc(SqlDbc const& right) DELETE_MEMBER; + SqlDbc& operator=(SqlDbc const& right) DELETE_MEMBER; }; template<class T> @@ -291,6 +295,9 @@ class DBCStorage T* dataTable; StringPoolList stringPoolList; + + DBCStorage(DBCStorage const& right) DELETE_MEMBER; + DBCStorage& operator=(DBCStorage const& right) DELETE_MEMBER; }; #endif diff --git a/src/server/shared/Database/DatabaseWorker.h b/src/server/shared/Database/DatabaseWorker.h index 14e92924ed2..734ec790027 100644 --- a/src/server/shared/Database/DatabaseWorker.h +++ b/src/server/shared/Database/DatabaseWorker.h @@ -18,6 +18,7 @@ #ifndef _WORKERTHREAD_H #define _WORKERTHREAD_H +#include "Define.h" #include <ace/Task.h> #include <ace/Activation_Queue.h> @@ -33,9 +34,11 @@ class DatabaseWorker : protected ACE_Task_Base int wait() { return ACE_Task_Base::wait(); } private: - DatabaseWorker() : ACE_Task_Base() { } ACE_Activation_Queue* m_queue; MySQLConnection* m_conn; + + DatabaseWorker(DatabaseWorker const& right) DELETE_MEMBER; + DatabaseWorker& operator=(DatabaseWorker const& right) DELETE_MEMBER; }; #endif diff --git a/src/server/shared/Database/DatabaseWorkerPool.h b/src/server/shared/Database/DatabaseWorkerPool.h index e2ebda9e8ae..c60458323f7 100644 --- a/src/server/shared/Database/DatabaseWorkerPool.h +++ b/src/server/shared/Database/DatabaseWorkerPool.h @@ -49,8 +49,7 @@ class DatabaseWorkerPool { public: /* Activity state */ - DatabaseWorkerPool() : - _queue(new ACE_Activation_Queue()) + DatabaseWorkerPool() : _queue(new ACE_Activation_Queue()), _connectionInfo(NULL) { memset(_connectionCount, 0, sizeof(_connectionCount)); _connections.resize(IDX_SIZE); @@ -66,7 +65,7 @@ class DatabaseWorkerPool bool Open(const std::string& infoString, uint8 async_threads, uint8 synch_threads) { bool res = true; - _connectionInfo = MySQLConnectionInfo(infoString); + _connectionInfo = new MySQLConnectionInfo(infoString); TC_LOG_INFO("sql.driver", "Opening DatabasePool '%s'. Asynchronous connections: %u, synchronous connections: %u.", GetDatabaseName(), async_threads, synch_threads); @@ -75,7 +74,7 @@ class DatabaseWorkerPool _connections[IDX_ASYNC].resize(async_threads); for (uint8 i = 0; i < async_threads; ++i) { - T* t = new T(_queue, _connectionInfo); + T* t = new T(_queue, *_connectionInfo); res &= t->Open(); if (res) // only check mysql version if connection is valid WPFatal(mysql_get_server_version(t->GetHandle()) >= MIN_MYSQL_SERVER_VERSION, "TrinityCore does not support MySQL versions below 5.1"); @@ -87,7 +86,7 @@ class DatabaseWorkerPool _connections[IDX_SYNCH].resize(synch_threads); for (uint8 i = 0; i < synch_threads; ++i) { - T* t = new T(_connectionInfo); + T* t = new T(*_connectionInfo); res &= t->Open(); _connections[IDX_SYNCH][i] = t; ++_connectionCount[IDX_SYNCH]; @@ -134,6 +133,9 @@ class DatabaseWorkerPool delete _queue; TC_LOG_INFO("sql.driver", "All connections on DatabasePool '%s' closed.", GetDatabaseName()); + + delete _connectionInfo; + _connectionInfo = NULL; } /** @@ -507,7 +509,7 @@ class DatabaseWorkerPool char const* GetDatabaseName() const { - return _connectionInfo.database.c_str(); + return _connectionInfo->database.c_str(); } private: @@ -521,7 +523,7 @@ class DatabaseWorkerPool ACE_Activation_Queue* _queue; //! Queue shared by async worker threads. std::vector< std::vector<T*> > _connections; uint32 _connectionCount[2]; //! Counter of MySQL connections; - MySQLConnectionInfo _connectionInfo; + MySQLConnectionInfo* _connectionInfo; }; #endif diff --git a/src/server/shared/Database/MySQLConnection.h b/src/server/shared/Database/MySQLConnection.h index 161f459a7ad..e55e3dfc23a 100644 --- a/src/server/shared/Database/MySQLConnection.h +++ b/src/server/shared/Database/MySQLConnection.h @@ -38,8 +38,7 @@ enum ConnectionFlags struct MySQLConnectionInfo { - MySQLConnectionInfo() { } - MySQLConnectionInfo(const std::string& infoString) + explicit MySQLConnectionInfo(std::string const& infoString) { Tokenizer tokens(infoString, ';'); @@ -132,6 +131,9 @@ class MySQLConnection MySQLConnectionInfo& m_connectionInfo; //! Connection info (used for logging) ConnectionFlags m_connectionFlags; //! Connection flags (for preparing relevant statements) ACE_Thread_Mutex m_Mutex; + + MySQLConnection(MySQLConnection const& right) DELETE_MEMBER; + MySQLConnection& operator=(MySQLConnection const& right) DELETE_MEMBER; }; #endif diff --git a/src/server/shared/Database/PreparedStatement.h b/src/server/shared/Database/PreparedStatement.h index 6a4d03bfb4d..9ccd16e3d5c 100644 --- a/src/server/shared/Database/PreparedStatement.h +++ b/src/server/shared/Database/PreparedStatement.h @@ -101,6 +101,9 @@ class PreparedStatement MySQLPreparedStatement* m_stmt; uint32 m_index; std::vector<PreparedStatementData> statement_data; //- Buffer of parameters, not tied to MySQL in any way yet + + PreparedStatement(PreparedStatement const& right) DELETE_MEMBER; + PreparedStatement& operator=(PreparedStatement const& right) DELETE_MEMBER; }; //- Class of which the instances are unique per MySQLConnection @@ -145,6 +148,9 @@ class MySQLPreparedStatement uint32 m_paramCount; std::vector<bool> m_paramsSet; MYSQL_BIND* m_bind; + + MySQLPreparedStatement(MySQLPreparedStatement const& right) DELETE_MEMBER; + MySQLPreparedStatement& operator=(MySQLPreparedStatement const& right) DELETE_MEMBER; }; typedef ACE_Future<PreparedQueryResult> PreparedQueryResultFuture; diff --git a/src/server/shared/Database/QueryResult.h b/src/server/shared/Database/QueryResult.h index 74320aeba19..a09506c6621 100644 --- a/src/server/shared/Database/QueryResult.h +++ b/src/server/shared/Database/QueryResult.h @@ -55,6 +55,9 @@ class ResultSet void CleanUp(); MYSQL_RES* _result; MYSQL_FIELD* _fields; + + ResultSet(ResultSet const& right) DELETE_MEMBER; + ResultSet& operator=(ResultSet const& right) DELETE_MEMBER; }; typedef Trinity::AutoPtr<ResultSet, ACE_Thread_Mutex> QueryResult; @@ -100,6 +103,8 @@ class PreparedResultSet void CleanUp(); bool _NextRow(); + PreparedResultSet(PreparedResultSet const& right) DELETE_MEMBER; + PreparedResultSet& operator=(PreparedResultSet const& right) DELETE_MEMBER; }; typedef Trinity::AutoPtr<PreparedResultSet, ACE_Thread_Mutex> PreparedQueryResult; diff --git a/src/server/shared/Database/SQLOperation.h b/src/server/shared/Database/SQLOperation.h index 2c404c131ae..eb32b60c74d 100644 --- a/src/server/shared/Database/SQLOperation.h +++ b/src/server/shared/Database/SQLOperation.h @@ -69,6 +69,10 @@ class SQLOperation : public ACE_Method_Request virtual void SetConnection(MySQLConnection* con) { m_conn = con; } MySQLConnection* m_conn; + + private: + SQLOperation(SQLOperation const& right) DELETE_MEMBER; + SQLOperation& operator=(SQLOperation const& right) DELETE_MEMBER; }; #endif diff --git a/src/server/shared/Define.h b/src/server/shared/Define.h index a7fbfda641c..68ce6c6d6b4 100644 --- a/src/server/shared/Define.h +++ b/src/server/shared/Define.h @@ -73,9 +73,11 @@ #if COMPILER_HAS_CPP11_SUPPORT # define OVERRIDE override # define FINAL final +# define DELETE_MEMBER = delete #else # define OVERRIDE # define FINAL +# define DELETE_MEMBER #endif //COMPILER_HAS_CPP11_SUPPORT #define UI64FMTD ACE_UINT64_FORMAT_SPECIFIER diff --git a/src/server/shared/Packets/ByteBuffer.h b/src/server/shared/Packets/ByteBuffer.h index a1369b005b7..906633a1254 100644 --- a/src/server/shared/Packets/ByteBuffer.h +++ b/src/server/shared/Packets/ByteBuffer.h @@ -85,6 +85,8 @@ class ByteBuffer { } + virtual ~ByteBuffer() { } + void clear() { _storage.clear(); diff --git a/src/server/shared/Threading/Callback.h b/src/server/shared/Threading/Callback.h index b074ff49c3c..c3717228870 100644 --- a/src/server/shared/Threading/Callback.h +++ b/src/server/shared/Threading/Callback.h @@ -109,6 +109,9 @@ class QueryCallback ACE_Future<Result> _result; ParamType _param; uint8 _stage; + + QueryCallback(QueryCallback const& right) DELETE_MEMBER; + QueryCallback& operator=(QueryCallback const& right) DELETE_MEMBER; }; template <typename Result, typename ParamType1, typename ParamType2, bool chain = false> @@ -201,6 +204,9 @@ class QueryCallback_2 ParamType1 _param_1; ParamType2 _param_2; uint8 _stage; + + QueryCallback_2(QueryCallback_2 const& right) DELETE_MEMBER; + QueryCallback_2& operator=(QueryCallback_2 const& right) DELETE_MEMBER; }; #endif
\ No newline at end of file |