RVC::DBTABLE::CURSOR Class Reference

Class to represent database table cursors used in ODBC. More...

#include <rvc/dbtable.h>

List of all members.

Public Types

enum  FUNCTION {
  FUNCTION_None = 0x00000000, FUNCTION_Unique = 0x00000001, FUNCTION_Sorted = 0x00000002, FUNCTION_Equal = 0x00000004,
  FUNCTION_GreaterThan = 0x00000008, FUNCTION_LessThan = 0x00000010, FUNCTION_NotEqual = 0x00000020, FUNCTION_AND = 0x00000040,
  FUNCTION_OR = 0x00000080, FUNCTION_NoClear = 0x00000100, FUNCTION_ForUpdate = 0x00000200
}
enum  INDEXFLAG { INDEXFLAG_None = 0, INDEXFLAG_IndexOffset = 0x00000001, INDEXFLAG_LeaveRunBit = 0x00000002 }

Public Member Functions

 CURSOR (const RVC::DBTABLE &table)
 ~CURSOR ()
ERRVALUE GetBookmark (BOOKMARK &Bookmark) const
ERRVALUE GetIndex (INT32 &Index, INDEXFLAG flags=INDEXFLAG_None) const
DEPRECATED INT32 GetRecordNum () const
bool IsDone () const
bool IsValid () const
int Next ()
bool operator== (const CURSOR &rhs) const
ERRVALUE Rewind ()
INT32 SeekValue (INT32 FieldNum, const MISTRING &value)
INT32 SeekValue (INT32 FieldNum, const void *vbuf, const FIELDINFO *finfo, bool bSingleField=true)
ERRVALUE SetFunction (INT32 FieldNum, FUNCTION Function)
ERRVALUE SetSort (const SIMPLE_ARRAY< INT32 > &FieldList)

Detailed Description

Class to represent database table cursors used in ODBC.


Member Enumeration Documentation

Enumerator:
FUNCTION_None 
FUNCTION_Unique 
FUNCTION_Sorted 
FUNCTION_Equal 
FUNCTION_GreaterThan 
FUNCTION_LessThan 
FUNCTION_NotEqual 
FUNCTION_AND 
FUNCTION_OR 
FUNCTION_NoClear 

Add to previous function.

FUNCTION_ForUpdate 

To allow writes.

Flags for GetIndex.

Enumerator:
INDEXFLAG_None 
INDEXFLAG_IndexOffset 
INDEXFLAG_LeaveRunBit 

Constructor & Destructor Documentation

RVC::DBTABLE::CURSOR::CURSOR ( const RVC::DBTABLE table  )  [explicit]

Default constructor.

RVC::DBTABLE::CURSOR::~CURSOR (  ) 

Destructor.


Member Function Documentation

ERRVALUE RVC::DBTABLE::CURSOR::GetBookmark ( BOOKMARK Bookmark  )  const

Get the current bookmark.

ERRVALUE RVC::DBTABLE::CURSOR::GetIndex ( INT32 Index,
INDEXFLAG  flags = INDEXFLAG_None 
) const

Get the offset into the rowset Note that INDEXFLAG_LeaveRunBit is meaningless for ODBC and OLE DB.

DEPRECATED INT32 RVC::DBTABLE::CURSOR::GetRecordNum (  )  const

Get the current record number or < 0 if error.

Deprecated:
Use GetBookmark instead. This method will NOT work for ODBC or RDBMS.
bool RVC::DBTABLE::CURSOR::IsDone (  )  const [inline]

Is the cursor "done" Note: this will return true right after a Rewind() until you call Next().

bool RVC::DBTABLE::CURSOR::IsValid (  )  const

Is the cursor valid.

Returns:
True for a valid cursor
int RVC::DBTABLE::CURSOR::Next (  ) 

Increment cursor.

Returns:
> 0 if still valid, 0 if not, < 0 error
 RVC::DBTABLE::CURSOR Cursor(Table);
 while (Cursor.Next() > 0) {
    ...
    }
bool RVC::DBTABLE::CURSOR::operator== ( const CURSOR rhs  )  const

Equality.

ERRVALUE RVC::DBTABLE::CURSOR::Rewind (  ) 

Reset cursor to the beginning Note: After calling Rewind, the cursor is actually pointing one record before the beginning.

It is intended that you should use it like this...

 RVC::DBTABLE::CURSOR Cursor(Table);
   ...
 Cursor.Rewind(); // only necessary if you've already used Cursor
 while (Cursor.Next() > 0) {
    ...
    }
INT32 RVC::DBTABLE::CURSOR::SeekValue ( INT32  FieldNum,
const MISTRING value 
)

Seek to a spot in the table.

Returns:
1 if value found, 0 if not found but seek to closest match This method will NOT work for ODBC or RDBMS.
INT32 RVC::DBTABLE::CURSOR::SeekValue ( INT32  FieldNum,
const void *  vbuf,
const FIELDINFO finfo,
bool  bSingleField = true 
)

Seek to a spot in the table.

Returns:
1 if value found, 0 if not found but seek to closest match This method will NOT work for ODBC or RDBMS.
ERRVALUE RVC::DBTABLE::CURSOR::SetFunction ( INT32  FieldNum,
FUNCTION  Function 
)

Set cursor behavior Note: the only functions that will work with this method are Sort and Unique.

Sort has its own function which is better.

ERRVALUE RVC::DBTABLE::CURSOR::SetSort ( const SIMPLE_ARRAY< INT32 > &  FieldList  ) 

Set cursor behavior.

Parameters:
FieldList fields to sort on

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

Generated on Sun Oct 7 21:37:01 2012 for TNTsdk 2012 by  doxygen 1.6.1