mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-21 01:37:37 +01:00
Core/DBLayer: Store MySQL connection details in a struct and print relevant data in sql driver messages
--HG-- branch : trunk
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
|
||||
#include <ace/Activation_Queue.h>
|
||||
#include "DatabaseWorkerPool.h"
|
||||
#include "Util.h"
|
||||
|
||||
#ifndef _MYSQLCONNECTION_H
|
||||
#define _MYSQLCONNECTION_H
|
||||
@@ -27,6 +28,33 @@ class PreparedStatement;
|
||||
class MySQLPreparedStatement;
|
||||
class PingOperation;
|
||||
|
||||
struct MySQLConnectionInfo
|
||||
{
|
||||
MySQLConnectionInfo() {}
|
||||
MySQLConnectionInfo(const std::string& infoString)
|
||||
{
|
||||
Tokens tokens = StrSplit(infoString, ";");
|
||||
Tokens::iterator iter = tokens.begin();
|
||||
|
||||
if (iter != tokens.end())
|
||||
host = *iter++;
|
||||
if (iter != tokens.end())
|
||||
port_or_socket = *iter++;
|
||||
if (iter != tokens.end())
|
||||
user = *iter++;
|
||||
if (iter != tokens.end())
|
||||
password = *iter++;
|
||||
if (iter != tokens.end())
|
||||
database = *iter++;
|
||||
}
|
||||
|
||||
std::string user;
|
||||
std::string password;
|
||||
std::string database;
|
||||
std::string host;
|
||||
std::string port_or_socket;
|
||||
};
|
||||
|
||||
class MySQLConnection
|
||||
{
|
||||
template <class T> friend class DatabaseWorkerPool;
|
||||
@@ -37,7 +65,7 @@ class MySQLConnection
|
||||
MySQLConnection(ACE_Activation_Queue* queue); //! Constructor for asynchroneous connections.
|
||||
~MySQLConnection();
|
||||
|
||||
virtual bool Open(const std::string& infoString); //! Connection details.
|
||||
virtual bool Open(const MySQLConnectionInfo& connInfo); //! Connection details.
|
||||
void Close();
|
||||
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user