iopc::CursorImpl Class Reference
[iopcdb]

Interface of driver-side part of the Cursor class implementation. More...

#include <cursorImpl.h>

List of all members.

Public Member Functions

virtual void open ()=0
 Opens the cursor.
virtual void close ()=0
 Closes the cursor.
virtual void prepare ()=0
 Prepares the SQL statement for execution.
virtual void preExecBind (const int pos, const void *varAddr, unsigned int size, const Type &varType, bool setNull, const MetadataHolder &attributes=MetadataHolder::emptyMeta)=0
 Binds an input parameter to a place in the prepared statement.
virtual void execute ()=0
 Executes the statement.
virtual void preFetchBind (const int pos, const void *varAddr, unsigned int size, const Type &varType, bool *isNull=NULL, const MetadataHolder &attributes=MetadataHolder::emptyMeta)=0
 Binds an output parameter to a place in the result set.
virtual bool fetchNext ()=0
 Fetches next result from the result set.
virtual bool fetchPrev ()=0
 Fetches previous result from the result set.
virtual long getPosition ()=0
 Returns current position in the result set.


Detailed Description

Interface of driver-side part of the Cursor class implementation.

Each database driver must provide a class that implements this interface

Instances of this class are obtained using the ConnectionImpl::getCursor method and are returned using the ConnectionImpl::returnCursor() method.

CursorImpl implementation is responsible for SQL statement execution, parameter binding and query results retrieval.

Cursor executes operations of this interface in the following order:

  1. CursorImpl::open()
  2. CursorImpl::prepare()
  3. CursorImpl::preExecBind()
  4. ... binds as many IN parameters as required
  5. CursorImpl::execute()
  6. CursorImpl::preFetchBind()
  7. ... binds as many OUT parameters as required
  8. Optionally continues with step 2 without binding the parameters
  9. CursorImpl::close()

Member Function Documentation

virtual void iopc::CursorImpl::open (  )  [pure virtual]

Opens the cursor.

Implementation should allocate all resources needed for the SQL statement execution

virtual void iopc::CursorImpl::close (  )  [pure virtual]

Closes the cursor.

Implementation should release all resources allocated in the CursorImpl::open() method

virtual void iopc::CursorImpl::preExecBind ( const int  pos,
const void *  varAddr,
unsigned int  size,
const Type varType,
bool  setNull,
const MetadataHolder attributes = MetadataHolder::emptyMeta 
) [pure virtual]

Binds an input parameter to a place in the prepared statement.

Parameters:
pos Position of the parameter in the prepared statement
varAddr Address of the parameter value to be bound
size Memory size of the parameter in bytes
varType Data type of the parameter. varType refers only to basic datatypes (IOPC_TYPECLASS_SIMPLE) or to string datatypes (IOPC_TYPECLASS_STRING). If the IOPC_TYPECLASS_STRING type is specified, the varAddr refers to standard zero-terminaded C string representation.
setNull Indicates, that instead the parameter should be a database NULL value. In this case, the varAddr pointer may be NULL.
attributes Additional driver dependent parameters.

virtual void iopc::CursorImpl::preFetchBind ( const int  pos,
const void *  varAddr,
unsigned int  size,
const Type varType,
bool *  isNull = NULL,
const MetadataHolder attributes = MetadataHolder::emptyMeta 
) [pure virtual]

Binds an output parameter to a place in the result set.

Parameters:
pos Position of the parameter in the result set
varAddr Address of the output buffer where the fetched value will be stored.
size Buffer size allocated to hold the fetched value in bytes
varType Data type of the parameter. varType refers only to basic datatypes (IOPC_TYPECLASS_SIMPLE) or to string datatypes (IOPC_TYPECLASS_STRING).
isNull Pointer to an indicator variable which will be set to true if the fetched value is database NULL. A NULL pointer may be passed to ignore the database NULL value notifiaction.
attributes Additional driver dependent parameters.

virtual bool iopc::CursorImpl::fetchNext (  )  [pure virtual]

Fetches next result from the result set.

Output parameters and NULL indicators specified in CursorImpl::preFetchBind are updated.

virtual bool iopc::CursorImpl::fetchPrev (  )  [pure virtual]

Fetches previous result from the result set.

Output parameters and NULL indicators specified in CursorImpl::preFetchBind are updated.

Exceptions:
IopcNotSupportedException if this operation is not supported by the database driver.


The documentation for this class was generated from the following file:

Generated on Tue Apr 14 16:46:39 2009 for IOPC 2 by  doxygen 1.5.6