You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.6 KiB
45 lines
1.6 KiB
#ifndef _database_class_h_
|
|
#define _database_class_h_
|
|
|
|
#include "../../components/base/basicTypes.h"
|
|
#include "../../components/base/basicMutex.h"
|
|
#include "../../components/base/basicLogCollection.h"
|
|
#include <mysql/mysql.h>
|
|
|
|
#ifdef DEBUG
|
|
//#define DEBUG_MYSQL_QUERIES
|
|
#endif
|
|
|
|
class MySQL_Connector{
|
|
private:
|
|
basicLogCollection * m_pLog;
|
|
bool m_bIsConnected;
|
|
basicMutex m_mAccessMutex;
|
|
MYSQL * m_pDBLink;
|
|
MYSQL_RES * m_pResult;
|
|
MYSQL_ROW m_pRow;
|
|
CSTR m_pDBName;
|
|
CSTR m_pDBHost;
|
|
CSTR m_pDBUser;
|
|
CSTR m_pDBPassword;
|
|
uint16_t m_nPort;
|
|
public:
|
|
MySQL_Connector();
|
|
MySQL_Connector( CSTR DBHost, CSTR DBUser, CSTR DBPassword, U16 Port = 3300 );
|
|
MySQL_Connector( CSTR DBName, CSTR DBHost, CSTR DBUser, CSTR DBPassword, U16 Port = 3300 );
|
|
//MySQL_Connector( char *LocalUnixSocket, char *DBUser, char* DBPassword );
|
|
virtual ~MySQL_Connector();
|
|
bool Connect( CSTR DBHost, CSTR DBUser, CSTR DBPassword, uint16_t Port = 3300 );
|
|
bool Connect( CSTR DBName, CSTR DBHost, CSTR DBUser, CSTR DBPassword, uint16_t Port = 3300 );
|
|
bool ReConnect( void );
|
|
CSTR escapeString( CSTR str );
|
|
bool isConnected( void ){ return m_bIsConnected; };
|
|
uint64_t QueryID( CSTR QS );
|
|
void SilentQuery( CSTR QS );
|
|
AAssoc * Query( CSTR QS, bool useCache = false );
|
|
};
|
|
|
|
void deleteResult( AAssoc * );
|
|
//extern MySQL_Connector DBC;
|
|
|
|
#endif
|