Skip Headers

Oracle® Objects for OLE C++ Class Library Developer's Guide
10g Release 1 (10.1)

Part Number B10119-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Master Index
Master Index
Go to Feedback page
Feedback

MoveNext Method

Applies To

OBinder

ODynaset

Description

This method changes the current record to be the next record in the dynaset's result set.

Usage

oresult OBinder::MoveNext(void)

oresult ODynaset::MoveNext(oboolean gopast = TRUE)

Arguments

gopast
TRUE allows the current record mark to go past the last record in the set.
Remarks

This method sets the current record of the dynaset (for OBinder, the dynaset being managed by the OBinder object) to be the next record in the result set. It is the most common routine used to navigate through the records of the database.

It is possible to MoveNext past the last record in the dynaset. The current record then becomes invalid and the IsEOF method returns TRUE. This is the default behavior. If you want to restrict dynaset navigation to valid records, pass in a gopast argument of FALSE. OBinder::MoveNext always restricts navigation to valid records.

Note: IsValidRecord is more reliable than IsLast for checking when the fetch limit is a multiple of the total number of records in the table.

Execution of this method sends OADVISE_MOVE_NEXT messages to all attached advisories. One of the advisories could cancel the move, which would result in an OFAILURE return.

If the dynaset is being managed by an OBinder object, this method causes PreMove and PostMove triggers to be called.

Return Value

An oresult indicating whether the operation succeeded (OSUCCESS) or not (OFAILURE).

Example

This example deletes all the managers.

// open a database

ODatabase odb("ExampleDB", "scott", "tiger");

// open a dynaset

ODynaset empdyn(odb, "select * from emp");

// get an OField object for looking at the job field

OField job = empdyn.GetField("job");

// look through all the employees

while (!empdyn.IsEOF())

{

if (0 == strcmp((const char *) job, "MANAGER"))

{ // we found a manager - delete that employee

empdyn.DeleteRecord();

}

// go to next record (gets us to valid record)

// or past EOF if there are no more records

empdyn.MoveNext();

}