Symbian
Symbian Developer Library

SYMBIAN OS V9.4

Feedback

[Index] [Previous] [Next]

#include <D32DBMS.H>
Link against: edbms.lib

Class RDbTable

class RDbTable : public RDbRowSet;

Description

Provides access to table data as a rowset, allowing manipulation of a named table in the database. Additionally, a named index can be used to order the rowset, and to provide fast key-based row retrieval from the table.

There are no special rules to consider when deriving from this class.

Derivation

Members

Defined in RDbTable:

Inherited from RDbRowSet:


Member functions


Open(RDbDatabase &,const TDesC &,TAccess)

Capability: Security policy note: For a secure shared database, the caller must satisfy either the read or the write access policy for the table.

IMPORT_C TInt Open(RDbDatabase &aDatabase, const TDesC &aName, TAccess anAccess=EUpdatable);

Description

Opens the named table object on a database with the specified access.

If successful, the rowset is positioned to the beginning.

Parameters

RDbDatabase &aDatabase

The database on which to open the table.

const TDesC16 &aName

The name of the table to open.

RDbRowSet::TAccess anAccess

The access specification for the rowset, the default is updatable access.

Return value

TInt

KErrNone, if successful, otherwise one of the system-wide error codes. Specifically:KErrNotFound if the table does not exist in the KErrAccessDenied if an incremental operation is in progress. This can also be one of the DBMS database error codes.


SetIndex(const TDesC &)

Capability: Security policy note: For a secure shared database, the caller must satisfy the read access policy for the table.

inline TInt SetIndex(const TDesC &anIndex);

Description

Sets the specified index as the active index for this table. The rows will be presented in index order, and this index key will be used for lookup by the RDbTable::SeekL(const TDbSeekKey &,TComparison) function.

If successful, the rowset is reset to the beginning.

Parameters

const TDesC16 &anIndex

The name of the index to activate.

Return value

TInt

KErrNone, if successful, otherwise one of the system-wide error codes. Specifically:KErrWrite if the table was created with insert-only KErrNotFound if the index does not exist on the table. This can also be one of the DBMS database error codes.


SetNoIndex()

Capability: Security policy note: For a secure shared database, the caller must satisfy the read access policy for the table.

inline TInt SetNoIndex();

Description

Sets the ordering to be the underlying ordering of the rows — this will usually provide faster navigation of the rowset.

Return value

TInt

KErrNone, if successful, otherwise one of the system-wide error codes. Specifically:KErrWrite if the table was created with insert-only access. This can also be one of the DBMS database error codes.


SeekL(const TDbSeekKey &,TComparison)

Capability: Security policy note: For a secure shared database, the caller must satisfy the read access policy for the table.

IMPORT_C TBool SeekL(const TDbSeekKey &aKey, TComparison aComparison=EEqualTo);

Description

Finds a row in a table based on a key in the active index.

This function cannot be called while the rowset is currently updating or inserting a row. The currently active index on the table must have a key definition which matches the types in the key value.

Less columns can be added to the key than are present in the index definition: the keys will only be compared up to the columns present further columns in the index are not considered.

If successful the cursor is positioned to the row which was found, otherwise the cursor is left on an invalid row.

The underlying Store database can leave with KErrWrite, if the table was created with insert-only access.

The function can also leave with one of the DBMS database error codes.

Parameters

const TDbSeekKey &aKey

The key value to lookup in the index.

RDbTable::TComparison aComparison

The comparison operation for the lookup, the default is to look for an exact match (EEqualTo).

Return value

TBool

ETrue if a row which compares correctly with the key exists, EFalse if not.

[Top]


Member enumerations


Enum TComparison

TComparison

Description

Database table seek comparison types.

ELessThan

Retrieve the last row which is strictly less than the key value.

ELessEqual

Retrieve the last row which is equal to or less than the key value.

EEqualTo

Retrieve the first row which is equal to the key value.

EGreaterEqual

Retrieve the first row which is equal to or greater than the key value.

EGreaterThan

Retrieve the first row which is strictly greater than the key value.