iopc::CachedDatabase Class Reference

A Database class decorator that creates cached connections (see CachedConnection). More...

#include <cachedDatabase.h>

Inheritance diagram for iopc::CachedDatabase:

Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual ~CachedDatabase ()
 Deletes the cache prototype and the decorated Database instance.
virtual void commit ()
 Commits transactions on all connections.
virtual void rollback ()
 Rolls back transactions on all connections.
virtual ConnectiongetConnection (const std::string &connStr)
 Creates a new connection to this database.
virtual void returnConnection (Connection *connection)
 Releases the connection created with Database::getConnection().
virtual void disconnect ()
 Commits all connections on the database, then disconnects them from database.
virtual DatabaseImplgetImplementation ()
 Returns the driver-side part of the Database implemenation.
virtual DatabasegetBasicDatabase ()
 Returns the driver-independent part of the Database implementation.
virtual DrivergetDriver ()
 Returns a reference to a Driver associated with this database.


Detailed Description

A Database class decorator that creates cached connections (see CachedConnection).

To use it, pass a prototype of a Cache implementation to the constructor. Consequent calls to getConnection() will clone the prototype, create a new CachedConnection instance and pass this clone to it.


Member Function Documentation

Connection * iopc::CachedDatabase::getConnection ( const std::string &  connStr  )  [virtual]

Creates a new connection to this database.

Connection must be opened by calling Connection::open() before executing any SQL commands.

Parameters:
connStr A connection string. Its format is defined by the database driver. Usually it identifies the database user/schema.
Returns:
The Connection object representing the requested connection.
See also:
Connection

Implements iopc::Database.

void iopc::CachedDatabase::returnConnection ( Connection connection  )  [virtual]

Releases the connection created with Database::getConnection().

Any connection that was created using Database::getConnection() must be passed to this method when no longer needed.

Parameters:
connection The connection to be released

Implements iopc::Database.

void iopc::CachedDatabase::disconnect (  )  [virtual]

Commits all connections on the database, then disconnects them from database.

The connections are removed from the connection set. (No returnConnection() is needed)

Implements iopc::Database.


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

Generated on Tue Apr 14 16:46:48 2009 for IOPC 2 by  doxygen 1.5.6