odbc::Connection Class Reference

Inheritance diagram for odbc::Connection:

odbc::ErrorHandler odbc::ErrorHandler List of all members.

Detailed Description

A database connection.

Definition at line 38 of file connection.h.

Public Types

enum  TransactionIsolation {
  TRANSACTION_NONE, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_READ_COMMITTED, TRANSACTION_REPEATABLE_READ,
  TRANSACTION_SERIALIZABLE, TRANSACTION_NONE, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_READ_COMMITTED,
  TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE
}
 Transaction isolation constants. More...
enum  TransactionIsolation {
  TRANSACTION_NONE, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_READ_COMMITTED, TRANSACTION_REPEATABLE_READ,
  TRANSACTION_SERIALIZABLE, TRANSACTION_NONE, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_READ_COMMITTED,
  TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE
}
 Transaction isolation constants. More...

Public Member Functions

void commit ()
 Commits the ongoing transaction.
void commit ()
 Commits the ongoing transaction.
StatementcreateStatement (int resultSetType, int resultSetConcurrency)
 Creates a non-prepared statement.
StatementcreateStatement ()
 Creates a non-prepared statement.
StatementcreateStatement (int resultSetType, int resultSetConcurrency)
 Creates a non-prepared statement.
StatementcreateStatement ()
 Creates a non-prepared statement.
bool getAutoCommit ()
 Returns true if autocommit is on.
bool getAutoCommit ()
 Returns true if autocommit is on.
ODBCXX_STRING getCatalog ()
 Returns the current catalog.
ODBCXX_STRING getCatalog ()
 Returns the current catalog.
DatabaseMetaDatagetMetaData ()
 Returns meta information for this connection.
DatabaseMetaDatagetMetaData ()
 Returns meta information for this connection.
bool getTrace ()
 Returns true if ODBC tracing is enabled on this connection.
bool getTrace ()
 Returns true if ODBC tracing is enabled on this connection.
ODBCXX_STRING getTraceFile ()
 Returns the file ODBC tracing is currently written to.
ODBCXX_STRING getTraceFile ()
 Returns the file ODBC tracing is currently written to.
TransactionIsolation getTransactionIsolation ()
 Returns the current transaction isolation level.
TransactionIsolation getTransactionIsolation ()
 Returns the current transaction isolation level.
bool isReadOnly ()
 Returns true if the connection is read only.
bool isReadOnly ()
 Returns true if the connection is read only.
ODBCXX_STRING nativeSQL (const ODBCXX_STRING &sql)
 Translate a given SQL string into this data sources' own SQL grammar.
ODBCXX_STRING nativeSQL (const ODBCXX_STRING &sql)
 Translate a given SQL string into this data sources' own SQL grammar.
CallableStatementprepareCall (const ODBCXX_STRING &sql, int resultSetType, int resultSetConcurrency)
 Create a callable prepared statement.
CallableStatementprepareCall (const ODBCXX_STRING &sql)
 Create a callable prepared statement.
CallableStatementprepareCall (const ODBCXX_STRING &sql, int resultSetType, int resultSetConcurrency)
 Create a callable prepared statement.
CallableStatementprepareCall (const ODBCXX_STRING &sql)
 Create a callable prepared statement.
PreparedStatementprepareStatement (const ODBCXX_STRING &sql, int resultSetType, int resultSetConcurrency)
 Create a prepared statement.
PreparedStatementprepareStatement (const ODBCXX_STRING &sql)
 Create a prepared statement.
PreparedStatementprepareStatement (const ODBCXX_STRING &sql, int resultSetType, int resultSetConcurrency)
 Create a prepared statement.
PreparedStatementprepareStatement (const ODBCXX_STRING &sql)
 Create a prepared statement.
void rollback ()
 Rollbacks the ongoing transaction.
void rollback ()
 Rollbacks the ongoing transaction.
void setAutoCommit (bool autoCommit)
 Sets the autocommit state of this connection.
void setAutoCommit (bool autoCommit)
 Sets the autocommit state of this connection.
void setCatalog (const ODBCXX_STRING &catalog)
 Sets the current catalog.
void setCatalog (const ODBCXX_STRING &catalog)
 Sets the current catalog.
void setReadOnly (bool readOnly)
 Sets the read-only state of this connection.
void setReadOnly (bool readOnly)
 Sets the read-only state of this connection.
void setTrace (bool on)
 Sets ODBC tracing on or off.
void setTrace (bool on)
 Sets ODBC tracing on or off.
void setTraceFile (const ODBCXX_STRING &s)
 Sets the file ODBC tracing is written to.
void setTraceFile (const ODBCXX_STRING &s)
 Sets the file ODBC tracing is written to.
void setTransactionIsolation (TransactionIsolation isolation)
 Sets the current transaction isolation level.
void setTransactionIsolation (TransactionIsolation isolation)
 Sets the current transaction isolation level.
virtual ~Connection ()
 Destructor.
virtual ~Connection ()
 Destructor.


Member Enumeration Documentation

enum odbc::Connection::TransactionIsolation

Transaction isolation constants.

Enumerator:
TRANSACTION_NONE  The data source does not support transactions.
TRANSACTION_READ_UNCOMMITTED  Dirty reads, non-repeatable reads and phantom reads can occur.

TRANSACTION_READ_COMMITTED  Non-repeatable and phantom reads can occur.
TRANSACTION_REPEATABLE_READ  Phantom reads can occur.
TRANSACTION_SERIALIZABLE  Simply no problems.
TRANSACTION_NONE  The data source does not support transactions.
TRANSACTION_READ_UNCOMMITTED  Dirty reads, non-repeatable reads and phantom reads can occur.

TRANSACTION_READ_COMMITTED  Non-repeatable and phantom reads can occur.
TRANSACTION_REPEATABLE_READ  Phantom reads can occur.
TRANSACTION_SERIALIZABLE  Simply no problems.

Definition at line 81 of file connection.h.

enum odbc::Connection::TransactionIsolation

Transaction isolation constants.

Enumerator:
TRANSACTION_NONE  The data source does not support transactions.
TRANSACTION_READ_UNCOMMITTED  Dirty reads, non-repeatable reads and phantom reads can occur.

TRANSACTION_READ_COMMITTED  Non-repeatable and phantom reads can occur.
TRANSACTION_REPEATABLE_READ  Phantom reads can occur.
TRANSACTION_SERIALIZABLE  Simply no problems.
TRANSACTION_NONE  The data source does not support transactions.
TRANSACTION_READ_UNCOMMITTED  Dirty reads, non-repeatable reads and phantom reads can occur.

TRANSACTION_READ_COMMITTED  Non-repeatable and phantom reads can occur.
TRANSACTION_REPEATABLE_READ  Phantom reads can occur.
TRANSACTION_SERIALIZABLE  Simply no problems.

Definition at line 81 of file connection.h.


Constructor & Destructor Documentation

virtual odbc::Connection::~Connection (  )  [virtual]

Destructor.

Closes the connection

virtual odbc::Connection::~Connection (  )  [virtual]

Destructor.

Closes the connection


Member Function Documentation

Statement* odbc::Connection::createStatement ( int  resultSetType,
int  resultSetConcurrency 
)

Creates a non-prepared statement.

Example: std::auto_ptr<Statement> stmt = std::auto_ptr<Statement>(cnt->createStatement(x, y));

Parameters:
resultSetType The type for ResultSets created by this statement
resultSetConcurrency The concurrency for ResultSets created by this statement

Statement* odbc::Connection::createStatement (  ) 

Creates a non-prepared statement.

Example: std::auto_ptr<Statement> stmt = std::auto_ptr<Statement>(cnt->createStatement());

Statement* odbc::Connection::createStatement ( int  resultSetType,
int  resultSetConcurrency 
)

Creates a non-prepared statement.

Example: std::auto_ptr<Statement> stmt = std::auto_ptr<Statement>(cnt->createStatement(x, y));

Parameters:
resultSetType The type for ResultSets created by this statement
resultSetConcurrency The concurrency for ResultSets created by this statement

Statement* odbc::Connection::createStatement (  ) 

Creates a non-prepared statement.

Example: std::auto_ptr<Statement> stmt = std::auto_ptr<Statement>(cnt->createStatement());

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();

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 ODBCXX_STRING &  sql,
int  resultSetType,
int  resultSetConcurrency 
)

Create a callable prepared statement.

Example: std::auto_ptr<CallableStatement> cstmt = std::auto_ptr<CallableStatement>(cnt->prepareCall(s, x, y));

Parameters:
sql The string to prepare, optionally containing parameter markers for input and/or output parameters
resultSetType The type for ResultSets created by this statement
resultSetConcurrency The concurrency for ResultSets created by this statement

CallableStatement* odbc::Connection::prepareCall ( const ODBCXX_STRING &  sql  ) 

Create a callable prepared statement.

Example: std::auto_ptr<CallableStatement> cstmt = std::auto_ptr<CallableStatement>(cnt->prepareCall(s));

Parameters:
sql The string to prepare, optionally containing parameter markers for input and/or output parameters

CallableStatement* odbc::Connection::prepareCall ( const ODBCXX_STRING &  sql,
int  resultSetType,
int  resultSetConcurrency 
)

Create a callable prepared statement.

Example: std::auto_ptr<CallableStatement> cstmt = std::auto_ptr<CallableStatement>(cnt->prepareCall(s, x, y));

Parameters:
sql The string to prepare, optionally containing parameter markers for input and/or output parameters
resultSetType The type for ResultSets created by this statement
resultSetConcurrency The concurrency for ResultSets created by this statement

CallableStatement* odbc::Connection::prepareCall ( const ODBCXX_STRING &  sql  ) 

Create a callable prepared statement.

Example: std::auto_ptr<CallableStatement> cstmt = std::auto_ptr<CallableStatement>(cnt->prepareCall(s));

Parameters:
sql The string to prepare, optionally containing parameter markers for input and/or output parameters

PreparedStatement* odbc::Connection::prepareStatement ( const ODBCXX_STRING &  sql,
int  resultSetType,
int  resultSetConcurrency 
)

Create a prepared statement.

Example: std::auto_ptr<PreparedStatement> pstmt = std::auto_ptr<PreparedStatement>(cnt->prepareStatement(s, x, y));

Parameters:
sql The string to prepare, optionally containing parameter markers.
resultSetType The type for ResultSets created by this statement
resultSetConcurrency The concurrency for ResultSets created by this statement

PreparedStatement* odbc::Connection::prepareStatement ( const ODBCXX_STRING &  sql  ) 

Create a prepared statement.

Example: std::auto_ptr<PreparedStatement> pstmt = std::auto_ptr<PreparedStatement>(cnt->prepareStatement(s));

Parameters:
sql The string to prepare, optionally containing parameter markers (?).

PreparedStatement* odbc::Connection::prepareStatement ( const ODBCXX_STRING &  sql,
int  resultSetType,
int  resultSetConcurrency 
)

Create a prepared statement.

Example: std::auto_ptr<PreparedStatement> pstmt = std::auto_ptr<PreparedStatement>(cnt->prepareStatement(s, x, y));

Parameters:
sql The string to prepare, optionally containing parameter markers.
resultSetType The type for ResultSets created by this statement
resultSetConcurrency The concurrency for ResultSets created by this statement

PreparedStatement* odbc::Connection::prepareStatement ( const ODBCXX_STRING &  sql  ) 

Create a prepared statement.

Example: std::auto_ptr<PreparedStatement> pstmt = std::auto_ptr<PreparedStatement>(cnt->prepareStatement(s));

Parameters:
sql The string to prepare, optionally containing parameter markers (?).

Referenced by ODBCTapeStream::Open(), ODBCTapeStream::PrintHeader(), and ODBCTapeStream::Write().

void odbc::Connection::setAutoCommit ( bool  autoCommit  ) 

Sets the autocommit state of this connection.

Parameters:
autoCommit true for on, false for off

void odbc::Connection::setAutoCommit ( bool  autoCommit  ) 

Sets the autocommit state of this connection.

Parameters:
autoCommit true for on, false for off


The documentation for this class was generated from the following files:
GridLAB-DTM Version 1.0
An open-source project initiated by the US Department of Energy