Symbian
Symbian OS Library

SYMBIAN OS V9.3

[Index] [Spacer] [Previous] [Next]



Location: 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:
EEqualTo, EGreaterEqual, EGreaterThan, ELessEqual, ELessThan, Open(), SeekL(), SetIndex(), SetNoIndex(), TComparison

Inherited from RDbRowSet:
AtBeginning(), AtEnd(), AtRow(), BeginningL(), Bookmark(), Cancel(), Close(), ColCount(), ColDef(), ColDes(), ColDes16(), ColDes8(), ColInt(), ColInt16(), ColInt32(), ColInt64(), ColInt8(), ColLength(), ColReal(), ColReal32(), ColReal64(), ColSetL(), ColSize(), ColTime(), ColType(), ColUint(), ColUint16(), ColUint32(), ColUint8(), CountL(), DeleteL(), EBackwards, EBeginning, EEnd, EEnsure, EFirst, EForwards, EInsertOnly, ELast, ENext, EPrevious, EQuick, EReadOnly, EUpdatable, EndL(), FindL(), FirstL(), GetL(), GotoL(), InsertCopyL(), InsertL(), IsColNull(), IsEmptyL(), LastL(), MatchL(), NextL(), PreviousL(), PutL(), Reset(), SetColL(), SetColNullL(), TAccess, TAccuracy, TDirection, TPosition, UpdateL(), iCursor


Member functions


Open()

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 TDesC &aName

The name of the table to open.

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 database::KErrAccessDenied if an incremental operation is in progress. This can also be one of the DBMS database error codes.


SetIndex()

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 SeekL() function.

If successful, the rowset is reset to the beginning.

Parameters

const TDesC &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 access::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()

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.

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.