BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
DbInterface Class Referenceabstract

#include <DbInterface.h>

Inheritance diagram for DbInterface:

Public Member Functions

 DbInterface ()
virtual ~DbInterface ()
virtual int connect ()=0
virtual int select_db (std::string dbname)=0
virtual int query (std::string dbname, std::string query, DatabaseRecordVector &records)=0
virtual int query (std::string dbname, std::string query)=0
virtual int disconnect ()=0
bool is_connected ()
void set_host (std::string host)
void set_user (std::string user)
void set_passwd (std::string passwd)
void set_dbpath (std::string path)
void set_port (int port)
void set_reuse_connection (bool flag)

Protected Attributes

bool m_isConnected
bool m_reuseConnection
std::string m_dbName
std::string m_dbHost
int m_dbPort
std::string m_dbUser
std::string m_dbPasswd
std::string m_dbPath

Detailed Description

Definition at line 10 of file DbInterface.h.

Constructor & Destructor Documentation

◆ DbInterface()

DbInterface::DbInterface ( )

Definition at line 3 of file DbInterface.cxx.

3 {
4 m_isConnected = false;
5 m_reuseConnection = false;
6 m_dbName = "offlinedb";
7 m_dbPort = 3306;
8}
std::string m_dbName
Definition DbInterface.h:40
bool m_reuseConnection
Definition DbInterface.h:38
bool m_isConnected
Definition DbInterface.h:37

◆ ~DbInterface()

DbInterface::~DbInterface ( )
virtual

Definition at line 10 of file DbInterface.cxx.

10{}

Member Function Documentation

◆ connect()

virtual int DbInterface::connect ( )
pure virtual

Implemented in MysqlInterface, and SqliteInterface.

◆ disconnect()

virtual int DbInterface::disconnect ( )
pure virtual

Implemented in MysqlInterface, and SqliteInterface.

◆ is_connected()

bool DbInterface::is_connected ( )
inline

Definition at line 27 of file DbInterface.h.

27{ return m_isConnected; }

◆ query() [1/2]

virtual int DbInterface::query ( std::string dbname,
std::string query )
pure virtual

Implemented in MysqlInterface, and SqliteInterface.

◆ query() [2/2]

virtual int DbInterface::query ( std::string dbname,
std::string query,
DatabaseRecordVector & records )
pure virtual

Implemented in MysqlInterface, and SqliteInterface.

Referenced by query(), and query().

◆ select_db()

virtual int DbInterface::select_db ( std::string dbname)
pure virtual

Implemented in MysqlInterface, and SqliteInterface.

◆ set_dbpath()

void DbInterface::set_dbpath ( std::string path)
inline

Definition at line 32 of file DbInterface.h.

32{ m_dbPath = path; };
std::string m_dbPath
Definition DbInterface.h:46

◆ set_host()

void DbInterface::set_host ( std::string host)
inline

Definition at line 29 of file DbInterface.h.

29{ m_dbHost = host; };
std::string m_dbHost
Definition DbInterface.h:42

◆ set_passwd()

void DbInterface::set_passwd ( std::string passwd)
inline

Definition at line 31 of file DbInterface.h.

31{ m_dbPasswd = passwd; };
std::string m_dbPasswd
Definition DbInterface.h:45

◆ set_port()

void DbInterface::set_port ( int port)
inline

Definition at line 33 of file DbInterface.h.

33{ m_dbPort = port; };

◆ set_reuse_connection()

void DbInterface::set_reuse_connection ( bool flag)
inline

Definition at line 34 of file DbInterface.h.

◆ set_user()

void DbInterface::set_user ( std::string user)
inline

Definition at line 30 of file DbInterface.h.

30{ m_dbUser = user; };
std::string m_dbUser
Definition DbInterface.h:44

Member Data Documentation

◆ m_dbHost

std::string DbInterface::m_dbHost
protected

◆ m_dbName

std::string DbInterface::m_dbName
protected

◆ m_dbPasswd

std::string DbInterface::m_dbPasswd
protected

◆ m_dbPath

std::string DbInterface::m_dbPath
protected

Definition at line 46 of file DbInterface.h.

Referenced by SqliteInterface::select_db(), and set_dbpath().

◆ m_dbPort

int DbInterface::m_dbPort
protected

◆ m_dbUser

std::string DbInterface::m_dbUser
protected

◆ m_isConnected

◆ m_reuseConnection

bool DbInterface::m_reuseConnection
protected

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