sesam_fetch_array() is an alternative version of sesam_fetch_row(). Instead of storing the data in the numeric indices of the result array, it stores the data in associative indices, using the field names as keys.
sesam_fetch_array() fetches one row of data from the result associated with the specified result identifier. The row is returned as an associative array. Each result column is stored with an associative index equal to its column (aka. field) name. The column names are converted to lower case.
Columns without a field name (e.g., results of arithmetic operations) and empty fields are not stored in the array. Also, if two or more columns of the result have the same column names, the later column will take precedence. In this situation, either call sesam_fetch_row() or make an alias for the column.
A special handling allows fetching "multiple field" columns (which would otherwise all have the same column names). For each column of a "multiple field", the index name is constructed by appending the string "(n)" where n is the sub-index of the multiple field column, ranging from 1 to its declared repetition factor. The indices are NOT zero based, in order to match the nomenclature used in the respective query syntax. For a column declared as:
Subsequent calls to sesam_fetch_array() would return the next (or prior, or n'th next/prior, depending on the scroll attributes) row in the result set, or FALSE if there are no more rows.
A valid result id returned by sesam_query().
whence is an optional
parameter for a fetch operation on "scrollable" cursors, which
can be set to the following predefined constants:
Table 1. Valid values for
|0||SESAM_SEEK_NEXT||read sequentially (after fetch, the internal default is set to SESAM_SEEK_NEXT)|
|1||SESAM_SEEK_PRIOR||read sequentially backwards (after fetch, the internal default is set to SESAM_SEEK_PRIOR)|
|2||SESAM_SEEK_FIRST||rewind to first row (after fetch, the default is set to SESAM_SEEK_NEXT)|
|3||SESAM_SEEK_LAST||seek to last row (after fetch, the default is set to SESAM_SEEK_PRIOR)|
seek to absolute row number given as
seek relative to current scroll position, where
When using "scrollable" cursors, the cursor can be freely positioned
on the result set. If the
whence parameter is
omitted, the global default values for the scrolling type (initialized
to: SESAM_SEEK_NEXT, and settable by
sesam_seek_row()) are used. If
whence is supplied, its value replaces the
Only evaluated (and required) if
either SESAM_SEEK_RELATIVE or
SESAM_SEEK_ABSOLUTE. This parameter is only
valid for "scrollable" cursors.
Returns an array that corresponds to the fetched row, or FALSE if there are no more rows.
Example 1. SESAM fetch array