Main Page | Class Hierarchy | Class List | File List | Class Members

dbAnyCursor Class Reference

#include <cursor.h>

Inheritance diagram for dbAnyCursor:

dbCursor< T > List of all members.

Public Member Functions

int getNumberOfRecords () const
void remove ()
bool isEmpty () const
bool isUpdateCursor () const
bool isLimitReached () const
int select (dbQuery &query, dbCursorType aType, void *paramStruct=NULL)
oid_t * toArrayOfOid (oid_t *arr) const
int select (dbQuery &query, void *paramStruct=NULL)
int select (char_t const *condition, dbCursorType aType, void *paramStruct=NULL)
int select (char_t const *condition, void *paramStruct=NULL)
int select (dbCursorType aType)
int select ()
int selectByKey (char_t const *key, void const *value)
int selectByKeyRange (char_t const *key, void const *minValue, void const *maxValue, bool ascent=true)
void update ()
void removeAll ()
void removeAllSelected ()
void setSelectionLimit (size_t lim)
void unsetSelectionLimit ()
void setPrefetchMode (bool mode)
void reset ()
bool isLast () const
bool isFirst () const
void freeze ()
void unfreeze ()
bool skip (int n)
int seek (oid_t oid)
dbTableDescriptorgetTable ()
bool isInSelection (oid_t oid)
void fetch ()

Protected Member Functions

void allocateBitmap ()
void checkForDuplicates ()
bool isMarked (oid_t oid)
void mark (oid_t oid)
void setStatementLimit (dbQuery const &q)
void truncateSelection ()
bool add (oid_t oid)
bool gotoNext ()
bool gotoPrev ()
bool gotoFirst ()
bool gotoLast ()
void setCurrent (dbAnyReference const &ref)
void setTable (dbTableDescriptor *aTable)
void setRecord (void *rec)
 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
byte * record
size_t limit
dbGetTie tie
void * paramBase
int4 * bitmap
size_t bitmapSize
bool eliminateDuplicates
bool prefetch
bool removed
bool updateInProgress
size_t stmtLimitStart
size_t stmtLimitLen
size_t nSkipped

Friends

class dbDatabase
class dbHashTable
class dbRtreePage
class dbBtreePage
class dbThickBtreePage
class dbSubSql
class dbStatement
class dbServer
class dbAnyContainer
class dbCLI

Detailed Description

Base class for all cursors


Member Function Documentation

void dbAnyCursor::fetch  )  [inline]
 

Fetch current record. You should use this method only if prefetch mode is disabled

void dbAnyCursor::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.

int dbAnyCursor::getNumberOfRecords  )  const [inline]
 

Get number of selected records

Returns:
number of selected records

dbTableDescriptor* dbAnyCursor::getTable  )  [inline]
 

Get descriptor of the table.

Returns:
descriptor of the table associated with the cursor

bool dbAnyCursor::isEmpty  )  const [inline]
 

Checks whether selection is empty

Returns:
true if there is no current record

bool dbAnyCursor::isFirst  )  const
 

Check whether current record is the first one in the selection

Returns:
true if prev() method will return NULL

bool dbAnyCursor::isInSelection oid_t  oid  ) 
 

Check if record with specified OID is in selection

Returns:
true if record with such OID was selected

bool dbAnyCursor::isLast  )  const
 

Check whether current record is the last one in the selection

Returns:
true if next() method will return NULL

bool dbAnyCursor::isLimitReached  )  const [inline]
 

Checks whether limit for number of selected reacord is reached

Returns:
true if limit is reached

bool dbAnyCursor::isUpdateCursor  )  const [inline]
 

Check whether this cursor can be used for update

Returns:
true if it is update cursor

void dbAnyCursor::remove  ) 
 

Remove current record

void dbAnyCursor::removeAll  )  [inline]
 

Remove all records in the table

void dbAnyCursor::removeAllSelected  ) 
 

Remove all selected records

void dbAnyCursor::reset  ) 
 

Reset cursor

int dbAnyCursor::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

int dbAnyCursor::select  )  [inline]
 

Select all records from the table with default cursor type

Returns:
number of selected records

int dbAnyCursor::select dbCursorType  aType  )  [inline]
 

Select all records from the table

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

int dbAnyCursor::select char_t 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 dbAnyCursor::select char_t 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 dbAnyCursor::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 dbAnyCursor::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 dbAnyCursor::selectByKey char_t 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 dbAnyCursor::selectByKeyRange char_t const *  key,
void const *  minValue,
void const *  maxValue,
bool  ascent = true
 

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
ascent key order: true - ascending order, false - descending order
Returns:
number of selected records

void dbAnyCursor::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 dbAnyCursor::setSelectionLimit size_t  lim  )  [inline]
 

Specify maximal number of records to be selected

bool dbAnyCursor::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.

oid_t* dbAnyCursor::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

void dbAnyCursor::unfreeze  ) 
 

Unfreeze cursor. This method starts new transaction and restore state of the cursor

void dbAnyCursor::unsetSelectionLimit  )  [inline]
 

Remove selection limit

void dbAnyCursor::update  )  [inline]
 

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


The documentation for this class was generated from the following file:
Generated on Thu Feb 12 18:46:27 2004 for GigaBASE by doxygen 1.3.5