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

Cursor Class Reference

Abstract class that represents a database cursor. More...

#include <cCursor.h>

Inheritance diagram for Cursor:

Inheritance graph
[legend]
Collaboration diagram for Cursor:

Collaboration graph
[legend]
List of all members.

Public Member Functions

virtual ~Cursor ()

Protected Member Functions

 Cursor (class Connection *DbC)
virtual bool _Open ()
virtual bool _Prepare (const char *const SqlCommand)=0
virtual bool _PreExecBind (const char *varName, const int pos, const void *varAddr, const int varLen, const IopcDataType varType, bool null=false)=0
virtual bool _Execute ()=0
virtual bool _PreFetchBind (const int position, const void *varAddr, const int varLen, const IopcDataType varType, bool *null=NULL)=0
virtual bool _FetchNext ()=0
virtual bool _FetchPrev ()=0
virtual long _Position ()=0
virtual bool _Close ()
virtual bool _PreExecBind (const char *VarName, const void *VarAddr, const int VarLen, const char VarType, short *VarInd=NULL)=0
virtual bool _PreFetchBind (const int Position, const void *VarAddr, const int VarLen, const char VarType, short *VarInd=NULL)=0
char * _GetUserName ()
char * _GetPassword ()

Protected Attributes

Connection_DatabaseConnection
bool _Opened

Detailed Description

Abstract class that represents a database cursor.

The only "correct" instantiable descendant of this class is currently class Oracle8iCursor. If you want to implement support for another database please have a look at that class.

This class was nearly undocumented in POLiTe, I (Josef Troch) have documented all its methods.

Methods of this class returns true if OK, false (or exception) otherwise.

See also:
Connection, DatabaseSqlStatements, Database


Constructor & Destructor Documentation

Cursor::Cursor class Connection DbC  )  [protected]
 

Trivial constructor.

Cursor::~Cursor  )  [virtual]
 

Trivial destructor.


Member Function Documentation

bool Cursor::_Open  )  [protected, virtual]
 

Opens the cursor.

Reimplemented in OracleCursor, and Oracle8iCursor.

virtual bool Cursor::_Prepare const char *const  SqlCommand  )  [protected, pure virtual]
 

Prepares sqlCommand to be executed in database using this cursor.

Parameters:
SqlCommand SQL statement to be processed.

Implemented in OracleCursor, and Oracle8iCursor.

virtual bool Cursor::_PreExecBind const char *  varName,
const int  pos,
const void *  varAddr,
const int  varLen,
const IopcDataType  varType,
bool  null = false
[protected, pure virtual]
 

Binds an input variable of previously prepared SQL command. If varName is not NULL , variable is bound by name (varName), if it is NULL, variable is bound by position (pos). This function is called once for every input variable in SQL statement -> typically more than once per statement.

Note:
Binding by name is used only by old POLiTe-style persistence system. If you don't need to support POLiTe-style persistent classes, you can implement only binding by position.

This is new version of _PreExecBind() added by Josef Troch.

Parameters:
varName Name of the variable in appropriate SQL statement. Can be NULL.
pos Position of the variable in the SQL statement (first variable -> pos = 1). Ignored if varName is set.
varAddr Address of the variable.
varLen Length of the variable (0 if it should be distinguished from varType).
varType Type of the variable.
null Should the variable value be set to NULL ? (If set, varAddr, varLen and varType are ignored.)

Implemented in OracleCursor, and Oracle8iCursor.

virtual bool Cursor::_Execute  )  [protected, pure virtual]
 

Executes SQL statement, that has been already prepared and its input variables (if any) have been bound.

Implemented in OracleCursor, and Oracle8iCursor.

virtual bool Cursor::_PreFetchBind const int  position,
const void *  varAddr,
const int  varLen,
const IopcDataType  varType,
bool *  null = NULL
[protected, pure virtual]
 

Binds an output variable of executed SQL statement. This function is called once for every output variable in SQL statement -> typically more than once per statement.

Note:
This is new version of _PreFetchBind() added by Josef Troch.
Parameters:
position Position of the variable in appropriate SQL statement.
varAddr Address of the variable.
varLen Length of the variable (0 if it should be distinguished from varType).
varType Type of the variable.
null Address of indicator variable - set to true if received value is NULL, otherwise set to false.

Implemented in OracleCursor, and Oracle8iCursor.

virtual bool Cursor::_FetchNext  )  [protected, pure virtual]
 

Fetches next row for SQL statement, that has been already executed and its output variables have been bound.

Implemented in OracleCursor, and Oracle8iCursor.

virtual bool Cursor::_FetchPrev  )  [protected, pure virtual]
 

Fetches previous row for SQL statement, that has been already executed and its output variables have been bound.

If the database doesn't support this functionality, throws ObjLibException_NotSupported.

Implemented in OracleCursor, and Oracle8iCursor.

virtual long Cursor::_Position  )  [protected, pure virtual]
 

Returns actual position in the query - it means how many rows have been already fetched.

Implemented in OracleCursor, and Oracle8iCursor.

bool Cursor::_Close  )  [protected, virtual]
 

Closes the cursor.

Reimplemented in OracleCursor, and Oracle8iCursor.

virtual bool Cursor::_PreExecBind const char *  VarName,
const void *  VarAddr,
const int  VarLen,
const char  VarType,
short *  VarInd = NULL
[protected, pure virtual]
 

Obsolete version of _PreExecBind used by POLiTe-style persistent classes. Use _PreExecBind(const char *,const int,const void *,const int,const IopcDataType,bool) instead.

If you don't need to support POLiTe-style persistent classes, you can make a fake implementation of this function.

Parameters:
VarName Name of the variable in appropriate SQL statement.
VarAddr Address of the variable.
VarLen Length of the variable (0 if it should be distinguished from VarType).
VarType POLiTe-style type of the variable (TYPE_INT etc.)
VarInd Indicator variable to be used.

Implemented in OracleCursor, and Oracle8iCursor.

virtual bool Cursor::_PreFetchBind const int  Position,
const void *  VarAddr,
const int  VarLen,
const char  VarType,
short *  VarInd = NULL
[protected, pure virtual]
 

Obsolete version of _PreFetchBind used by POLiTe-style persistent classes. Use _PreFetchBind(const int,const void *,const int,const IopcDataType,bool *) instead.

If you don't need to support POLiTe-style persistent classes, you can make a fake implementation of this function.

Parameters:
Position Position of the variable in appropriate SQL statement.
VarAddr Address of the variable.
VarLen Length of the variable (0 if it should be distinguished from VarType).
VarType POLiTe-style type of the variable (TYPE_INT etc.)
VarInd Indicator variable to be used.

Implemented in OracleCursor, and Oracle8iCursor.

char * Cursor::_GetUserName  )  [protected]
 

Calls function with the same name on _DatabaseConnection.

char * Cursor::_GetPassword  )  [protected]
 

Calls function with the same name on _DatabaseConnection.


Member Data Documentation

class Connection* Cursor::_DatabaseConnection [protected]
 

Connection to which this cursor belongs.

bool Cursor::_Opened [protected]
 

Is the cursor opened?


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