Fetch response
Success response to op_fetch (see [wireprotocol-statements-fetch]) and op_fetch_scroll (not yet documented).
Int32—p_operation-
Operation code
If operation equals op_fetch_response — 66:
Int32—p_sqldata_status-
Status
-
0— success -
100— end of cursor
-
Int32—p_sqldata_messages-
Count of rows following response (in practice, only
1or0)A value of
0indicates end-of-batch (fetch complete).Together with status100, it also means end-of-cursor, otherwise there are more rows available for a next fetch. - Row data
-
The row data is not in a buffer like described in [wireprotocol-appendix-types], but as a sequence (0..1) of data rows with a special format, see [wireprotocol-reading-row-data].
You can also consider the row data not a part of the fetch response, but something that is sent after the fetch response.
The success response to [wireprotocol-statements-fetch] is not a single of op_fetch_response, but a sequence of op_fetch_response and row data.That is:
<op-fetch-response (status = 0, count = 1)> <row-data> <op-fetch-response (status = 0, count = 1)> <row-data> ... if end-of-cursor: <op-fetch-response (status = 100, count = 0)> else: <op-fetch-response (status = 0, count = 0)>
Firebird may return fewer rows than requested in [wireprotocol-statements-fetch].