DbConnection Class Reference
[Public API]

This class represents connection to database. More...

#include <database.h>

Inheritance diagram for DbConnection:

Inheritance graph
[legend]
Collaboration diagram for DbConnection:

Collaboration graph
[legend]
List of all members.

Public Types

enum  unicode_flag_t { DEBEA_UNICODE_DEFAULT, DEBEA_UNICODE_ON, DEBEA_UNICODE_OFF }
 Should driver use UNICODE capability.

Public Member Functions

virtual void begin ()=0
 Start transaction.
virtual void commit ()=0
 Commit transaction.
void decUsed ()
 Decrease usage counter.
virtual void disconnect ()=0
 disconnect.
virtual std::list< std::string > getRelationNames ()=0
 Get list of relations that connected database advertise to us This list does not contain system tables, only ones that are created by user.
void incUsed ()
 Increase usage counter.
bool isUsed () const
 Check if connection is used.
virtual bool isValid () const =0
 Check if connection is valid.
virtual void rollback ()=0
 Rollback transaction.
DbResultsendQuery (const char *pSql)
 Send SQL SELECT to database.
DbResultsendQuery (const std::string &pSql)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
int sendUpdate (const std::string &pSql)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
int sendUpdate (const char *pSql)
 Send SQL update commands to database.
virtual ~DbConnection ()
 Destructor.

Protected Member Functions

virtual DbResultexecQuery (const char *pSql)=0
 Override with database specific implementation.
virtual int execUpdate (const char *pSql)=0
 Override with database specific implementation.

Protected Attributes

int mUseCount
 Usage counter used by streams.

Detailed Description

This class represents connection to database.

You can send commands or queries to database using this connection object. Most databases does not support multiple query processing on single connection so if you use sendQuery() method for a second time be sure that DbResult from first query is destroyed or all rows are fetched.


Member Function Documentation

void decUsed  ) 
 

Decrease usage counter.

Used by streams.

virtual void disconnect  )  [pure virtual]
 

disconnect.

After you call this method isValid() will return false.

virtual DbResult* execQuery const char *  pSql  )  [protected, pure virtual]
 

Override with database specific implementation.

Parameters:
pSql SQL query to send

virtual int execUpdate const char *  pSql  )  [protected, pure virtual]
 

Override with database specific implementation.

Parameters:
pSql SQL query to send

void incUsed  ) 
 

Increase usage counter.

Used by streams.

bool isUsed  )  const
 

Check if connection is used.

This flag is useful for classes that will control connection object, ie. Database connection managers.

virtual bool isValid  )  const [pure virtual]
 

Check if connection is valid.

Connection can be invalid because of protocol error or broken connection to backend server

Returns:
true if connection is valid or false otherwise.

DbResult* sendQuery const char *  pSql  ) 
 

Send SQL SELECT to database.

Parameters:
pSql SQL query to send
See also:
sendUpdate

int sendUpdate const char *  pSql  ) 
 

Send SQL update commands to database.

Parameters:
pSql SQL update query to send
See also:
sendQuery

The documentation for this class was generated from the following file:

Documentation
Quick start
Examples
Search

API Documentation
Class hierarchy
Member index
API Reference
Store filters
Store table macros
Back

Generated by doxygen at Sun Nov 9 02:08:19 2008