Class CConnection
A
CConnection represents a session with a specific database. Within the context
of a CConnection, SQL statements are executed and results are returned.
Note: By default the CConnection automatically commits changes after
executing each statement. If auto commit has been disabled, an explicit commit
must be done or database changes will not be saved.
- See Also:
-
CStatement, CResultSet
Constructor Summary |
CConnection() Constructs a CConnection object. You must
initialize the object by calling
connect. |
Method Summary |
int |
commit() Commits the transaction associated with a
specified service context.
|
int |
connect(const char *username, const char *password,
const char *dblink) This function is used to create a simple logon
session.
|
CStatement* |
createStatement() SQL statements with or without
parameters are normally executed using CStatement
objects.
|
private int |
deallocate() Freeing an allocated OCI environment.
|
int |
disconnect() This function is used to terminate a
connection and session created with connect(). |
CResultSet* |
getColumnComments(const char* tab_name = NULL) Get the column comments.
|
CResultSet* |
getTableComments() Get the table comments. |
private int |
init() Creating and initializing an OCI
environment.
|
int |
rollback() Rolls back the current
transaction.
|
CConnection::CConnection
CConnection();
- Constructs a CConnection object. After constructing the object, you must call its connect member function to establish a connection to a specified data source.
CConnection::commit
int commit();
- Commits the transaction associated with a specified
service context.
- Returns:
- either the error code or 0 for SQL success.
CConnection::connect
int connect(const char *username, const char *password,
const char *dblink);
- This function is used to create a simple logon session.
- Parameters:
- username - the username.
- password - the user's password.
- dblink - the name of the database to connect to.
- Returns:
- either the error code or 0 for SQL success.
CConnection::createStatement
CStatement*
createStatement
();
- SQL statements with or without parameters are
normally executed using CStatement objects.
- Returns:
- pointer to a new CStatement object.
CConnection::deallocate
private int deallocate();
- Freeing an allocated OCI environment.
- Returns:
- either the error code or 0 for SQL success.
CConnection::disconnect
int disconnect();
- This function is used to terminate a connection and
session created with connect().
- Returns:
- either the error code or 0 for SQL success.
CConnection::getColumnComments
CResultSet*
getColumnComments
(const char* tab_name);
- Gets the column comments.
- Parameters:
- tab_name - the table name.
- Returns:
- pointer to a new CResultSet object.
CConnection::getTableComments
CResultSet*
getTableComments
();
- Gets the table comments.
- Returns:
- pointer to a new CResultSet object.
CConnection::init
int init();
- Creating and initializing an OCI environment.
- Returns:
- either the error code or 0 for SQL success.
CConnection::rollback
int rollback();
- Rolls back the current transaction.
- Returns:
- either the error code or 0 for SQL success.
Submit comments/suggestions about
OCL.
Copyright 2001 Sergey Yakovlev. All
Rights Reserved.