DDraceNetwork Docs
CMysqlConnection Class Reference
Inheritance diagram for CMysqlConnection:
[legend]
Collaboration diagram for CMysqlConnection:
[legend]

Classes

class  CStmtDeleter
 
union  UParameterExtra
 

Public Member Functions

 CMysqlConnection (CMysqlConfig m_Config)
 
 ~CMysqlConnection ()
 
void Print (IConsole *pConsole, const char *pMode) override
 
const char * BinaryCollate () const override
 
void ToUnixTimestamp (const char *pTimestamp, char *aBuf, unsigned int BufferSize) override
 
const char * InsertTimestampAsUtc () const override
 
const char * CollateNocase () const override
 
const char * InsertIgnore () const override
 
const char * Random () const override
 
const char * MedianMapTime (char *pBuffer, int BufferSize) const override
 
const char * False () const override
 
const char * True () const override
 
bool Connect (char *pError, int ErrorSize) override
 
void Disconnect () override
 
bool PrepareStatement (const char *pStmt, char *pError, int ErrorSize) override
 
void BindString (int Idx, const char *pString) override
 
void BindBlob (int Idx, unsigned char *pBlob, int Size) override
 
void BindInt (int Idx, int Value) override
 
void BindInt64 (int Idx, int64_t Value) override
 
void BindFloat (int Idx, float Value) override
 
void BindNull (int Idx) override
 
void Print () override
 
bool Step (bool *pEnd, char *pError, int ErrorSize) override
 
bool ExecuteUpdate (int *pNumUpdated, char *pError, int ErrorSize) override
 
bool IsNull (int Col) override
 
float GetFloat (int Col) override
 
int GetInt (int Col) override
 
int64_t GetInt64 (int Col) override
 
void GetString (int Col, char *pBuffer, int BufferSize) override
 
int GetBlob (int Col, unsigned char *pBuffer, int BufferSize) override
 
bool AddPoints (const char *pPlayer, int Points, char *pError, int ErrorSize) override
 
- Public Member Functions inherited from IDbConnection
 IDbConnection (const char *pPrefix)
 
virtual ~IDbConnection ()
 
IDbConnectionoperator= (const IDbConnection &)=delete
 
virtual void Print (IConsole *pConsole, const char *pMode)=0
 
const char * GetPrefix () const
 
virtual const char * BinaryCollate () const =0
 
virtual void ToUnixTimestamp (const char *pTimestamp, char *aBuf, unsigned int BufferSize)=0
 
virtual const char * InsertTimestampAsUtc () const =0
 
virtual const char * CollateNocase () const =0
 
virtual const char * InsertIgnore () const =0
 
virtual const char * Random () const =0
 
virtual const char * MedianMapTime (char *pBuffer, int BufferSize) const =0
 
virtual const char * False () const =0
 
virtual const char * True () const =0
 
virtual bool Connect (char *pError, int ErrorSize)=0
 
virtual void Disconnect ()=0
 
virtual bool PrepareStatement (const char *pStmt, char *pError, int ErrorSize)=0
 
virtual void BindString (int Idx, const char *pString)=0
 
virtual void BindBlob (int Idx, unsigned char *pBlob, int Size)=0
 
virtual void BindInt (int Idx, int Value)=0
 
virtual void BindInt64 (int Idx, int64_t Value)=0
 
virtual void BindFloat (int Idx, float Value)=0
 
virtual void BindNull (int Idx)=0
 
virtual void Print ()=0
 
virtual bool Step (bool *pEnd, char *pError, int ErrorSize)=0
 
virtual bool ExecuteUpdate (int *pNumUpdated, char *pError, int ErrorSize)=0
 
virtual bool IsNull (int Col)=0
 
virtual float GetFloat (int Col)=0
 
virtual int GetInt (int Col)=0
 
virtual int64_t GetInt64 (int Col)=0
 
virtual void GetString (int Col, char *pBuffer, int BufferSize)=0
 
virtual int GetBlob (int Col, unsigned char *pBuffer, int BufferSize)=0
 
virtual bool AddPoints (const char *pPlayer, int Points, char *pError, int ErrorSize)=0
 

Private Member Functions

void StoreErrorMysql (const char *pContext)
 
void StoreErrorStmt (const char *pContext)
 
bool ConnectImpl ()
 
bool PrepareAndExecuteStatement (const char *pStmt)
 

Private Attributes

char m_aErrorDetail [128]
 
bool m_NewQuery = false
 
bool m_HaveConnection = false
 
MYSQL m_Mysql
 
std::unique_ptr< MYSQL_STMT, CStmtDeleterm_pStmt = nullptr
 
std::vector< MYSQL_BIND > m_vStmtParameters
 
std::vector< UParameterExtram_vStmtParameterExtras
 
CMysqlConfig m_Config
 
std::atomic_bool m_InUse
 

Additional Inherited Members

- Protected Member Functions inherited from IDbConnection
void FormatCreateRace (char *aBuf, unsigned int BufferSize, bool Backup) const
 
void FormatCreateTeamrace (char *aBuf, unsigned int BufferSize, const char *pIdType, bool Backup) const
 
void FormatCreateMaps (char *aBuf, unsigned int BufferSize) const
 
void FormatCreateSaves (char *aBuf, unsigned int BufferSize, bool Backup) const
 
void FormatCreatePoints (char *aBuf, unsigned int BufferSize) const
 

Constructor & Destructor Documentation

◆ CMysqlConnection()

CMysqlConnection::CMysqlConnection ( CMysqlConfig  m_Config)
explicit

◆ ~CMysqlConnection()

CMysqlConnection::~CMysqlConnection ( )

Member Function Documentation

◆ AddPoints()

bool CMysqlConnection::AddPoints ( const char *  pPlayer,
int  Points,
char *  pError,
int  ErrorSize 
)
overridevirtual

Implements IDbConnection.

◆ BinaryCollate()

const char * CMysqlConnection::BinaryCollate ( ) const
inlineoverridevirtual

Implements IDbConnection.

◆ BindBlob()

void CMysqlConnection::BindBlob ( int  Idx,
unsigned char *  pBlob,
int  Size 
)
overridevirtual

Implements IDbConnection.

◆ BindFloat()

void CMysqlConnection::BindFloat ( int  Idx,
float  Value 
)
overridevirtual

Implements IDbConnection.

◆ BindInt()

void CMysqlConnection::BindInt ( int  Idx,
int  Value 
)
overridevirtual

Implements IDbConnection.

◆ BindInt64()

void CMysqlConnection::BindInt64 ( int  Idx,
int64_t  Value 
)
overridevirtual

Implements IDbConnection.

◆ BindNull()

void CMysqlConnection::BindNull ( int  Idx)
overridevirtual

Implements IDbConnection.

◆ BindString()

void CMysqlConnection::BindString ( int  Idx,
const char *  pString 
)
overridevirtual

Implements IDbConnection.

◆ CollateNocase()

const char * CMysqlConnection::CollateNocase ( ) const
inlineoverridevirtual

Implements IDbConnection.

◆ Connect()

bool CMysqlConnection::Connect ( char *  pError,
int  ErrorSize 
)
overridevirtual

Implements IDbConnection.

◆ ConnectImpl()

bool CMysqlConnection::ConnectImpl ( )
private

◆ Disconnect()

void CMysqlConnection::Disconnect ( )
overridevirtual

Implements IDbConnection.

◆ ExecuteUpdate()

bool CMysqlConnection::ExecuteUpdate ( int *  pNumUpdated,
char *  pError,
int  ErrorSize 
)
overridevirtual

Implements IDbConnection.

◆ False()

const char * CMysqlConnection::False ( ) const
inlineoverridevirtual

Implements IDbConnection.

◆ GetBlob()

int CMysqlConnection::GetBlob ( int  Col,
unsigned char *  pBuffer,
int  BufferSize 
)
overridevirtual

Implements IDbConnection.

◆ GetFloat()

float CMysqlConnection::GetFloat ( int  Col)
overridevirtual

Implements IDbConnection.

◆ GetInt()

int CMysqlConnection::GetInt ( int  Col)
overridevirtual

Implements IDbConnection.

◆ GetInt64()

int64_t CMysqlConnection::GetInt64 ( int  Col)
overridevirtual

Implements IDbConnection.

◆ GetString()

void CMysqlConnection::GetString ( int  Col,
char *  pBuffer,
int  BufferSize 
)
overridevirtual

Implements IDbConnection.

◆ InsertIgnore()

const char * CMysqlConnection::InsertIgnore ( ) const
inlineoverridevirtual

Implements IDbConnection.

◆ InsertTimestampAsUtc()

const char * CMysqlConnection::InsertTimestampAsUtc ( ) const
inlineoverridevirtual

Implements IDbConnection.

◆ IsNull()

bool CMysqlConnection::IsNull ( int  Col)
overridevirtual

Implements IDbConnection.

◆ MedianMapTime()

const char * CMysqlConnection::MedianMapTime ( char *  pBuffer,
int  BufferSize 
) const
overridevirtual

Implements IDbConnection.

◆ PrepareAndExecuteStatement()

bool CMysqlConnection::PrepareAndExecuteStatement ( const char *  pStmt)
private

◆ PrepareStatement()

bool CMysqlConnection::PrepareStatement ( const char *  pStmt,
char *  pError,
int  ErrorSize 
)
overridevirtual

Implements IDbConnection.

◆ Print() [1/2]

void CMysqlConnection::Print ( )
inlineoverridevirtual

Implements IDbConnection.

◆ Print() [2/2]

void CMysqlConnection::Print ( IConsole pConsole,
const char *  pMode 
)
overridevirtual

Implements IDbConnection.

◆ Random()

const char * CMysqlConnection::Random ( ) const
inlineoverridevirtual

Implements IDbConnection.

◆ Step()

bool CMysqlConnection::Step ( bool *  pEnd,
char *  pError,
int  ErrorSize 
)
overridevirtual

Implements IDbConnection.

◆ StoreErrorMysql()

void CMysqlConnection::StoreErrorMysql ( const char *  pContext)
private

◆ StoreErrorStmt()

void CMysqlConnection::StoreErrorStmt ( const char *  pContext)
private

◆ ToUnixTimestamp()

void CMysqlConnection::ToUnixTimestamp ( const char *  pTimestamp,
char *  aBuf,
unsigned int  BufferSize 
)
overridevirtual

Implements IDbConnection.

◆ True()

const char * CMysqlConnection::True ( ) const
inlineoverridevirtual

Implements IDbConnection.

Member Data Documentation

◆ m_aErrorDetail

char CMysqlConnection::m_aErrorDetail[128]
private

◆ m_Config

CMysqlConfig CMysqlConnection::m_Config
private

◆ m_HaveConnection

bool CMysqlConnection::m_HaveConnection = false
private

◆ m_InUse

std::atomic_bool CMysqlConnection::m_InUse
private

◆ m_Mysql

MYSQL CMysqlConnection::m_Mysql
private

◆ m_NewQuery

bool CMysqlConnection::m_NewQuery = false
private

◆ m_pStmt

std::unique_ptr<MYSQL_STMT, CStmtDeleter> CMysqlConnection::m_pStmt = nullptr
private

◆ m_vStmtParameterExtras

std::vector<UParameterExtra> CMysqlConnection::m_vStmtParameterExtras
private

◆ m_vStmtParameters

std::vector<MYSQL_BIND> CMysqlConnection::m_vStmtParameters
private

The documentation for this class was generated from the following file: