#include <DbiConnection.h>
Collaboration diagram for DbiConnection:
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 DbiExceptionLog & | GetExceptionLog () 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. | |
| 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). | |
| TSQLServer * | fServer |
| TSQLServer or 0 if closed. | |
| DbiExceptionLog | fExceptionLog |
| Log of exceptions generated. | |
| Dbi::DbTypes | fDbType |
| Type of database (MySQL, Oracle). | |
Definition at line 46 of file DbiConnection.h.
| DbiConnection::DbiConnection | ( | const std::string & | url = "", |
|
| const std::string & | user = "", |
|||
| const std::string & | password = "" | |||
| ) |
| virtual DbiConnection::~DbiConnection | ( | ) | [virtual] |
| const std::string& DbiConnection::GetDbName | ( | ) | const [inline] |
| Dbi::DbTypes DbiConnection::GetDbType | ( | ) | const [inline] |
| const std::string& DbiConnection::GetPassword | ( | ) | const [inline] |
| const std::string& DbiConnection::GetUrl | ( | ) | const |
| const std::string& DbiConnection::GetUser | ( | ) | const [inline] |
| Bool_t DbiConnection::IsClosed | ( | ) | const [inline] |
| Bool_t DbiConnection::IsTemporary | ( | ) | const [inline] |
| Int_t DbiConnection::GetNumConnectedStatements | ( | ) | const [inline] |
| const DbiExceptionLog& DbiConnection::GetExceptionLog | ( | ) | const [inline] |
| void DbiConnection::ClearExceptionLog | ( | ) | [inline] |
| 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.
00084 { ++fNumConnectedStatements; }
| void DbiConnection::DisConnectStatement | ( | ) | [inline] |
Decrement number of statements relying on this connection and close if idle.
Definition at line 86 of file DbiConnection.h.
00086 { 00087 --fNumConnectedStatements; 00088 if ( ! fNumConnectedStatements ) this->CloseIdleConnection(); }
| void DbiConnection::SetPermanent | ( | ) | [inline] |
Connection is permanent, don't close even when idle.
Definition at line 90 of file DbiConnection.h.
00090 { fIsTemporary = kFALSE; }
| 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] |
std::string DbiConnection::fDbName [private] |
TUrl DbiConnection::fUrl [private] |
std::string DbiConnection::fUser [private] |
std::string DbiConnection::fPassword [private] |
Bool_t DbiConnection::fUrlValidated [private] |
Int_t DbiConnection::fNumConnectedStatements [private] |
Bool_t DbiConnection::fIsTemporary [private] |
Connection closes after each I/O (no connections left).
Definition at line 130 of file DbiConnection.h.
TSQLServer* DbiConnection::fServer [private] |
DbiExceptionLog DbiConnection::fExceptionLog [private] |
Log of exceptions generated.
Cleared by Open Close and (implicitly) by CreatePreparedStatement, GetServer
Definition at line 137 of file DbiConnection.h.
Dbi::DbTypes DbiConnection::fDbType [private] |
1.4.7