The Cursor class provides an iterator object for scrolling through the individual rows of a result set in a QueryResult.
Normally a Cursor is instantiated by calling QueryResult method records()
, then each row of the result set is accessed as a Record instance through the Cursor method next()
as illustrated in the following code snippet:
int showResults( PreparedStatement stmt ) { QueryResult result( engine.executePreparedQuery(stmt) ); ... Cursor* cursor = result->records(); while ( cursor->hasNext() ) { Record* rec = cursor->next(); _AccountBalance ab; result->extract( rec, &ab, sizeof(ab) ); printf("\t\tAccountBalance: id=%u, value=%u\n", ab.id, ab.value ); } }