NCBI C++ ToolKit
Public Types | Public Member Functions | List of all members
IConnection Class Referenceabstract

Search Toolkit Book for IConnection

#include <dbapi/dbapi.hpp>

+ Inheritance diagram for IConnection:

Public Types

enum  EConnMode { eBulkInsert = I_DriverContext::fBcpIn, ePasswordEncrypted = I_DriverContext::fPasswordEncrypted }
 Which connection mode. More...
 

Public Member Functions

virtual ~IConnection ()
 Destructor. More...
 
virtual void SetMode (EConnMode mode)=0
 Set connection mode. More...
 
virtual void ResetMode (EConnMode mode)=0
 Reset connection mode. More...
 
virtual unsigned int GetModeMask ()=0
 Get mode mask. More...
 
virtual void ForceSingle (bool enable)=0
 Force single connection mode, default false. More...
 
virtual IDataSourceGetDataSource ()=0
 Get parent datasource object. More...
 
virtual void Connect (const string &user, const string &password, const string &server, const string &database=kEmptyStr)=0
 Connect to a database. More...
 
virtual void Connect (const CDBConnParams &params)=0
 Connect to a database. More...
 
virtual void ConnectValidated (IConnValidator &validator, const string &user, const string &password, const string &server, const string &database=kEmptyStr)=0
 Connect to a database using connect validator. More...
 
virtual IConnectionCloneConnection (EOwnership ownership=eNoOwnership)=0
 Clone existing connection. More...
 
virtual void SetDatabase (const string &name)=0
 Set current database. More...
 
virtual string GetDatabase ()=0
 Get current database. More...
 
virtual bool IsAlive ()=0
 Check if the connection is alive. More...
 
virtual IStatementGetStatement ()=0
 Get statement object for regular SQL queries. More...
 
virtual ICallableStatementGetCallableStatement (const string &proc)=0
 Get callable statement object for stored procedures. More...
 
ICallableStatementGetCallableStatement (const string &proc, int)
 
virtual ICursorGetCursor (const string &name, const string &sql, int batchSize)=0
 Get cursor object. More...
 
ICursorGetCursor (const string &name, const string &sql)
 
ICursorGetCursor (const string &name, const string &sql, int, int batchSize)
 
virtual IBulkInsertGetBulkInsert (const string &table_name)=0
 Create bulk insert object. More...
 
IBulkInsertGetBulkInsert (const string &table_name, unsigned int)
 
virtual IStatementCreateStatement ()=0
 Get statement object for regular SQL queries. More...
 
virtual ICallableStatementPrepareCall (const string &proc)=0
 Get callable statement object for stored procedures. More...
 
ICallableStatementPrepareCall (const string &proc, int)
 
virtual ICursorCreateCursor (const string &name, const string &sql, int batchSize)=0
 Get cursor object. More...
 
ICursorCreateCursor (const string &name, const string &sql)
 
ICursorCreateCursor (const string &name, const string &sql, int, int batchSize)
 
virtual IBulkInsertCreateBulkInsert (const string &table_name)=0
 Create bulk insert object. More...
 
IBulkInsertCreateBulkInsert (const string &table_name, unsigned int)
 
virtual void Close ()=0
 Close connecti. More...
 
virtual void Abort ()=0
 Abort connection. More...
 
virtual void SetTimeout (size_t nof_secs)=0
 Set connection timeout. More...
 
virtual void SetCancelTimeout (size_t)
 Set timeout for command cancellation and connection closing. More...
 
virtual size_t GetTimeout (void) const
 Get connection timeout. More...
 
virtual size_t GetCancelTimeout (void) const
 Get timeout for command cancellation and connection closing. More...
 
virtual void MsgToEx (bool v)=0
 If enabled, redirects all error messages to CDB_MultiEx object (see below). More...
 
virtual CDB_MultiExGetErrorAsEx ()=0
 Returns all error messages as a CDB_MultiEx object. More...
 
virtual string GetErrorInfo ()=0
 Returns all error messages as a single string. More...
 
virtual CDB_ConnectionGetCDB_Connection ()=0
 Returns the internal driver connection object. More...
 

Detailed Description

Definition at line 703 of file dbapi.hpp.

Constructor & Destructor Documentation

IConnection::~IConnection ( )
virtual

Destructor.

Definition at line 54 of file dbapi.cpp.

Member Function Documentation

virtual void IConnection::Abort ( )
pure virtual

Abort connection.

Implemented in CConnection.

virtual IConnection* IConnection::CloneConnection ( EOwnership  ownership = eNoOwnership)
pure virtual

Clone existing connection.

All settings are copied except message handlers Set ownership to eTakeOwnership to prevent deleting connection upon deleting parent object

Implemented in CConnection.

Referenced by CDbapiTest::Run().

virtual void IConnection::Close ( )
pure virtual

Close connecti.

Implemented in CConnection.

Referenced by CConnHolder::CloseRef().

virtual void IConnection::Connect ( const string user,
const string password,
const string server,
const string database = kEmptyStr 
)
pure virtual

Connect to a database.

Parameters
userUser name.
passwordUser's password.
serverServer to connect to.
databaseDatabase to connect to.

Implemented in CConnection.

Referenced by CDBAPI_CacheAdmin::Connect(), python::CConnection::MakeDBConnection(), CDbCopyApp::Run(), and CDbapiTest::Run().

virtual void IConnection::Connect ( const CDBConnParams params)
pure virtual

Connect to a database.

Parameters
paramsConnection parameters. Parameters should include all necessary settings because all info set via SetMode() or ResetMode() will be ignored.

Implemented in CConnection.

virtual void IConnection::ConnectValidated ( IConnValidator validator,
const string user,
const string password,
const string server,
const string database = kEmptyStr 
)
pure virtual

Connect to a database using connect validator.

Parameters
validatorValidator implementation class.
userUser name.
passwordUser's password.
serverServer to connect to.
databaseDatabase to connect to.

Implemented in CConnection.

Referenced by CDbapiTest::Run(), and CDbapiSimpleApp::SetupDb().

virtual IBulkInsert* IConnection::CreateBulkInsert ( const string table_name)
pure virtual

Create bulk insert object.

Implemented in CConnection.

Referenced by CreateBulkInsert(), and CDbapiTest::Run().

IBulkInsert* IConnection::CreateBulkInsert ( const string table_name,
unsigned  int 
)
inline

Definition at line 892 of file dbapi.hpp.

References CreateBulkInsert().

virtual ICursor* IConnection::CreateCursor ( const string name,
const string sql,
int  batchSize 
)
pure virtual

Get cursor object.

Implemented in CConnection.

Referenced by CreateCursor(), and CDbapiTest::Run().

ICursor* IConnection::CreateCursor ( const string name,
const string sql 
)
inline

Definition at line 875 of file dbapi.hpp.

References CreateCursor().

ICursor* IConnection::CreateCursor ( const string name,
const string sql,
int  ,
int  batchSize 
)
inline

Definition at line 881 of file dbapi.hpp.

References CreateCursor().

virtual IStatement* IConnection::CreateStatement ( )
pure virtual

Get statement object for regular SQL queries.

Implemented in CConnection.

Referenced by CDbapiSimpleApp::DemoDynamicSql(), CDbapiSimpleApp::DemoStaticSql(), and CDbapiTest::Run().

virtual void IConnection::ForceSingle ( bool  enable)
pure virtual

Force single connection mode, default false.

Disable this mode before using BLOB output streams from IResultSet, because extra connection is needed in this case.

Implemented in CConnection.

virtual IBulkInsert* IConnection::GetBulkInsert ( const string table_name)
pure virtual

Create bulk insert object.

Parameters
table_nametable name.
nof_colsNumber of columns.

Implemented in CConnection.

Referenced by CBulkInsertImpl::CBulkInsertImpl(), GetBulkInsert(), and CDbapiTest::Run().

IBulkInsert* IConnection::GetBulkInsert ( const string table_name,
unsigned  int 
)
inline

Definition at line 853 of file dbapi.hpp.

References GetBulkInsert().

virtual ICallableStatement* IConnection::GetCallableStatement ( const string proc)
pure virtual

Get callable statement object for stored procedures.

Parameters
procStored procedure name.
nofArgsNumber of arguments.

Implemented in CConnection.

Referenced by python::CCallableStmtHelper::CreateStmt(), CDbapiSimpleApp::DemoStoredProc(), CQueryImpl::ExecuteSP(), GetCallableStatement(), and CDbapiTest::Run().

ICallableStatement* IConnection::GetCallableStatement ( const string proc,
int   
)
inline

Definition at line 822 of file dbapi.hpp.

References GetCallableStatement().

size_t IConnection::GetCancelTimeout ( void  ) const
virtual

Get timeout for command cancellation and connection closing.

Definition at line 63 of file dbapi.cpp.

References CDB_Connection::GetCancelTimeout(), and GetCDB_Connection().

virtual CDB_Connection* IConnection::GetCDB_Connection ( )
pure virtual
virtual ICursor* IConnection::GetCursor ( const string name,
const string sql,
int  batchSize 
)
pure virtual
ICursor* IConnection::GetCursor ( const string name,
const string sql 
)
inline

Definition at line 831 of file dbapi.hpp.

References GetCursor().

ICursor* IConnection::GetCursor ( const string name,
const string sql,
int  ,
int  batchSize 
)
inline

Definition at line 837 of file dbapi.hpp.

References GetCursor().

virtual string IConnection::GetDatabase ( )
pure virtual

Get current database.

Implemented in CConnection.

Referenced by CConnHolder::CConnHolder(), and CDBAPI_Cache::GetCacheName().

virtual IDataSource* IConnection::GetDataSource ( )
pure virtual

Get parent datasource object.

Implemented in CConnection.

virtual CDB_MultiEx* IConnection::GetErrorAsEx ( )
pure virtual

Returns all error messages as a CDB_MultiEx object.

Implemented in CConnection.

virtual string IConnection::GetErrorInfo ( )
pure virtual

Returns all error messages as a single string.

Implemented in CConnection.

Referenced by CDbapiTest::Run().

virtual unsigned int IConnection::GetModeMask ( )
pure virtual

Get mode mask.

Implemented in CConnection.

virtual IStatement* IConnection::GetStatement ( )
pure virtual
size_t IConnection::GetTimeout ( void  ) const
virtual

Get connection timeout.

Definition at line 58 of file dbapi.cpp.

References GetCDB_Connection(), and CDB_Connection::GetTimeout().

Referenced by CConnHolder::CConnHolder().

virtual bool IConnection::IsAlive ( )
pure virtual

Check if the connection is alive.

Implemented in CConnection.

Referenced by python::CDMLConnPool::commit(), CDatabase::IsConnected(), and python::CDMLConnPool::rollback().

virtual void IConnection::MsgToEx ( bool  v)
pure virtual

If enabled, redirects all error messages to CDB_MultiEx object (see below).

Implemented in CConnection.

Referenced by CDbapiTest::Run().

virtual ICallableStatement* IConnection::PrepareCall ( const string proc)
pure virtual

Get callable statement object for stored procedures.

Implemented in CConnection.

Referenced by PrepareCall().

ICallableStatement* IConnection::PrepareCall ( const string proc,
int   
)
inline

Definition at line 866 of file dbapi.hpp.

References PrepareCall().

virtual void IConnection::ResetMode ( EConnMode  mode)
pure virtual

Reset connection mode.

Parameters
modeMode to reset to.

Implemented in CConnection.

virtual void IConnection::SetCancelTimeout ( size_t  )
inlinevirtual

Set timeout for command cancellation and connection closing.

Reimplemented in CConnection.

Definition at line 909 of file dbapi.hpp.

virtual void IConnection::SetDatabase ( const string name)
pure virtual

Set current database.

Parameters
nameName of database to set to.

Implemented in CConnection.

virtual void IConnection::SetMode ( EConnMode  mode)
pure virtual

Set connection mode.

Parameters
modeMode to set to.

Implemented in CConnection.

Referenced by CDbCopyApp::Run(), and CDbapiTest::Run().

virtual void IConnection::SetTimeout ( size_t  nof_secs)
pure virtual

Set connection timeout.

NOTE: if "nof_secs" is zero or is "too big" (depends on the underlying DB API), then set the timeout to infinite.

Implemented in CConnection.

Referenced by CConnHolder::ResetTimeout(), and CConnHolder::SetTimeout().


The documentation for this class was generated from the following files:
Modified on Thu Jul 28 20:11:11 2016 by modify_doxy.py rev. 506947