Fetch method for LCConnection
The Fetch method retrieves rows from the current result set.
Actual fetching is done in helper functions fetchRow
,
fetchServer
, fetchModule
and so on. The helper
function is selected based on whether one is working on a real result set or a catalog
result set. The method name is Fetch.
The function requires that a result set was previously produced by Execute, Select, Call, or Catalog. The result set data is type-checked against and then moved into the supplied DestFieldlist. Fields with the flag LCFIELDF_NO_FETCH set are not fetched.
The property MAP_NAME indicates whether to map fields in DestFieldlist and the result set by name or position. Handling of both mapping and field flags is implicitly done by calling LCFieldlistMerge with the result set field names as NameFieldlist, DestFieldlist as DataFieldlist, and MergeFlags LCMERGEF_NAME_LOSS, LCMERGEF_FETCH, and optionally (depending on the MAP_NAME property) LCMERGEF_MAP_NAME.
For non-scrollable result sets, each record in the result set is fetched exactly once and only in a forward direction. LCFAIL_END_OF_DATA should be returned when the last call to Fetch retrieved the last record in the result set. If at least one record was fetched but the end of the result set was reached before fetching RecordCount records, LCSUCCESS is returned.
For scrollable result sets produced by Execute or Select with the property LCTOKEN_SCROLLABLE set, backwards fetching is performed starting with the record before the most recently fetched record and moving backwards in the result set.