Skip to main content
The LibSQLIterator class provides an interface for iterating over query results in a LibSQLResult object. It implements the PHP Iterator interface, allowing it to be used in foreach loops for sequential access to query rows.

Methods

current

Gets the current row in the result set.

Parameters

None.

Returns

  • array - The current row, as an associative or numerical array, depending on the fetch mode.

Example


key

Gets the key of the current row.

Parameters

None.

Returns

  • int - The zero-based index of the current row in the result set.

Example


next

Moves the internal pointer to the next row in the result set.

Parameters

None.

Returns

  • void

Example


rewind

Resets the internal pointer to the first row in the result set.

Parameters

None.

Returns

  • void

Example


valid

Checks if the current pointer position is valid (i.e., if there is a row at the current position).

Parameters

None.

Returns

  • bool - true if the pointer is valid; false otherwise.

Example


Usage Example