#include <database.h>
Public Member Functions | |
virtual Driver & | getDriver ()=0 |
Returns a reference to a Driver associated with this database. | |
virtual | ~Database () |
virtual void | commit ()=0 |
Commits transactions on all connections. | |
virtual void | rollback ()=0 |
Rolls back transactions on all connections. | |
virtual Connection * | getConnection (const std::string &connStr)=0 |
Creates a new connection to this database. | |
virtual void | returnConnection (Connection *connection)=0 |
Releases the connection created with Database::getConnection(). | |
virtual void | disconnect ()=0 |
Commits all connections on the database, then disconnects them from database. | |
virtual DatabaseImpl * | getImplementation ()=0 |
Returns the driver-side part of the Database implemenation. | |
virtual Database * | getBasicDatabase ()=0 |
Returns the driver-independent part of the Database implementation. |
Methods of this class allow user to create and manipulate connections to this database.
Classes implementing this interface are thread safe and can be used by more threads concurrently.
virtual iopc::Database::~Database | ( | ) | [inline, virtual] |
Implementation should delete the inner instance
virtual Connection* iopc::Database::getConnection | ( | const std::string & | connStr | ) | [pure virtual] |
Creates a new connection to this database.
Connection must be opened by calling Connection::open() before executing any SQL commands.
connStr | A connection string. Its format is defined by the database driver. Usually it identifies the database user/schema. |
Implemented in iopc::BasicDatabase, and iopc::CachedDatabase.
virtual void iopc::Database::returnConnection | ( | Connection * | connection | ) | [pure 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.
connection | The connection to be released |
Implemented in iopc::BasicDatabase, and iopc::CachedDatabase.
virtual void iopc::Database::disconnect | ( | ) | [pure virtual] |
Commits all connections on the database, then disconnects them from database.
The connections are removed from the connection set. (No returnConnection() is needed)
Implemented in iopc::BasicDatabase, and iopc::CachedDatabase.