Location:
d32dbms.h
Link against: edbms.lib
CDbKey
Support
Supported from 5.0
Description
Represents the definition of an index. The key may be unique or
primary, it can specify the sort of comparison which is made for Text columns,
and it has a list of columns which make up the key. The class is used to
construct and interrogate index keys.
This class is not intended for user
derivation.
Derivation
CBase | Base class for all classes to be instantiated on the heap |
CDbKey | Represents the definition of an index |
|
Defined in CDbKey
:
AddL()
, CDbKey()
, Clear()
, Comparison()
, Count()
, IsPrimary()
, IsUnique()
, MakeUnique()
, NewL()
, NewLC()
, Remove()
, SetComparison()
, operator[]()
, ~CDbKey()
Inherited from CBase
:
operator new()
CDbKey();
Description
Constructs an empty key. It is initialised to non-unique,
non-primary and normal text comparison.
static CDbKey* NewL();
Description
Constructs and returns a pointer to a new empty
key.
Return value
CDbKey* |
A pointer to the key object. |
|
Leave codes
|
The function leaves with KErrNoMemory if there is
not enough memory to perform this operation. |
|
static CDbKey* NewLC();
Description
Constructs and returns a new empty key and return a pointer to
it — leaving a pointer to the key object on the cleanup stack.
This allows the key object and allocated resources to be cleaned up if a
subsequent leave occurs.
Return value
CDbKey* |
A pointer to the key object. |
|
Leave codes
|
The function leaves with KErrNoMemory if there is
not enough memory to perform this operation. |
|
~CDbKey();
Description
Frees resources owned by the object.
void Clear();
Description
Resets the key to its initial empty state.
CDbKey& AddL(const TDbKeyCol& aKeyCol);
Description
Adds a key column to the end of the key.
Parameters
const TDbKeyCol& aKeyCol |
The key column to add to the key. |
|
Return value
CDbKey& |
A reference to this object. |
|
Leave codes
|
The function leaves with KErrNoMemory if there is not
enough memory to perform this operation. |
|
void Remove(const TDesC& aColName);
Description
Removes the named column from the key.
Parameters
const TDesC& aColName |
The name of the column to remove from the key. |
|
TInt Count() const;
Description
Returns the number of key columns in the key.
Return value
TInt |
The number of key columns in the key. |
|
const TDbKeyCol& operator[](TInt aCol) const;
Description
Returns a key column by its position in the key.
Parameters
TInt aCol |
The position of the column in the key. These are numbered from
0 to Count()-1 . |
|
Return value
TDbKeyCol& |
The key column requested. |
|
void MakeUnique();
Description
Makes the key unique. This ensures that every key value in the index is
distinct from every other.
void SetComparison(TDbTextComparison aComparison);
Description
Sets the way in which Text columns are compared for the key. All Text
columns in the key are compared in the same way.
Parameters
TDbTextComparison aComparison |
The comparison type to use. |
|
TDbTextComparison Comparison() const;
Description
Returns the method used to compare Text columns in this
key.
Return value
TDbTextComparison |
The comparison type used for the key. |
|
TBool IsPrimary() const;
Description
Tests whether the key is the primary key.
Return value
TBool |
True, if the key is unique; false, otherwise. |
|
TBool IsUnique() const;
Description
Tests whether the key is unique.
Return value
TBool |
True, if the key is unique; false, otherwise. |
|