CGEM BOSS 6.6.5.i
BESIII Offline Software System
|
#include <MysqlConnection.h>
Public Member Functions | |
MysqlConnection (std::ostream *out=0, std::ostream *errOut=0) | |
virtual | ~MysqlConnection () |
virtual bool | open (const std::string &host, const std::string &userid, const std::string &password, const std::string &dbName) |
virtual bool | open (const std::string &parms) |
virtual bool | close () |
virtual bool | isConnected () |
Return true iff open has been done with no matching close. | |
std::ostream * | getOut () const |
std::ostream * | getErrOut () const |
virtual MATCH | matchSchema (Rdb *rdb, bool matchDbName=true) |
virtual bool | insertRow (const std::string &tableName, const StringVector &colNames, const StringVector &values, int *auto_value=0, const StringVector *nullCols=0) |
virtual unsigned int | update (const std::string &tableName, const StringVector &colNames, const StringVector &values, const Assertion *where=0, const StringVector *nullCols=0) |
virtual ResultHandle * | select (const std::string &tableName, const StringVector &getCols, const StringVector &orderCols, const Assertion *where=0, int rowLimit=0, int rowOffset=0) |
virtual ResultHandle * | dbRequest (const std::string &request) |
virtual bool | compileAssertion (const Assertion *a, std::string &sqlString) const |
virtual void | disableModify (bool disable) |
virtual Visitor::VisitorState | visitRdb (Rdb *) |
This method says if the visitor is recursive or not. | |
virtual Visitor::VisitorState | visitTable (Table *) |
virtual Visitor::VisitorState | visitColumn (Column *) |
virtual Visitor::VisitorState | visitIndex (Index *) |
virtual Visitor::VisitorState | visitAssertion (Assertion *) |
virtual VisitorState | visitInsertNew (InsertNew *) |
virtual VisitorState | visitSupersede (Supersede *) |
virtual VisitorState | visitQuery (Query *) |
virtual VisitorState | visitSet (Set *) |
virtual VisitorState | visitInterRow (InterRow *) |
Public Member Functions inherited from rdbModel::Connection | |
Connection () | |
virtual | ~Connection () |
Public Member Functions inherited from rdbModel::Visitor |
Additional Inherited Members | |
Public Types inherited from rdbModel::Visitor | |
enum | VisitorState { VCONTINUE = 0 , VDONE , VBRANCHDONE , VERROR , VERRORABORT } |
Class to handle connection to a MySQL database
Initial design will just use host, password, userid passed in. Will be up to caller to insure that the userid has the right privilages for the operations caller intends to do.
Definition at line 32 of file MysqlConnection.h.
rdbModel::MysqlConnection::MysqlConnection | ( | std::ostream * | out = 0, |
std::ostream * | errOut = 0 ) |
Open a connection Allowed operations will depend on userid, etc., specified return true if successful
Definition at line 70 of file MysqlConnection.cxx.
|
virtual |
Definition at line 91 of file MysqlConnection.cxx.
|
virtual |
Close the current open connection , if any. Return true if there was a connection to close and it was closed successfully
Implements rdbModel::Connection.
Definition at line 79 of file MysqlConnection.cxx.
Referenced by main(), and ~MysqlConnection().
|
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.
Implements rdbModel::Connection.
Definition at line 463 of file MysqlConnection.cxx.
|
virtual |
Transmit raw request of any form to our other end. 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.
Implements rdbModel::Connection.
Definition at line 409 of file MysqlConnection.cxx.
Referenced by main().
|
inlinevirtual |
Turn select and update into no-ops: output SQL string for debugging but don't change db
Implements rdbModel::Connection.
Definition at line 137 of file MysqlConnection.h.
Referenced by main().
|
inlinevirtual |
|
inlinevirtual |
|
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 If auto_value is non-zero and the table has an auto-increment column, its value will be returned. If nullCols is non-zero, insertRow will treat each string in the vector as a column name whose value should be set to NULL
Might also want to add a routine for INSERT ... SELECT
Implements rdbModel::Connection.
Definition at line 216 of file MysqlConnection.cxx.
|
inlinevirtual |
Return true iff open has been done with no matching close.
Implements rdbModel::Connection.
Definition at line 54 of file MysqlConnection.h.
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.
If match is successful, may also want to cache information about some things; for example, rows for which agent = "service"
Implements rdbModel::Connection.
Definition at line 191 of file MysqlConnection.cxx.
Referenced by main().
|
virtual |
Implements rdbModel::Connection.
Definition at line 97 of file MysqlConnection.cxx.
Referenced by dbRequest(), main(), and open().
|
virtual |
Parameter is normally path for an xml file descrbing the connection parameters
Implements rdbModel::Connection.
Definition at line 163 of file MysqlConnection.cxx.
|
virtual |
Support only for relatively simple SELECT, involving just one table.
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. |
Implements rdbModel::Connection.
Definition at line 330 of file MysqlConnection.cxx.
|
virtual |
Generic UPDATE. Return value is number of rows changed.
Implements rdbModel::Connection.
Definition at line 275 of file MysqlConnection.cxx.
|
virtual |
|
virtual |
Implements rdbModel::Visitor.
Definition at line 685 of file MysqlConnection.cxx.
|
virtual |
Implements rdbModel::Visitor.
Definition at line 836 of file MysqlConnection.cxx.
|
virtual |
Implements rdbModel::Visitor.
Definition at line 845 of file MysqlConnection.cxx.
|
virtual |
Implements rdbModel::Visitor.
Definition at line 861 of file MysqlConnection.cxx.
|
virtual |
Implements rdbModel::Visitor.
Definition at line 853 of file MysqlConnection.cxx.
|
virtual |
This method says if the visitor is recursive or not.
This method sets if the visitor is recursive or not
Implements rdbModel::Visitor.
Definition at line 609 of file MysqlConnection.cxx.
|
virtual |
Implements rdbModel::Visitor.
Definition at line 857 of file MysqlConnection.cxx.
|
virtual |
Implements rdbModel::Visitor.
Definition at line 849 of file MysqlConnection.cxx.
|
virtual |
Implements rdbModel::Visitor.
Definition at line 642 of file MysqlConnection.cxx.