Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



Location: d32dbms.h
Link against: edbms.lib

Class CDbColSet

CDbColSet

Support

Supported from 5.0

Description

Manages a set of column definitions which describe a table or rowset structure. Column definitions can be added and removed. The set can be iterated over, and ordinals for a column can be looked up.

The class is not intended for user derivation.

Derivation

CBaseBase class for all classes to be instantiated on the heap
CDbColSetManages a set of column definitions which describe a table or rowset structure

Defined in CDbColSet:
AddL(), CDbColSet(), Clear(), Col(), ColNo(), Count(), NewL(), NewLC(), Remove(), operator[](), ~CDbColSet()

Inherited from CBase:
operator new()


Construction and destruction


NewL()

static CDbColSet* NewL();

Description

Constructs a new empty column set and returns a pointer to it.

Return value

CDbColSet*

A pointer to the column set object.

Leave codes

 

Leaves with KErrNoMemory if there is not enough memory to perform this operation.


NewLC()

static CDbColSet* NewLC();

Description

Constructs a new empty column set and returns a pointer to it — placing the pointer onto the cleanup stack. This allows the column set object and allocated resources to be cleaned up if a subsequent leave occurs.

Return value

CDbColSet*

A pointer to the column set object.

Leave codes

 

Leaves with KErrNoMemory if there is not enough memory to perform this operation.


CDbColSet()

CDbColSet();

Description

Constructs an empty column set.


~CDbColSet()

~CDbColSet();

Description

Frees resources owned by the object.

[Top]


Adding and removing columns


AddL()

CDbColSet& AddL(const TDbCol& aCol);

Description

Adds a column to the column set.

Parameters

const TDbCol& aCol

The column to add to the set.

Return value

CDbColSet&

A reference to this object.

Leave codes

 

This function leaves with KErrNoMemory if there is not enough memory to perform this operation.


Remove()

void Remove(const TDesC& aColName);

Description

Removes the named column from the set.

Parameters

const TDesC& aColName

The name of the column to remove from the set.


Clear()

void Clear();

Description

Removes all of the columns from the column set.

[Top]


Enumerating the columns


Count()

TInt Count() const;

Description

Returns the number of column definitions in the set.

Note that using a TDbColSetIter is another way to iterate through the contents of a CDbColSet.

Return value

TInt

The number of columns in the columns set.


operator[]()

const TDbCol& operator[](TDbColNo aCol) const;

Description

Returns a column definition by its ordinal number in the set.

Note that using a TDbColSetIter is another way to iterate through the contents of a CDbColSet.

Parameters

TDbColNo aCol

The ordinal number of the column in the set. Columns in a column set are numbered from 1 to Count(), unlike EPOC array classes. Ordinal 0 is reserved to represent the invalid column number KDbNullColNo.

Return value

TDbCol&

The column definition requested.

[Top]


Looking up columns


Col()

const TDbCol* Col(const TDesC& aColName) const;

Description

Returns a named column definition in the set. If such a column does not exist in the set NULL is returned.

Parameters

const TDesC& aColName

The name of the column to find.

Return value

TDbCol*

A pointer to the column definition found, or NULL.


ColNo()

TDbColNo ColNo(const TDesC& aColName) const;

Description

Returns the ordinal for a particular column name in this column set. If such a column does not exist in the set the special ordinal KDbNullColNo is returned.

This function is particularly important when accessing data through a rowset. If the set of columns to be returned by a rowset is not explicitly specified, no assumptions should be made about the ordering of the columns returned. In such a case, in order to access the column data a column ordinal is required, and this can be obtained by using this function on the column set returned by RDbRowSet::ColSetL().

Parameters

const TDesC& aColName

The name of the column to find.

Return value

TDbColNo

The ordinal number of the column.