Implementing onFetch()
To fetch data, implement the onFetch() method. This discussion assumes the use of RWDBBinaryCallback. The other two callback classes have slightly different signatures.
 
virtual bool onFetch(size_t rownum, const void* theData,
size_t byteLength, RWDBNullIndicator ni, bool& lastPiece);
The parameters are:
rownum
The row in the current rowset this data is from (0-based indexing)

This parameter is always zero if the database vendor does not support array binding, and therefore operates on just one row at a time. If your vendor does support array binding, you can use multirow operations by specifying a value greater than one for the entries parameter in the constructor for the callback class you are using. The entries value determines the size of the rowsets returned by each call to the database.

For example, if the result of a SELECT statement consists of 10 rows of data, the size of the result set is 10. If the callbacks are created with an entries value of 3, the first rowset will have 3 rows from the result set, 0 - 2, the second rowset will have rows 3 - 5, the third rowset will have rows 6 - 8 and the last rowset just a single row, row 9. However, rownum indicates the row in the current rowset, not the row in the result set. So, for example, when the first rowset is returned, rownum can have a value from 0 to 2. When the second rowset is returned, with rows 3 - 5, rownum will still have a value from 0 to 2, because it indicates the row in the current rowset, not the row as it was in the complete result set.
theData
A pointer to an array containing the piece of data currently being processed

Note: if the ni parameter is true, theData is undefined.
byteLength
The length in bytes of the data in theData

Note: if the ni parameter is true, theData is undefined.
ni
A boolean value indicating whether the value returned by the call to onFetch() is null

This value is true for null values, otherwise false.
lastPiece
A boolean value indicating whether this is the last piece of data

This parameter is true if this is last piece of data for the current row, otherwise false. If there might be reason to stop processing a row in the result set before all the data has been fetched, this parameter can be set to true to discontinue processing for the current row and move onto the next one.