dbAnyCursor Class Reference

#include <cursor.h>

Inheritance diagram for dbAnyCursor:

dbL2List dbCursor

List of all members.


Detailed Description

Base class for all cursors.

Public Member Functions

int getNumberOfRecords () const
 Get number of selected records.
void remove ()
 Remove current record.
bool isEmpty () const
 Checks whether selection is empty.
bool isUpdateCursor () const
 Check whether this cursor can be used for update.
bool isLimitReached () const
 Checks whether limit for number of selected reacord is reached.
oid_ttoArrayOfOid (oid_t *arr) const
 Extract OIDs of selected recrods in array.
int select (dbQuery &query, dbCursorType aType, void *paramStruct=NULL)
 Execute query.
int select (dbQuery &query, void *paramStruct=NULL)
 Execute query with default cursor type.
int select (char const *condition, dbCursorType aType, void *paramStruct=NULL)
 Execute query.
int select (char const *condition, void *paramStruct=NULL)
 Execute query with default cursor type.
int select (dbCursorType aType)
 Select all records from the table.
int select ()
 Select all records from the table with default cursor type.
int selectByKey (char const *key, void const *value)
 Select all records from the table with specfied value of the key.
int selectByKeyRange (char const *key, void const *minValue, void const *maxValue)
 Select all records from the table with specfied range of the key values.
void update ()
 Update current record.
void removeAll ()
 Remove all records in the table.
void removeAllSelected ()
 Remove all selected records.
void setSelectionLimit (size_t lim)
 Specify maximal number of records to be selected.
void unsetSelectionLimit ()
 Remove selection limit.
void setPrefetchMode (bool mode)
 Set prefetch mode.
void enableCheckForDuplicates (bool enabled)
 Enable or disable duplicates checking (if programmer knows that disjuncts in query do not intersect, then he can disable duplicate checking and avoid bitmap allocation.
void reset ()
 Reset cursor.
bool isLast () const
 Check whether current record is the last one in the selection.
bool isFirst () const
 Check whether current record is the first one in the selection.
void freeze ()
 Freeze cursor.
void unfreeze ()
 Unfreeze cursor.
bool skip (int n)
 Skip specified number of records.
int seek (oid_t oid)
 Position cursor on the record with the specified OID.
dbTableDescriptorgetTable ()
 Get table for which cursor is opened.
void setTable (dbTableDescriptor *aTable)
 Set table for the cursor.
void setRecord (void *rec)
 Set destination for selected record rec - buffer to which fields of current record will be fetched.
void * getRecord ()
 Get pointer to the location where fields of the current record are fetched.
bool isInSelection (oid_t oid)
 Check if record with specified OID is in selection.
void fetch ()
 Fetch current record.
bool hasNext () const
 Check if there is more records in the selection.
 dbAnyCursor ()
 ~dbAnyCursor ()

Protected Member Functions

void checkForDuplicates ()
void deallocateBitmap ()
bool isMarked (oid_t oid)
void setStatementLimit (dbQuery const &q)
void truncateSelection ()
void mark (oid_t oid)
bool add (oid_t oid)
bytefetchNext ()
bytefetchPrev ()
bool gotoNext ()
bool gotoPrev ()
bool gotoFirst ()
bool gotoLast ()
bool moveNext ()
bool movePrev ()
void setCurrent (dbAnyReference const &ref)
void adjustReferences (size_t base, size_t size, long shift)
 dbAnyCursor (dbTableDescriptor &aTable, dbCursorType aType, byte *rec)

Protected Attributes

dbDatabasedb
dbTableDescriptortable
dbCursorType type
dbCursorType defaultType
dbSelection selection
bool allRecords
oid_t firstId
oid_t lastId
oid_t currId
byterecord
size_t limit
int4bitmap
size_t bitmapSize
bool eliminateDuplicates
bool checkForDuplicatedIsEnabled
bool prefetch
bool removed
bool lastRecordWasDeleted
size_t stmtLimitStart
size_t stmtLimitLen
size_t nSkipped
void * paramBase

Friends

class dbAnyContainer
class dbDatabase
class dbHashTable
class dbTtreeNode
class dbRtreePage
class dbSubSql
class dbStatement
class dbServer
class dbCLI
class JniResultSet

Constructor & Destructor Documentation

dbAnyCursor ( dbTableDescriptor aTable,
dbCursorType  aType,
byte rec 
) [inline, protected]

dbAnyCursor (  )  [inline]

~dbAnyCursor (  ) 


Member Function Documentation

int getNumberOfRecords (  )  const [inline]

Get number of selected records.

Returns:
number of selected records

void remove (  ) 

Remove current record.

bool isEmpty (  )  const [inline]

Checks whether selection is empty.

Returns:
true if there is no current record

bool isUpdateCursor (  )  const [inline]

Check whether this cursor can be used for update.

Returns:
true if it is update cursor

bool isLimitReached (  )  const [inline]

Checks whether limit for number of selected reacord is reached.

Returns:
true if limit is reached

oid_t * toArrayOfOid ( oid_t arr  )  const

Extract OIDs of selected recrods in array.

Parameters:
arr if arr is not null, then this array is used as destination (it should be at least selection.nRows long)
If arr is null, then new array is created by new oid_t[] and returned by this method
Returns:
if arr is not null, then arr, otherwise array created by this method

int select ( dbQuery query,
dbCursorType  aType,
void *  paramStruct = NULL 
) [inline]

Execute query.

Parameters:
query selection criteria
aType cursor type: dbCursorForUpdate, dbCursorViewOnly
paramStruct pointer to structure with parameters. If you want to create reentrant precompiled query, i.e. query which can be used concurrently by different threadsm you should avoid to use static variables in such query, and instead of it place paramters into some structure, specify in query relative offsets to the parameters, fill local structure and pass pointer to it to select method.
Returns:
number of selected records

int select ( dbQuery query,
void *  paramStruct = NULL 
) [inline]

Execute query with default cursor type.

Parameters:
query selection criteria
paramStruct pointer to structure with parameters.
Returns:
number of selected records

int select ( char const *  condition,
dbCursorType  aType,
void *  paramStruct = NULL 
) [inline]

Execute query.

Parameters:
condition selection criteria
aType cursor type: dbCursorForUpdate, dbCursorViewOnly
paramStruct pointer to structure with parameters.
Returns:
number of selected records

int select ( char const *  condition,
void *  paramStruct = NULL 
) [inline]

Execute query with default cursor type.

Parameters:
condition selection criteria
paramStruct pointer to structure with parameters.
Returns:
number of selected records

int select ( dbCursorType  aType  )  [inline]

Select all records from the table.

Parameters:
aType cursor type: dbCursorForUpdate, dbCursorViewOnly
Returns:
number of selected records

int select (  )  [inline]

Select all records from the table with default cursor type.

Returns:
number of selected records

int selectByKey ( char const *  key,
void const *  value 
)

Select all records from the table with specfied value of the key.

Parameters:
key name of the key field
value searched value of the key
Returns:
number of selected records

int selectByKeyRange ( char const *  key,
void const *  minValue,
void const *  maxValue 
)

Select all records from the table with specfied range of the key values.

Parameters:
key name of the key field
minValue inclusive low bound for key values, if NULL then there is no low bound
maxValue inclusive high bound for key values, if NULL then there is no high bound
Returns:
number of selected records

void update (  )  [inline]

Update current record.

You should changed value of current record before and then call update method to save changes to the database

void removeAll (  )  [inline]

Remove all records in the table.

void removeAllSelected (  ) 

Remove all selected records.

void setSelectionLimit ( size_t  lim  )  [inline]

Specify maximal number of records to be selected.

void unsetSelectionLimit (  )  [inline]

Remove selection limit.

void setPrefetchMode ( bool  mode  )  [inline]

Set prefetch mode.

By default, current record is fetch as soon as it is becomes current. But sometimesyou need only OIDs of selected records. In this case setting prefetchMode to false can help.

Parameters:
mode if false then current record is not fetched. You should explicitly call fetch method if you want to fetch it.

void enableCheckForDuplicates ( bool  enabled  )  [inline]

Enable or disable duplicates checking (if programmer knows that disjuncts in query do not intersect, then he can disable duplicate checking and avoid bitmap allocation.

void reset (  ) 

Reset cursor.

Reimplemented from dbL2List.

bool isLast (  )  const

Check whether current record is the last one in the selection.

Returns:
true if next() method will return NULL

bool isFirst (  )  const

Check whether current record is the first one in the selection.

Returns:
true if prev() method will return NULL

void freeze (  ) 

Freeze cursor.

This method makes it possible to save current state of cursor, close transaction to allow other threads to proceed, and then later restore state of the cursor using unfreeze method and continue traversal through selected records.

void unfreeze (  ) 

Unfreeze cursor.

This method starts new transaction and restore state of the cursor

bool skip ( int  n  ) 

Skip specified number of records.

Parameters:
n if positive then skip n records forward, if negative then skip -n records backward
Returns:
true if specified number of records was successfully skipped, false if there is no next (n > 0) or previous (n < 0) record in the selction.

int seek ( oid_t  oid  ) 

Position cursor on the record with the specified OID.

Parameters:
oid object identifier of record
Returns:
poistion of the record in the selection or -1 if record with such OID is not in selection

dbTableDescriptor* getTable (  )  [inline]

Get table for which cursor is opened.

void setTable ( dbTableDescriptor aTable  )  [inline]

Set table for the cursor.

Parameters:
aTable table which records will be iterated

void setRecord ( void *  rec  )  [inline]

Set destination for selected record rec - buffer to which fields of current record will be fetched.

void* getRecord (  )  [inline]

Get pointer to the location where fields of the current record are fetched.

Returns:
pointer to the memory location set by cursor constructor or setRecord method

bool isInSelection ( oid_t  oid  ) 

Check if record with specified OID is in selection.

Returns:
true if record with such OID was selected

void fetch (  )  [inline]

Fetch current record.

You should use this method only if prefetch mode is disabled

bool hasNext (  )  const

Check if there is more records in the selection.

void checkForDuplicates (  )  [protected]

void deallocateBitmap (  )  [protected]

bool isMarked ( oid_t  oid  )  [inline, protected]

void setStatementLimit ( dbQuery const &  q  )  [inline, protected]

void truncateSelection (  )  [inline, protected]

void mark ( oid_t  oid  )  [inline, protected]

bool add ( oid_t  oid  )  [inline, protected]

byte * fetchNext (  )  [protected]

byte * fetchPrev (  )  [protected]

bool gotoNext (  )  [protected]

bool gotoPrev (  )  [protected]

bool gotoFirst (  )  [protected]

bool gotoLast (  )  [protected]

bool moveNext (  )  [protected]

bool movePrev (  )  [protected]

void setCurrent ( dbAnyReference const &  ref  )  [protected]

void adjustReferences ( size_t  base,
size_t  size,
long  shift 
) [inline, protected]


Friends And Related Function Documentation

friend class dbAnyContainer [friend]

friend class dbDatabase [friend]

friend class dbHashTable [friend]

friend class dbTtreeNode [friend]

friend class dbRtreePage [friend]

friend class dbSubSql [friend]

friend class dbStatement [friend]

friend class dbServer [friend]

friend class dbCLI [friend]

friend class JniResultSet [friend]


Member Data Documentation

dbDatabase* db [protected]

dbTableDescriptor* table [protected]

dbCursorType type [protected]

dbSelection selection [protected]

bool allRecords [protected]

oid_t firstId [protected]

oid_t lastId [protected]

oid_t currId [protected]

byte* record [protected]

size_t limit [protected]

int4* bitmap [protected]

size_t bitmapSize [protected]

bool eliminateDuplicates [protected]

bool checkForDuplicatedIsEnabled [protected]

bool prefetch [protected]

bool removed [protected]

bool lastRecordWasDeleted [protected]

size_t stmtLimitStart [protected]

size_t stmtLimitLen [protected]

size_t nSkipped [protected]

void* paramBase [protected]


Online Library Docs

sipXecs home page

Version 4.2.1-018930 2010-07-31T01:13:23 build16 abuild