BOSS 7.1.1
BESIII Offline Software System
Loading...
Searching...
No Matches
rdbModel::Connection Class Referenceabstract

#include <Connection.h>

+ Inheritance diagram for rdbModel::Connection:

Public Member Functions

 Connection ()
 
virtual ~Connection ()
 
virtual bool open (const std::string &host, const std::string &userid, const std::string &password, const std::string &dbName)=0
 
virtual bool close ()=0
 
virtual bool open (const std::string &parms)=0
 
virtual bool isConnected ()=0
 Return true iff open has been done with no matching close.
 
virtual std::ostream * getOut () const =0
 
virtual std::ostream * getErrOut () const =0
 
virtual MATCH matchSchema (Rdb *rdb, bool matchDbName=true)=0
 
virtual bool insertRow (const std::string &tableName, const StringVector &colNames, const StringVector &values, int *auto_value=0, const StringVector *nullCols=0)=0
 
virtual unsigned int update (const std::string &tableName, const StringVector &colNames, const StringVector &values, const Assertion *where=0, const StringVector *nullCols=0)=0
 
virtual ResultHandleselect (const std::string &tableName, const StringVector &getCols, const StringVector &orderCols, const Assertion *where=0, int rowLimit=0, int rowOffset=0)=0
 
virtual void disableModify (bool disable)=0
 
virtual ResultHandledbRequest (const std::string &request)=0
 
virtual bool compileAssertion (const Assertion *a, std::string &sqlString) const =0
 

Detailed Description

Definition at line 54 of file Connection.h.

Constructor & Destructor Documentation

◆ Connection()

rdbModel::Connection::Connection ( )
inline

Open a connection Allowed operations will depend on userid, etc., specified return true if successful

Definition at line 60 of file Connection.h.

60{};

◆ ~Connection()

virtual rdbModel::Connection::~Connection ( )
inlinevirtual

Definition at line 61 of file Connection.h.

61{};

Member Function Documentation

◆ close()

virtual bool rdbModel::Connection::close ( )
pure virtual

Close the current open connection , if any. Return true if there was a connection to close and it was closed successfully

Implemented in rdbModel::MysqlConnection.

Referenced by calibUtil::Metadata::disconnectRead(), ConnectionDBBase::disconnectRead(), calibUtil::Metadata::disconnectWrite(), and ConnectionDBBase::disconnectWrite().

◆ compileAssertion()

virtual bool rdbModel::Connection::compileAssertion ( const Assertion * a,
std::string & sqlString ) const
pure virtual

compile method for assertions. Use it internally, but also make it publicly available so assertions belonging to a table can save the compiled version.

Implemented in rdbModel::MysqlConnection.

◆ dbRequest()

virtual ResultHandle * rdbModel::Connection::dbRequest ( const std::string & request)
pure virtual

Transmit raw request of any form to database. If it is a request that returns results, those results will be stored in a newly- allocated ResultHandle and dbRequest will return a pointer to it. Otherwise dbRequest will return a null pointer. Throw an exception if request fails for any reason.

Implemented in rdbModel::MysqlConnection.

◆ disableModify()

virtual void rdbModel::Connection::disableModify ( bool disable)
pure virtual

Turn select and update into no-ops: output SQL string for debugging but don't change db

Implemented in rdbModel::MysqlConnection.

◆ getErrOut()

virtual std::ostream * rdbModel::Connection::getErrOut ( ) const
pure virtual

◆ getOut()

virtual std::ostream * rdbModel::Connection::getOut ( ) const
pure virtual

◆ insertRow()

virtual bool rdbModel::Connection::insertRow ( const std::string & tableName,
const StringVector & colNames,
const StringVector & values,
int * auto_value = 0,
const StringVector * nullCols = 0 )
pure virtual

Typical derived class will form a syntactically correct INSERT statement from the input arguments and issue it to the dbms. Return true if row was inserted successfully

Might also want to add a routine for INSERT ... SELECT

Implemented in rdbModel::MysqlConnection.

Referenced by rdbModel::Table::insertLatest(), rdbModel::Table::insertRow(), and calibUtil::Metadata::registerCalib().

◆ isConnected()

virtual bool rdbModel::Connection::isConnected ( )
pure virtual

Return true iff open has been done with no matching close.

Implemented in rdbModel::MysqlConnection.

◆ matchSchema()

virtual MATCH rdbModel::Connection::matchSchema ( Rdb * rdb,
bool matchDbName = true )
pure virtual

Check to what degree local schema definition is compatible with remote db accessed via this connection. By default check db names match, but this may be disabled.

Implemented in rdbModel::MysqlConnection.

◆ open() [1/2]

virtual bool rdbModel::Connection::open ( const std::string & host,
const std::string & userid,
const std::string & password,
const std::string & dbName )
pure virtual

Implemented in rdbModel::MysqlConnection.

◆ open() [2/2]

virtual bool rdbModel::Connection::open ( const std::string & parms)
pure virtual

Parameter is normally path for an xml file descrbing the connection parameters

Implemented in rdbModel::MysqlConnection.

◆ select()

virtual ResultHandle * rdbModel::Connection::select ( const std::string & tableName,
const StringVector & getCols,
const StringVector & orderCols,
const Assertion * where = 0,
int rowLimit = 0,
int rowOffset = 0 )
pure virtual

Support only for relatively simple SELECT, involving just one table.

Parameters
tableName
getColsvector of columns to be retrieved
whereptr to an Assertion object
rowLimitmax number of rows to return
rowOffsetoffset for first row returned among those satisfying conditions; ignored if 0.
Returns
If the SELECT succeeds, a pointer to an object which manages the returned data; else 0. Caller is responsible for deleting the ResultHandle object.

Implemented in rdbModel::MysqlConnection.

Referenced by Coverage::checkType(), calibUtil::Metadata::getReadInfo(), rdbModel::Table::insertLatest(), and rdbModel::Table::supersedeRow().

◆ update()

virtual unsigned int rdbModel::Connection::update ( const std::string & tableName,
const StringVector & colNames,
const StringVector & values,
const Assertion * where = 0,
const StringVector * nullCols = 0 )
pure virtual

Generic UPDATE. Return value is number of rows changed.

Implemented in rdbModel::MysqlConnection.

Referenced by rdbModel::Table::updateRows().


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