CppDB
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator
Public Member Functions
cppdb::backend::connection Class Reference

this class represents connection to database More...

#include <cppdb/backend.h>

Inheritance diagram for cppdb::backend::connection:
cppdb::ref_counted

List of all members.

Public Member Functions

 connection (connection_info const &info)
virtual void begin ()=0
virtual void commit ()=0
virtual void rollback ()=0
virtual statementprepare_statement (std::string const &q)=0
virtual statementcreate_statement (std::string const &q)=0
virtual std::string escape (std::string const &)=0
virtual std::string escape (char const *s)=0
virtual std::string escape (char const *b, char const *e)=0
virtual std::string driver ()=0
virtual std::string engine ()=0
void clear_cache ()
bool once_called () const
void once_called (bool v)
connection_specific_dataconnection_specific_get (std::type_info const &type) const
connection_specific_dataconnection_specific_release (std::type_info const &type)
void connection_specific_reset (std::type_info const &type, connection_specific_data *p=0)
bool recyclable ()
void recyclable (bool value)

Detailed Description

this class represents connection to database


Constructor & Destructor Documentation

Create a new object. Connection information info is required


Member Function Documentation

virtual void cppdb::backend::connection::begin ( ) [pure virtual]

Start new isolated transaction. Would not be called withing other transaction on current connection.

Clear statements cache

virtual void cppdb::backend::connection::commit ( ) [pure virtual]

Commit the transaction, you may assume that is called after begin() was called.

Get connection specific data pointer of the type type , default 0.

The ownership is not changed

Release ownership connection specific data pointer of the type type

void cppdb::backend::connection::connection_specific_reset ( std::type_info const &  type,
connection_specific_data p = 0 
)

Remove old connection specific data and set new one for a given type type , the ownership on p is transferred to connection.

virtual statement* cppdb::backend::connection::create_statement ( std::string const &  q) [pure virtual]

Create a (unprepared) statement q. May throw if preparation had failed. Should never return null value.

virtual std::string cppdb::backend::connection::driver ( ) [pure virtual]

Get the name of the driver, for example sqlite3, odbc

virtual std::string cppdb::backend::connection::engine ( ) [pure virtual]

Get the name of the SQL Server, for example sqlite3, mssql, oracle, differs from driver() when the backend supports multiple databases like odbc backend.

virtual std::string cppdb::backend::connection::escape ( std::string const &  ) [pure virtual]

Escape a string for inclusion in SQL query. May throw not_supported_by_backend() if not supported by backend.

virtual std::string cppdb::backend::connection::escape ( char const *  s) [pure virtual]

Escape a string for inclusion in SQL query. May throw not_supported_by_backend() if not supported by backend.

virtual std::string cppdb::backend::connection::escape ( char const *  b,
char const *  e 
) [pure virtual]

Escape a string for inclusion in SQL query. May throw not_supported_by_backend() if not supported by backend.

Check if session specific preparations are done

For new connections always false

Set once status - true if called flase

virtual statement* cppdb::backend::connection::prepare_statement ( std::string const &  q) [pure virtual]

Create a prepared statement q. May throw if preparation had failed. Should never return null value.

Check if this back-end can be recycled for reuse in a pool.

If an exception is thrown during operation on DB this flag is reset to false by the front-end classes result, statement, session.

Default is true

Set recyclable state of the session. If some problem occurs on connection that prevents its reuse it should be called with false parameter.

virtual void cppdb::backend::connection::rollback ( ) [pure virtual]

Rollback the transaction. MUST never throw!!!


The documentation for this class was generated from the following file:
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator