Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

Oracle8iConnection Class Reference

Abstraction of connection to an Oracle database using Oracle 8i OCI. More...

#include <Oracle8iConnection.h>

Inheritance diagram for Oracle8iConnection:

Inheritance graph
[legend]
Collaboration diagram for Oracle8iConnection:

Collaboration graph
[legend]
List of all members.

Public Member Functions

virtual ~Oracle8iConnection ()
virtual bool Disconnect ()
virtual bool Abort ()
virtual bool Autocommit (bool ac)

Protected Member Functions

 Oracle8iConnection (class Database *db, const char *userName, const char *password, const int localHandle, const int globalHandle, OCISvcCtx *serviceContext)
virtual bool _Commit ()
virtual bool _Rollback ()
virtual bool _Savepoint (const char *name)
virtual bool _RollbackToSavepoint (const char *name)
virtual bool _NextOID (long &nextOid, long &nextSN)
virtual bool _NextSN (long curOid, long &nextSN)
virtual Cursor_GetNewCursor ()
int processOCIError (int ociRetVal, const char *ociFunctionName, const char *myFunctionName, bool useEnvHandle=0)

Static Protected Member Functions

void logDebugMessage (const char *formatString, const char *param1="", int mask=0)

Protected Attributes

OCISvcCtx * serviceContext
OCIEnv * ociEnvironment
OCIError * errorHandle
bool autoCommit

Friends

int processOCIErrorGlobal (Oracle8iClassType classType, OCIEnv *ociEnvironment, OCIError *errorHandle, sword ociRetVal, const char *ociFunctionName, const char *myFunctionName, bool useEnvHandle)

Detailed Description

Abstraction of connection to an Oracle database using Oracle 8i OCI.

Methods of this class return true if OK, false otherwise (if not explicitly said something different). In case of connection error they throw exception ObjLibException_ConnectionError.

See also:
Oracle8iSqlStatements, Oracle8iDatabase, Oracle8iCursor


Constructor & Destructor Documentation

Oracle8iConnection::Oracle8iConnection class Database db,
const char *  userName,
const char *  password,
const int  localHandle,
const int  globalHandle,
OCISvcCtx *  serviceContext
[protected]
 

Constructor. It should be called only from Oracle8iDatabase::Connect()

Note:
Connection to Oracle server is created before this function call in Oracle8iDatabase::Connect(). Resulting serviceContext is then sent to this constructor.
Parameters:
db Oracle8iDatabase this connection belongs to.
userName User name used for connecting.
password Password used for connecting.
localHandle Index of this connection in array Database::_Connections.
globalHandle Index of this connection in array Database::_AllConnections.
serviceContext Pointer to service context handle already created in Oracle8iDatabase::Connect().

Oracle8iConnection::~Oracle8iConnection  )  [virtual]
 

Destructor - empty for now.


Member Function Documentation

bool Oracle8iConnection::_Commit  )  [protected, virtual]
 

Commits actual transaction.

Implements Connection.

bool Oracle8iConnection::_Rollback  )  [protected, virtual]
 

Performs rollback of actual transaction.

Implements Connection.

bool Oracle8iConnection::_Savepoint const char *  name  )  [protected, virtual]
 

Creates savepoint with given name.

Parameters:
name Name of savepoint to be created.

Implements Connection.

bool Oracle8iConnection::_RollbackToSavepoint const char *  name  )  [protected, virtual]
 

Performs rollback to savepoint with given name

Parameters:
name Name of savepoint to rollback to.

Implements Connection.

bool Oracle8iConnection::_NextOID long &  nextOid,
long &  nextSN
[protected, virtual]
 

Generates new OID and Serial Number for new object (using appropriate Oracle sequences).

Note:
Obsolete function used by POLiTe-style persistent classes. IopcPersistentObject ancestors don't use this function.
Parameters:
nextOid Resulting OID.
nextSN Resulting Serial Number

bool Oracle8iConnection::_NextSN long  curOid,
long &  nextSN
[protected, virtual]
 

Generates new Serial Number for object with given curOid

Note:
Obsolete function used by POLiTe-style persistent classes. IopcPersistentObject ancestors don't use this function.
Parameters:
curOid Current OID of the object - not used for now.
nextSN Resulting Serial Number

bool Oracle8iConnection::Disconnect  )  [virtual]
 

Commits actual transaction, then disconnects from database (including freeing of serviceContext).

Reimplemented from Connection.

bool Oracle8iConnection::Abort  )  [virtual]
 

Performs rollback of actual transaction, then disconnect from database (including freeing of serviceContext).

Reimplemented from Connection.

bool Oracle8iConnection::Autocommit bool  ac  )  [virtual]
 

Turns on / off autocommit (automatic commit of every SQL data manipulation statement).

Parameters:
ac 1 to turn autocommit on, 0 to turn it off.

Implements Connection.

Cursor * Oracle8iConnection::_GetNewCursor  )  [protected, virtual]
 

Creates and returns new Oracle8iCursor.

Implements Connection.

int Oracle8iConnection::processOCIError int  ociRetVal,
const char *  ociFunctionName,
const char *  myFunctionName,
bool  useEnvHandle = 0
[inline, protected]
 

Arbitrary function for error handling - calls processOCIErrorGlobal() passing it given parameters and some class specific values.

Parameters:
ociRetVal Return value of OCI function to handle its (possible) error.
ociFunctionName Name of the OCI function.
myFunctionName Name of the class member, who called the OCI function.
useEnvHandle Set if OCIErrorGet() is to be called on ociEnvironment instead of on errorHandle.
Returns:
Return value from processOCIErrorGlobal()

void Oracle8iConnection::logDebugMessage const char *  formatString,
const char *  param1 = "",
int  mask = 0
[inline, static, protected]
 

Logs (using logmsg()) given message if C_ORACLECONNECTION_TRACE is set, otherwise does nothing.

Parameters:
formatString String with message to be logged - can contains only one "%s" specifier for inserting string param1.
param1 Optional string to be inserted into formatString
mask Mask (see TL_INFO_SQL etc.) to be passed to logmsg()


Friends And Related Function Documentation

int processOCIErrorGlobal Oracle8iClassType  classType,
OCIEnv *  ociEnvironment,
OCIError *  errorHandle,
sword  ociRetVal,
const char *  ociFunctionName,
const char *  myFunctionName,
bool  useEnvHandle
[friend]
 

According to type of ociRetVal creates error message (typically it's necessary to call OCIErrorGet()) and calls logDebugMessage() method of class specified by classType to log the message.

Parameters:
classType Type of Oracle8i* class this function was called from.
ociEnvironment Pointer to OCI environment handle.
errorHandle Pointer to OCI error handle.
ociRetVal Return value of OCI function to handle its (possible) error.
ociFunctionName Name of the OCI function.
myFunctionName Name of member function of specified class, which was the OCI function called from.
useEnvHandle Set if OCIErrorGet() is to be called on ociEnvironment instead of errorHandle.
Return values:
0 OK, no error occured.
-1 Some error occured, OCIErrorGet() hasn't been called.
Other ORA-????? error code (acquired from OCIErrorGet()).


Member Data Documentation

OCISvcCtx* Oracle8iConnection::serviceContext [protected]
 

The service context pointer - represents one opened connection (created in Oracle8iDatabase::Connect()).

OCIEnv* Oracle8iConnection::ociEnvironment [protected]
 

Pointer to OCI Environment handle (see OCIEnvCreate() in Oracle documentation).

Created in Oracle8iDatabase::Oracle8iDatabase() and copied here in constructor of this class.

OCIError* Oracle8iConnection::errorHandle [protected]
 

Pointer to OCI error handle to be passed to OCIErrorGet() for diagnostic information in the event of an error.

Created in Oracle8iDatabase::Oracle8iDatabase() and copied here in constructor of this class.

bool Oracle8iConnection::autoCommit [protected]
 

Should each SQL statement sent to database be automatically committed (imlicitly not)?

Note:
This member is accessed from Oracle8iCursor::_Execute() using Oracle8iCursor::autoCommit.


The documentation for this class was generated from the following files:
Generated on Wed Aug 11 22:36:05 2004 for IOPC by Doxygen 1.3.6