/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Public Member Functions | Private Member Functions | Private Attributes
DbiConnection Class Reference

#include <DbiConnection.h>

Collaboration diagram for DbiConnection:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 DbiConnection (const std::string &url="", const std::string &user="", const std::string &password="")
virtual ~DbiConnection ()
const std::string & GetDbName () const
Dbi::DbTypes GetDbType () const
const std::string & GetPassword () const
const std::string & GetUrl () const
const std::string & GetUser () const
Bool_t IsClosed () const
Bool_t IsTemporary () const
Int_t GetNumConnectedStatements () const
const DbiExceptionLogGetExceptionLog () const
void ClearExceptionLog ()
Bool_t PrintExceptionLog (Logging::Level level=3) const
 Print exceptions at level of above and return true if any.
void RecordException ()
void ConnectStatement ()
 Increment number of statements relying on this connection.
void DisConnectStatement ()
 Decrement number of statements relying on this connection and close if idle.
void SetPermanent ()
 Connection is permanent, don't close even when idle.
void SetLocking (Bool_t locking=kTRUE)
 With Locking the SEQNO table (LOCALSEQNO) and payload are locked, disable locking when locking needs to be handled externally, eg for concurrent synchronised writing see http://dayabay.ihep.ac.cn/tracs/dybsvn/browser/dybgaudi/trunk/Database/DybDbi/tests/test_dbi_locking.sh.
Bool_t IsLocking ()
Bool_t Close (Bool_t force=false)
Bool_t Open ()
TSQLServer * GetServer ()
 Get server, opening if necessary DbiConnection retains ownership.
TSQLStatement * CreatePreparedStatement (const std::string &sql)
 Get statement, opening if necessary.

Private Member Functions

void CloseIdleConnection ()

Private Attributes

std::string fDbName
 Database Name.
TUrl fUrl
 TSQLServer URL.
std::string fUser
 Username.
std::string fPassword
 Password.
Bool_t fUrlValidated
 True if URL works.
Int_t fNumConnectedStatements
 Number of connected statements.
Bool_t fIsTemporary
 Connection closes after each I/O (no connections left)
Bool_t fIsLocking
 True if Locking of LOCALSEQNO and payload tables are done during SEQNO Allocation, default is True.
TSQLServer * fServer
 TSQLServer or 0 if closed.
DbiExceptionLog fExceptionLog
 Log of exceptions generated.
Dbi::DbTypes fDbType
 Type of database (MySQL, Oracle)

Detailed Description

Id:
DbiConnection.h,v 1.13 2007/04/26 14:19:57 west Exp

Definition at line 46 of file DbiConnection.h.


Constructor & Destructor Documentation

DbiConnection::DbiConnection ( const std::string &  url = "",
const std::string &  user = "",
const std::string &  password = "" 
)
virtual DbiConnection::~DbiConnection ( ) [virtual]

Member Function Documentation

const std::string& DbiConnection::GetDbName ( ) const [inline]

Definition at line 61 of file DbiConnection.h.

{ return fDbName; }
Dbi::DbTypes DbiConnection::GetDbType ( ) const [inline]

Definition at line 62 of file DbiConnection.h.

{ return fDbType; }
const std::string& DbiConnection::GetPassword ( ) const [inline]

Definition at line 63 of file DbiConnection.h.

{ return fPassword; }
const std::string& DbiConnection::GetUrl ( ) const
const std::string& DbiConnection::GetUser ( ) const [inline]

Definition at line 65 of file DbiConnection.h.

{ return fUser; }
Bool_t DbiConnection::IsClosed ( ) const [inline]

Definition at line 66 of file DbiConnection.h.

{ return ! fServer; }
Bool_t DbiConnection::IsTemporary ( ) const [inline]

Definition at line 67 of file DbiConnection.h.

{ return fIsTemporary; }
Int_t DbiConnection::GetNumConnectedStatements ( ) const [inline]

Definition at line 68 of file DbiConnection.h.

const DbiExceptionLog& DbiConnection::GetExceptionLog ( ) const [inline]

Definition at line 72 of file DbiConnection.h.

{ return fExceptionLog; }
void DbiConnection::ClearExceptionLog ( ) [inline]

Definition at line 73 of file DbiConnection.h.

Bool_t DbiConnection::PrintExceptionLog ( Logging::Level  level = 3) const

Print exceptions at level of above and return true if any.

void DbiConnection::RecordException ( )
void DbiConnection::ConnectStatement ( ) [inline]

Increment number of statements relying on this connection.

Definition at line 84 of file DbiConnection.h.

void DbiConnection::DisConnectStatement ( ) [inline]

Decrement number of statements relying on this connection and close if idle.

Definition at line 86 of file DbiConnection.h.

void DbiConnection::SetPermanent ( ) [inline]

Connection is permanent, don't close even when idle.

Definition at line 90 of file DbiConnection.h.

{ fIsTemporary = kFALSE; }
void DbiConnection::SetLocking ( Bool_t  locking = kTRUE) [inline]

With Locking the SEQNO table (LOCALSEQNO) and payload are locked, disable locking when locking needs to be handled externally, eg for concurrent synchronised writing see http://dayabay.ihep.ac.cn/tracs/dybsvn/browser/dybgaudi/trunk/Database/DybDbi/tests/test_dbi_locking.sh.

Definition at line 95 of file DbiConnection.h.

{ fIsLocking = locking; }
Bool_t DbiConnection::IsLocking ( ) [inline]

Definition at line 96 of file DbiConnection.h.

{ return fIsLocking ; }
Bool_t DbiConnection::Close ( Bool_t  force = false)
Bool_t DbiConnection::Open ( )
TSQLServer* DbiConnection::GetServer ( )

Get server, opening if necessary DbiConnection retains ownership.

TSQLStatement* DbiConnection::CreatePreparedStatement ( const std::string &  sql)

Get statement, opening if necessary.

Caller must take ownership.

void DbiConnection::CloseIdleConnection ( ) [private]

Member Data Documentation

std::string DbiConnection::fDbName [private]

Database Name.

Definition at line 117 of file DbiConnection.h.

TUrl DbiConnection::fUrl [private]

TSQLServer URL.

Definition at line 120 of file DbiConnection.h.

std::string DbiConnection::fUser [private]

Username.

Definition at line 123 of file DbiConnection.h.

std::string DbiConnection::fPassword [private]

Password.

Definition at line 126 of file DbiConnection.h.

Bool_t DbiConnection::fUrlValidated [private]

True if URL works.

Definition at line 129 of file DbiConnection.h.

Number of connected statements.

Definition at line 132 of file DbiConnection.h.

Bool_t DbiConnection::fIsTemporary [private]

Connection closes after each I/O (no connections left)

Definition at line 135 of file DbiConnection.h.

Bool_t DbiConnection::fIsLocking [private]

True if Locking of LOCALSEQNO and payload tables are done during SEQNO Allocation, default is True.

Definition at line 138 of file DbiConnection.h.

TSQLServer* DbiConnection::fServer [private]

TSQLServer or 0 if closed.

Definition at line 141 of file DbiConnection.h.

Log of exceptions generated.

Cleared by Open Close and (implicitly) by CreatePreparedStatement, GetServer

Definition at line 145 of file DbiConnection.h.

Type of database (MySQL, Oracle)

Definition at line 148 of file DbiConnection.h.


The documentation for this class was generated from the following file:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 09:56:45 for DatabaseInterface by doxygen 1.7.4