RDbRowSet Class Reference

class RDbRowSet

An abstract base class that provides functionality which is shared between SQL view objects and Table objects. This functionality includes most of the cursor navigation, row retrieval and update behaviour of rowsets.

Rowset objects do not provide the data for the rowset on which they operate. It is the responsibility of the derived classes RDbView and RDbTable to specify the data source.

This class is not intended for user derivation.

Public Member Functions
IMPORT_C TBool AtEnd ()
IMPORT_C TBool AtRow ()
IMPORT_C TDbBookmark Bookmark ()
IMPORT_C void Close ()
IMPORT_C TDbCol ColDef ( TDbColNo )
IMPORT_C TPtrC ColDes ( TDbColNo )
IMPORT_C TPtrC16 ColDes16 ( TDbColNo )
IMPORT_C TPtrC8 ColDes8 ( TDbColNo )
IMPORT_C TInt32 ColInt32 ( TDbColNo )
IMPORT_C TInt64 ColInt64 ( TDbColNo )
IMPORT_C TInt8 ColInt8 ( TDbColNo )
IMPORT_C TInt ColLength ( TDbColNo )
IMPORT_C TReal64 ColReal64 ( TDbColNo )
IMPORT_C CDbColSet * ColSetL ()
IMPORT_C TInt ColSize ( TDbColNo )
IMPORT_C TTime ColTime ( TDbColNo )
IMPORT_C TDbColType ColType ( TDbColNo )
TUint ColUint ( TDbColNo )
IMPORT_C TUint32 ColUint32 ( TDbColNo )
IMPORT_C TUint8 ColUint8 ( TDbColNo )
IMPORT_C TInt CountL ( TAccuracy )
IMPORT_C void DeleteL ()
void EndL ()
IMPORT_C TInt FindL ( TDirection , TDbQuery )
TBool FirstL ()
IMPORT_C void GetL ()
IMPORT_C TBool GotoL ( TPosition )
IMPORT_C void GotoL (const TDbBookmark &)
IMPORT_C void InsertL ()
TBool IsColNull ( TDbColNo )
IMPORT_C TBool IsEmptyL ()
TBool LastL ()
IMPORT_C TBool MatchL (const RDbRowConstraint &)
TBool NextL ()
TBool PreviousL ()
IMPORT_C void PutL ()
IMPORT_C void Reset ()
void SetColL ( TDbColNo , TInt )
IMPORT_C void SetColL ( TDbColNo , TInt32 )
IMPORT_C void SetColL ( TDbColNo , TInt64 )
void SetColL ( TDbColNo , TUint )
IMPORT_C void SetColL ( TDbColNo , TUint32 )
IMPORT_C void SetColL ( TDbColNo , TReal32 )
IMPORT_C void SetColL ( TDbColNo , TReal64 )
IMPORT_C void SetColL ( TDbColNo , TTime )
IMPORT_C void SetColL ( TDbColNo , const TDesC8 &)
IMPORT_C void SetColL ( TDbColNo , const TDesC16 &)
IMPORT_C void SetColNullL ( TDbColNo )
IMPORT_C void UpdateL ()
Private Member Functions
MStreamBuf * ColSinkL ( TDbColNo )
MStreamBuf * ColSourceL ( TDbColNo )
TDbColumn Column ( TDbColNo , TDbColType )
TDbColumnC ColumnC ( TDbColNo , TDbColType )
Public Member Enumerations
enum TAccess { EUpdatable , EReadOnly , EInsertOnly }
enum TAccuracy { EEnsure , EQuick }
enum TDirection { EForwards , EBackwards }
enum TPosition {
EFirst , ENext , EPrevious , ELast , EBeginning , EEnd
}
Protected Attributes
RDbHandle < CDbCursor > iCursor

Member Functions Documentation

AtEnd()

IMPORT_C TBool AtEnd ( ) const

Tests whether the cursor is at the end of the rowset.

AtRow()

IMPORT_C TBool AtRow ( ) const

Tests whether the cursor is on a row.

One of the following is true:

the rowset is currently updating a row

the rowset is currently inserting a row

GetL() can be called to retrieve the row

Bookmark()

IMPORT_C TDbBookmark Bookmark ( ) const

Gets the bookmark for the current cursor position. Bookmarks cannot be extracted when the rowset is updating or inserting a row.

The Store Database implementation allows bookmarks to be extracted for any cursor position including the beginning and end.

capability
Note For a secure shared database, the caller must satisfy the read access policy for the table.

Close()

IMPORT_C void Close ( )

Closes the rowset and releases any owned resources. It is safe to close a rowset object which is not open.

ColDef(TDbColNo)

IMPORT_C TDbCol ColDef ( TDbColNo aCol ) const

Parameters

TDbColNo aCol

ColDes(TDbColNo)

IMPORT_C TPtrC ColDes ( TDbColNo aCol ) const

Parameters

TDbColNo aCol

ColDes16(TDbColNo)

IMPORT_C TPtrC16 ColDes16 ( TDbColNo aCol ) const

Parameters

TDbColNo aCol

ColDes8(TDbColNo)

IMPORT_C TPtrC8 ColDes8 ( TDbColNo aCol ) const

Parameters

TDbColNo aCol

ColInt32(TDbColNo)

IMPORT_C TInt32 ColInt32 ( TDbColNo aCol ) const

Extracts a TInt32, TInt16 or TInt8 column value.

Parameters

TDbColNo aCol The column ordinal of the column to extract.

ColInt64(TDbColNo)

IMPORT_C TInt64 ColInt64 ( TDbColNo aCol ) const

Extracts a TInt64 column value.

Parameters

TDbColNo aCol The column ordinal of the column to extract.

ColInt8(TDbColNo)

IMPORT_C TInt8 ColInt8 ( TDbColNo aCol ) const

Extracts a TInt8 column value.

Parameters

TDbColNo aCol The column ordinal of the column to extract.

ColLength(TDbColNo)

IMPORT_C TInt ColLength ( TDbColNo aCol ) const

Parameters

TDbColNo aCol

ColReal64(TDbColNo)

IMPORT_C TReal64 ColReal64 ( TDbColNo aCol ) const

Extracts a TReal64 column value.

Parameters

TDbColNo aCol The column ordinal of the column to extract.

ColSetL()

IMPORT_C CDbColSet * ColSetL ( ) const

Returns the entire column set for the rowset. This can be used to discover column ordinals for named columns in this rowset.

The function leaves with KErrNoMemory if there is not enough memory to carry out the operation.

ColSinkL(TDbColNo)

MStreamBuf * ColSinkL ( TDbColNo aCol ) [private, inline]

Parameters

TDbColNo aCol

ColSize(TDbColNo)

IMPORT_C TInt ColSize ( TDbColNo aCol ) const

Parameters

TDbColNo aCol

ColSourceL(TDbColNo)

MStreamBuf * ColSourceL ( TDbColNo aCol ) const [private, inline]

Parameters

TDbColNo aCol

ColTime(TDbColNo)

IMPORT_C TTime ColTime ( TDbColNo aCol ) const

Extracts a TTime column value.

Parameters

TDbColNo aCol The column ordinal of the column to extract.

ColType(TDbColNo)

IMPORT_C TDbColType ColType ( TDbColNo aCol ) const

Returns the type of a column in the rowset.

Parameters

TDbColNo aCol The column ordinal for which the column type is required. Column ordinals range from 1 to ColCount().

ColUint(TDbColNo)

TUint ColUint ( TDbColNo aCol ) const [inline]

Parameters

TDbColNo aCol

ColUint32(TDbColNo)

IMPORT_C TUint32 ColUint32 ( TDbColNo aCol ) const

Extracts a Uint32, Uint16, Uint8 or Bit column value.

Parameters

TDbColNo aCol The column ordinal of the column to extract.

ColUint8(TDbColNo)

IMPORT_C TUint8 ColUint8 ( TDbColNo aCol ) const

Extracts a Uint8 or Bit column value.

Parameters

TDbColNo aCol The column ordinal of the column to extract.

Column(TDbColNo, TDbColType)

TDbColumn Column ( TDbColNo aCol,
TDbColType aType
) [private]

Parameters

TDbColNo aCol
TDbColType aType

ColumnC(TDbColNo, TDbColType)

TDbColumnC ColumnC ( TDbColNo aCol,
TDbColType aType
) const [private]

Parameters

TDbColNo aCol
TDbColType aType

CountL(TAccuracy)

IMPORT_C TInt CountL ( TAccuracy anAccuracy = EEnsure ) const

Returns the number of rows available in a rowset.

This can take some time to complete, and a parameter can be passed to request a quick but not always thorough count of the rows.

For SQL views, the value returned depends on the evaluation window being used by the view. If there is an evaluation window this function will always return the number of rows available in the window, not the total number which could be returned by the query.

capability
Note For a secure shared database, the caller must satisfy either the read or the write access policy for the table.

Parameters

TAccuracy anAccuracy = EEnsure This specifies whether to ensure that an accurate count is returned, or to give up if this value is not readily available. The default is to ensure an accurate count.

DeleteL()

IMPORT_C void DeleteL ( )

Deletes the current row in a rowset. The rowset must not currently be updating or inserting the row.

The rowset cursor is left positioned at the "hole" left by the deletion of the current row. Navigation to the next or previous row will have the same effect as if this row had not been deleted. Once the cursor has been moved from the "hole" it will disappear from the rowset.

If the client has not begun a transaction, this function will use an automatic transaction to update the rowset.

capability
Note For a secure shared database, the caller must satisfy the write access policy for the table.

EndL()

void EndL ( ) [inline]

Positions the cursor at the end of the rowset.

capability
Note For a secure shared database, the caller must satisfy the read access policy for the table.

FindL(TDirection, TDbQuery)

IMPORT_C TInt FindL ( TDirection aDirection,
TDbQuery aCriteria
)

Parameters

TDirection aDirection
TDbQuery aCriteria

FirstL()

TBool FirstL ( ) [inline]

Positions the cursor on the first row in the rowset. If there are no rows, the cursor is positioned at the end.

capability
Note For a secure shared database, the caller must satisfy the read access policy for the table.

GetL()

IMPORT_C void GetL ( )

Gets the current row data for access using the column extractor functions. The cursor must be positioned at a valid row.

capability
Note For a secure shared database, the caller must satisfy the read access policy for the table.

GotoL(TPosition)

IMPORT_C TBool GotoL ( TPosition aPosition )

Moves the cursor to a specified position.

This is invoked by Beginning(), End(), FirstL() , LastL() , NextL() and PreviousL() to navigate the cursor. See those functions for descriptions of how the cursor behaves given different position specifications.

capability
Note For a secure shared database, the caller must satisfy the read access policy for the table.

Parameters

TPosition aPosition Specifies the position to move the cursor to.

GotoL(const TDbBookmark &)

IMPORT_C void GotoL ( const TDbBookmark & aMark )

Goes to a previously bookmarked position in a rowset.

The Store Database implements bookmarks which are valid in any rowset based on the same table or generated by the same query, and which persist across transaction boundaries.

capability
Note For a secure shared database, the caller must satisfy the read access policy for the table.

Parameters

const TDbBookmark & aMark The bookmark to return to. This should have been returned by a previous call to Bookmark() on this or an equivalent rowset object.

InsertL()

IMPORT_C void InsertL ( )

Inserts a new row into the rowset. All auto-increment columns will be initialised with their new values, all other columns will be initialised to NULL values. If no client-begun transaction is in progress, this function begins an automatic transaction, which is committed by PutL() .

After the column values have been set using the SetColL() functions, the row can be written to the database using PutL() .

capability
Note For a secure shared database, the caller must satisfy the write access policy for the table.

IsColNull(TDbColNo)

TBool IsColNull ( TDbColNo aCol ) const [inline]

Tests whether a column has the NULL value.

Columns which have the NULL value can still be extracted with the correct accessor function, in which case numerical columns will return a 0 (or equivalent) value, and text and binary columns will have a zero length.

Parameters

TDbColNo aCol The column ordinal for the column to test.

IsEmptyL()

IMPORT_C TBool IsEmptyL ( ) const

Tests whether there are any rows in the rowset. This is often faster than testing whether CountL() ==0.

capability
Note For a secure shared database, the caller must satisfy the read access policy for the table.

LastL()

TBool LastL ( ) [inline]

Positions the cursor on the last row in the rowset. If there are no rows, the cursor is positioned at the beginning.

capability
Note For a secure shared database, the caller must satisfy the read access policy for the table.

MatchL(const RDbRowConstraint &)

IMPORT_C TBool MatchL ( const RDbRowConstraint & aConstraint )

Tests whether the current row in the rowset matches a previously compiled row constraint. The rowset must not currently be updating or inserting a row.

capability
Note For a secure shared database, the caller must satisfy the read access policy for the table.

Parameters

const RDbRowConstraint & aConstraint A row constraint object which must have been previously opened on this rowset object.

NextL()

TBool NextL ( ) [inline]

Moves the cursor to the next row in the rowset. If there are no more rows, the cursor is positioned to the end.

If the cursor is at the beginning prior to the function, it is equivalent to FirstL() .

capability
Note For a secure shared database, the caller must satisfy the read access policy for the table.

PreviousL()

TBool PreviousL ( ) [inline]

Moves the cursor to the previous row in the rowset. If there are no more rows, the cursor is positioned to the beginning.

If the cursor is at the end prior to the function, it is equivalent to LastL() .

capability
Note For a secure shared database, the caller must satisfy the read access policy for the table.

PutL()

IMPORT_C void PutL ( )

Reset()

IMPORT_C void Reset ( )

Resets the rowset.

For a Table, this just sets the rowset cursor to the beginning position.

For an SQL view, this discards any evaluated rows and returns the cursor to the beginning. The view then requires reevaluation.

The Store Database implementation requires this function to be called in order to recover an open rowset object after the database has been rolled back. The rowset does not need to be closed in this situation.

If a rowset object requires a reset, then all row functions return or leave with KErrNotReady.

SetColL(TDbColNo, TInt)

void SetColL ( TDbColNo aCol,
TInt aValue
) [inline]

Parameters

TDbColNo aCol
TInt aValue

SetColL(TDbColNo, TInt32)

IMPORT_C void SetColL ( TDbColNo aCol,
TInt32 aValue
)

Parameters

TDbColNo aCol
TInt32 aValue

SetColL(TDbColNo, TInt64)

IMPORT_C void SetColL ( TDbColNo aCol,
TInt64 aValue
)

Parameters

TDbColNo aCol
TInt64 aValue

SetColL(TDbColNo, TUint)

void SetColL ( TDbColNo aCol,
TUint aValue
) [inline]

Parameters

TDbColNo aCol
TUint aValue

SetColL(TDbColNo, TUint32)

IMPORT_C void SetColL ( TDbColNo aCol,
TUint32 aValue
)

Parameters

TDbColNo aCol
TUint32 aValue

SetColL(TDbColNo, TReal32)

IMPORT_C void SetColL ( TDbColNo aCol,
TReal32 aValue
)

Parameters

TDbColNo aCol
TReal32 aValue

SetColL(TDbColNo, TReal64)

IMPORT_C void SetColL ( TDbColNo aCol,
TReal64 aValue
)

Parameters

TDbColNo aCol
TReal64 aValue

SetColL(TDbColNo, TTime)

IMPORT_C void SetColL ( TDbColNo aCol,
TTime aValue
)

Parameters

TDbColNo aCol
TTime aValue

SetColL(TDbColNo, const TDesC8 &)

IMPORT_C void SetColL ( TDbColNo aCol,
const TDesC8 & aValue
)

Parameters

TDbColNo aCol
const TDesC8 & aValue

SetColL(TDbColNo, const TDesC16 &)

IMPORT_C void SetColL ( TDbColNo aCol,
const TDesC16 & aValue
)

Parameters

TDbColNo aCol
const TDesC16 & aValue

SetColNullL(TDbColNo)

IMPORT_C void SetColNullL ( TDbColNo aCol )

Use this function to set the value of a column to NULL.

capability
Note For a secure shared database, the caller must satisfy the write access policy for the table.

Parameters

TDbColNo aCol The column ordinal of the column to set to NULL.

UpdateL()

IMPORT_C void UpdateL ( )

Prepares the current row for update. If no client-begun transaction is in progress, this function begins an automatic transaction, which is committed by PutL() .

After the column values have been modified using the SetColL() functions, the row can be written back to the database using PutL() .

capability
Note For a secure shared database, the caller must satisfy the write access policy for the table.

Member Enumerations Documentation

Enum TAccess

Specifies which operations can be performed on a rowset.

Enumerators

EUpdatable

All operations can be performed on the rowset.

EReadOnly

Row navigation and reading are permitted.

EInsertOnly

Inserting new rows is the only valid operation on the rowset.

Enum TAccuracy

Specifies whether the CountL() function should ensure that it returns the exact value which may be a non-trivial task.

Enumerators

EEnsure

Take the time, if necessary, to return the exact value.

EQuick

Return any immediately available value.

Enum TDirection

Specifies the direction to search through the rowset when using the FindL() function.

Enumerators

EForwards

Search from the current row forwards through the set.

EBackwards

Search from the current row backwards through the set.

Enum TPosition

Specifies where the rowset should navigate to in the GotoL() function. Their use is encapsulated by the respective member functions FirstL() , NextL() etc.

Enumerators

EFirst

Move to the first row in the rowset.

ENext

Move to the next row in the rowset.

EPrevious

Move to the previous row in the rowset.

ELast

Move to the last row in the rowset.

EBeginning

Move to the position before the first row in the rowset.

EEnd

Move to the position after the last row in the rowset.

Member Data Documentation

RDbHandle< CDbCursor > iCursor

RDbHandle < CDbCursor > iCursor [protected]