rdbModel::Connection Class Reference

#include <Connection.h>

Inheritance diagram for rdbModel::Connection:

rdbModel::MysqlConnection List of all members.

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::ostreamgetOut () const =0
virtual std::ostreamgetErrOut () 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

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.

00060 {};

virtual rdbModel::Connection::~Connection (  )  [inline, virtual]

Definition at line 61 of file Connection.h.

00061 {};


Member Function Documentation

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 ConnectionDBBase::disconnectRead(), calibUtil::Metadata::disconnectRead(), ConnectionDBBase::disconnectWrite(), and calibUtil::Metadata::disconnectWrite().

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.

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.

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.

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

Implemented in rdbModel::MysqlConnection.

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

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

Implemented in rdbModel::MysqlConnection.

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

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().

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

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

Implemented in rdbModel::MysqlConnection.

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.

Referenced by calibUtil::Metadata::compareSchema().

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.

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.

Referenced by ConnectionDBBase::connect(), and calibUtil::Metadata::connect().

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 
getCols vector of columns to be retrieved
where ptr to an Assertion object
rowLimit max number of rows to return
rowOffset offset 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 calibUtil::Metadata::adjustVend(), Coverage::checkType(), calibUtil::Metadata::doSelect(), calibUtil::Metadata::getReadInfo(), rdbModel::Table::insertLatest(), rdbModel::Table::isSupersedable(), and rdbModel::Table::supersedeRow().

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 calibUtil::Metadata::adjustVend(), rdbModel::Table::doInterUpdate(), and rdbModel::Table::updateRows().


Generated on Tue Nov 29 23:36:35 2016 for BOSS_7.0.2 by  doxygen 1.4.7