Page 14 out of 26 total pages


QbDbIteratorClass


QbDbIteratorClass is derived from the QbBaseClass. It is designed to define the interface for a database iterator. It has three virtual methods: More, Next, and Reset (these methods are similar to the OQS iterator functions). The More method returns true if there is more data. The Next method returns the next record. The Reset method resets the iterator so that a future call to Next returns the first record instead of the next one.

This class contains the public enumerated variable nextEnum which indicates the desired cursor position:

QbDbIteratorClass method

This is the constructor for the class.

Syntax

QbDbIteratorClass( void )

Parameters

None

~QbDbIteratorClass method

This is the destructor for the class.

Syntax

virtual ~QbDbIteratorClass( void )

Parameters

None

More method

This method returns 1 if there is more data, and 0 if this is the last item in the database.

Syntax

virtual int More( void )

Parameters

Input

None

Output

An integer value: 0 indicates the last item in the database; 1 indicates that there is more data

Next method

This method advances to the next record in the database (or to the first record following the Reset method). This method copies key and value pairs of the record to key and value objects of QbDatumClass.

Syntax

virtual int Next( QbDatumClass &key, QbDatumClass &value, nextEnum 
nextFlag = NextKey )

Parameters

Input

Output

An integer value: 0 indicates success; -1 indicates failure

Reset method

This method resets the iterator so that the first call to the Next method returns the first value in the database.

Syntax

virtual int Reset( void )

Parameters

Input

None

Output

An integer value: 0 indicates success; -1 indicates failure





Page 14 out of 26 total pages


xzhu@almaden.ibm.com or tedl@almaden.ibm.com
Copyright © 1998, IBM Corporation. All rights reserved.