libodbc++
0.2.5
|
A database connection. More...
#include <connection.h>
Public Types | |
enum | TransactionIsolation { TRANSACTION_NONE, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_READ_COMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE } |
Transaction isolation constants. More... | |
Public Member Functions | |
virtual | ~Connection () |
Destructor. | |
bool | getAutoCommit () |
Returns true if autocommit is on. | |
void | setAutoCommit (bool autoCommit) |
Sets the autocommit state of this connection. | |
void | commit () |
Commits the ongoing transaction. | |
void | rollback () |
Rollbacks the ongoing transaction. | |
std::string | getCatalog () |
Returns the current catalog. | |
void | setCatalog (const std::string &catalog) |
Sets the current catalog. | |
TransactionIsolation | getTransactionIsolation () |
Returns the current transaction isolation level. | |
void | setTransactionIsolation (TransactionIsolation isolation) |
Sets the current transaction isolation level. | |
bool | isReadOnly () |
Returns true if the connection is read only. | |
void | setReadOnly (bool readOnly) |
Sets the read-only state of this connection. | |
bool | getTrace () |
Returns true if ODBC tracing is enabled on this connection. | |
void | setTrace (bool on) |
Sets ODBC tracing on or off. | |
std::string | getTraceFile () |
Returns the file ODBC tracing is currently written to. | |
void | setTraceFile (const std::string &s) |
Sets the file ODBC tracing is written to. | |
DatabaseMetaData * | getMetaData () |
Returns meta information for this connection. | |
Statement * | createStatement () |
Creates a non-prepared statement. | |
Statement * | createStatement (int resultSetType, int resultSetConcurrency) |
Creates a non-prepared statement. | |
PreparedStatement * | prepareStatement (const std::string &sql) |
Create a prepared statement. | |
PreparedStatement * | prepareStatement (const std::string &sql, int resultSetType, int resultSetConcurrency) |
Create a prepared statement. | |
CallableStatement * | prepareCall (const std::string &sql) |
Create a callable prepared statement. | |
CallableStatement * | prepareCall (const std::string &sql, int resultSetType, int resultSetConcurrency) |
Create a callable prepared statement. | |
std::string | nativeSQL (const std::string &sql) |
Translate a given SQL string into this data sources' own SQL grammar. | |
![]() | |
void | clearWarnings () |
Clears all the warnings stored in this object. | |
WarningList * | getWarnings () |
Fetches all the warnings in this object. | |
virtual | ~ErrorHandler () |
Destructor. | |
Additional Inherited Members | |
![]() | |
ErrorHandler (bool collectWarnings=true) | |
Constructor. | |
A database connection.
Transaction isolation constants.
|
virtual |
Destructor.
Closes the connection
Statement* odbc::Connection::createStatement | ( | ) |
Creates a non-prepared statement.
Example: std::auto_ptr<Statement> stmt(cnt->createStatement());
Statement* odbc::Connection::createStatement | ( | int | resultSetType, |
int | resultSetConcurrency | ||
) |
DatabaseMetaData* odbc::Connection::getMetaData | ( | ) |
Returns meta information for this connection.
Note that the returned object is 'owned' by this connection and should in no way be deleted by the caller.
Example: DatabaseMetaData* dmd = cnt->getMetaData();
CallableStatement* odbc::Connection::prepareCall | ( | const std::string & | sql | ) |
Create a callable prepared statement.
Example: std::auto_ptr<CallableStatement> cstmt(cnt->prepareCall(s));
sql | The string to prepare, optionally containing parameter markers for input and/or output parameters |
CallableStatement* odbc::Connection::prepareCall | ( | const std::string & | sql, |
int | resultSetType, | ||
int | resultSetConcurrency | ||
) |
Create a callable prepared statement.
Example: std::auto_ptr<CallableStatement> cstmt(cnt->prepareCall(s, x, y));
PreparedStatement* odbc::Connection::prepareStatement | ( | const std::string & | sql | ) |
Create a prepared statement.
Example: std::auto_ptr<PreparedStatement> pstmt(cnt->prepareStatement(s));
sql | The string to prepare, optionally containing parameter markers (? ). |
PreparedStatement* odbc::Connection::prepareStatement | ( | const std::string & | sql, |
int | resultSetType, | ||
int | resultSetConcurrency | ||
) |
Create a prepared statement.
Example: std::auto_ptr<PreparedStatement> pstmt(cnt->prepareStatement(s, x, y));
void odbc::Connection::setAutoCommit | ( | bool | autoCommit | ) |
Sets the autocommit state of this connection.
autoCommit | true for on, false for off |