Rows affected by query execution
Obtaining the rows affected by a query is done using the statement information request message
-
isc_info_sql_records
Obtaining the rows affected by a query is done using the statement information request message
isc_info_sql_records
Int32 — p_operationOperation code (op_fetch — 65)
Int32 — p_sqldata_statementStatement handle
Buffer — p_sqldata_blrOutput parameters in BLR format
Only needs to be sent on first fetch;subsequent fetches can send a zero-length buffer.
Int32 — p_sqldata_message_numberMessage number (always 0)
Int32 — p_sqldata_messagesMessage count/fetch size (e.g. 200)
The server may decide to return fewer rows than requested, even if the end-of-cursor wasn’t reached yet.
Success response: one or more [wireprotocol-responses-fetch]
Failure response: [wireprotocol-responses-generic] — with an error in p_resp_status_vector
It is possible to receive [wireprotocol-responses-generic] with an error in the status vector after one or more fetch responses.
Int32 — p_operationOperation code (op_set_cursor — 69)
Int32 — p_sqlcur_statementStatement handle
String — p_sqlcur_cursor_nameCursor name (null terminated!)
Int32 — p_sqlcur_typeCursor type
Reserved for future use, always use 0.
Int32 — p_operationOperation code
op_create_blob — 34
|
Creates a new blob |
op_create_blob2 — 57
|
Creates a new blob with a blob parameter buffer |
op_open_blob — 35
|
Opens an existing blob |
op_open_blob2 — 56
|
Opens an existing blob with a blob parameter buffer |
Buffer — p_blob_bpbBlob parameter buffer
Only sent for op_create_blob2 — 57 and op_open_blob2 — 56.
Int32 — p_blob_transactionTransaction handle
Int64 — p_blob_idBlob ID
[wireprotocol-responses-generic] — on success
+
p_resp_object is the blob handle
p_resp_blob_id is the blob id (for op_create_blob --35/ op_create_blob2 — 57)
Request flushing and response processing can be deferred.
If ptype_batch_send or higher is used, other blob operations can be sent immediately after the open/create.They can use the invalid object handle (0xFFFF) instead of the — not yet received — blob handle.
Int32 — p_operationOperation code (op_get_segment — 36)
Int32 — p_sgmt_blobBlob handle
Int32 — p_sgmt_lengthSegment length
Maximum length is 32767 for Firebird 2.5 and older, 65535 for Firebird 3.0 and higher.
Buffer — p_sgmt_segmentAlways a zero-length buffer
[wireprotocol-responses-generic] — on success, p_resp_data is the blob segment
The response buffer in p_resp_data contains zero or more segments.Each segment starts with 2-bytes for the length (little-endian), followed by that length of data.
Request flushing and response processing can be deferred.
If ptype_batch_send or higher is used, op_get_segment can be batched with [wireprotocol-blobs-create] (and other blob operations) by using the invalid object handle (0xFFFF).
Int32 — p_operationOperation code (op_put_segment — 37)
Int32 — p_sgmt_blobBlob handle
Int32 — p_sgmt_lengthLength of segment data (effectively ignored; possibly only in recent Firebird versions)
Buffer — p_sgmt_segmentBlob segment
If the blob was created as a segmented blob, the maximum length is 32765 (Firebird 2.5 and older) or 65533 (Firebird 3.0 and higher).
For stream blobs, there is no length limitation other than the maximum buffer length (TODO: verify, might only be for recent versions).
Request flushing and response processing can be deferred.
If ptype_batch_send or higher is used, op_put_segment can be batched with [wireprotocol-blobs-create] (and other blob operations) by using the invalid object handle (0xFFFF).
Similar to [wireprotocol-blobs-putsegment], but allows to send multiple segments.
Int32 — p_operationOperation code (op_batch_segments — 44)
Int32 — p_sgmt_blobBlob handle
Int32 — p_sgmt_lengthLength of segment data (effectively ignored; possibly only in recent Firebird versions)
Buffer — p_sgmt_segmentBlob segments
The buffer can contain one or more segments, which are prefixed with 2 bytes of length (little-endian), followed by the data.The maximum length per segment is 32765 (Firebird 2.5 and older) or 65533 (Firebird 3.0 and higher).
Request flushing and response processing can be deferred.
If ptype_batch_send or higher is used, op_batch_segment can be batched with [wireprotocol-blobs-create] (and other blob operations) by using the invalid object handle (0xFFFF).
Seek is only supported for blobs that were created as a stream blob.Seek is not fully supported for blobs longer than 2 GiB (4 GiB?).
Int32 — p_operationOperation code (op_seek_blob — 61)
Int32 — p_seek_blobBlob handle
Int32 — p_seek_modeSeek mode
blb_seek_from_head — 0
|
absolute seek from start of blob |
blb_seek_relative — 1
|
relative seek from current position |
blb_seek_from_tail — 2
|
absolute seek from end of blob |
Int32 — p_seek_offsetOffset
[wireprotocol-responses-generic] — on success, p_resp_object is the current position.
Request flushing and response processing can be deferred.
If ptype_batch_send or higher is used, op_seek_blob can be batched with [wireprotocol-blobs-create] (and other blob operations) by using the invalid object handle (0xFFFF).
Cancels and invalidates the blob handle.If this was a newly created blob, the blob is disposed.
Int32 — p_operationOperation code (op_cancel_blob — 38)
Int32 — p_rlse_objectBlob handle
Request flushing and response processing can be deferred.
If ptype_batch_send or higher is used, op_cancel_blob can be batched with [wireprotocol-blobs-create] (and other blob operations) by using the invalid object handle (0xFFFF).Though doing this probably makes little sense for op_cancel_blob.
Closes and invalidates the blob handle.
Int32 — p_operationOperation code (op_close_blob — 39)
Int32 — p_rlse_objectBlob handle
Request flushing and response processing can be deferred.
If ptype_batch_send or higher is used, op_close_blob can be batched with [wireprotocol-blobs-create] (and other blob operations) by using the invalid object handle (0xFFFF).
Int32 — p_operationOperation code (op_get_slice — 58)
Int32 — p_slc_transactionTransaction handle
Int64 — p_slc_idArray handle
Int32 — p_slc_lengthSlice length
Buffer — p_slc_sdlSlice descriptor (SDL)
Buffer — p_slc_parametersSlice parameters (always empty?, needs verification)
Buffer — p_slc_sliceSlice data (always empty)
Success response: [wireprotocol-responses-slice]
Failure response: [wireprotocol-responses-generic]
Int32 — p_operationOperation code (op_put_slice — 59)
Int32 — p_slc_transactiontransaction handle
Int64 — p_slc_idArray handle
Int32 — p_slc_lengthSlice length
Buffer — p_slc_sdlSlice descriptor (SDL)
Buffer — p_slc_parametersSlice parameters (always empty?, needs verification)
Buffer` — p_slc_sliceSlice data
[wireprotocol-responses-generic] — on success, p_resp_blob_id is the array handle.
Statement batches were introduced in protocol 16 (Firebird 4.0).
Int32 — p_operationOperation code (op_batch_create — 99)
Int32 — p_batch_statementStatement handle
Buffer — p_batch_blrBLR format of batch messages
UInt32 — p_batch_msglenMessage length
Buffer — p_batch_pbBatch parameters buffer
If ptype_lazy or higher, flushing and response processing can be deferred.
Int32 — p_operationOperation code (op_batch_msg — 100)
Int32 — p_batch_statementStatement handle
UInt32 — p_batch_messagesNumber of messages
Buffer — p_batch_dataBatched values (formatted message repeats 'Number of messages' times)
Int32 — p_operationOperation code (op_batch_exec — 101)
Int32 — p_batch_statementStatement handle
Int32 — p_batch_transactionTransaction handle
Success response:
Int32 — p_operationOperation code
If operation equals op_batch_cs — 103`:
Batch completion state
Int32 — p_batch_statementStatement handle
UInt32 — p_batch_reccountTotal records count
UInt32 — p_batch_updatesNumber of update counters (records updated per each message)
UInt32 — p_batch_vectorsNumber of per-message error blocks (message number in batch and status vector of an error processing it)
UInt32 — p_batch_errorsNumber of simplified per-message error blocks (message number in batch without status vector)
Byte[]Update counters (records updated per each message), array of Int32, length is equal to p_batch_updates
Length is p_batch_updates * 4 bytes long.
Byte[]Detailed info about errors in batch (for each error server sends number of message (Int32) and status vector in standard way (exactly like in op_response).Number of such pairs is equal to p_batch_vectors.
Length can only be determined by correctly parsing the <Int32><statusvector> pairs.
Byte[]Simplified error blocks (for each error server sends number of message (Int32) w/o status vector).Used when too many errors took place.Number of elements is equal to p_batch_errors.
Length is p_batch_errors * 4 bytes.
Failure response: [wireprotocol-responses-generic]
Int32 — p_operationOperation code (op_batch_rls — 102)
Int32 — p_batch_statementStatement handle
Int32 — p_operationOperation code (op_batch_cancel — 109)
Int32 — p_batch_statementStatement handle
Introduced in protocol 17 (Firebird 4.0.1).
Used to force the server to acknowledge previously sent lazy intermediate operations (e.g. op_batch_msg, op_batch_regblob, op_batch_blob_stream and possibly others).
Int32 — p_operationOperation code (op_batch_sync — 110)
Int32 — p_operationOperation code (op_batch_set_bpb — 106)
Int32 — p_batch_statementStatement handle
Buffer — p_batch_blob_bpbDefault BLOB parameter buffer
Int32 — p_operationOperation code (op_batch_regblob — 104)
Int32 — p_batch_statementStatement handle
Int64 — p_batch_exist_idExisting BLOB ID
Int64 — p_batch_blob_idBatch temporary BLOB ID
|
Caution
|
This description needs further verification and possibly correction.For example, it seems to mix up Buffer and Byte[].We’re also not able to match some fields to the implementation.For example, the repeated "Record length" seems to be absent, or may actually refer to the |
Int32 — p_operationOperation code (op_batch_blob_stream)
Int32 — p_batch_statementStatement handle
Buffer[] — p_batch_blob_dataBLOB stream
This stream is a sequence of blob records.Each blob records contains:
UInt32Record length
The following three fields are called BLOB header
Int64Batch temporary BLOB ID
UInt32BLOB size
UInt32BLOB parameters buffer size
BufferBLOB parameters buffer
BufferBLOB data (length - BLOB size bytes) (what does this mean?)
BLOB headers and records in a stream need not match, i.e. one record may contain many BLOBs and BLOB may stretch from one record to next.
Uses the [wireprotocol-requests-info] message with:
p_operation
|
|
p_info_object
|
Statement handle |
p_info_items
|
Values of |
Attach to a service.Use message [wireprotocol-connect-attach] with op_service_attach — 82.
p_atch_file:Current Firebird versions only support one service: service_mgr.Since Firebird 3.0, this can also be an empty string (empty buffer) with the same meaning.
Send [wireprotocol-connect-detach] with op_service_detach — 83, followed by [wireprotocol-connect-disconnect].
Although the message looks similar to [wireprotocol-requests-info], it has different semantics.
Int32 — p_operationOperation code (op_service_start — 85)
Int32 — p_info_objectUnused, always use 0
Int32 — p_info_incarnationIncarnation of object (0)
TODO: Usage and meaning?
Buffer — p_info_itemsService parameter buffer
Although the message looks similar to [wireprotocol-requests-info], it has different semantics.
Int32 — p_operationOperation code (op_service_info — 84)
Int32 — p_info_objectUnused, always use 0
Int32 — p_info_incarnationIncarnation of object (0)
TODO: Usage and meaning?
Buffer — p_info_itemsService parameter buffer
Buffer — p_info_recv_itemsRequested information items
Int32 — p_info_buffer_lengthRequested information items buffer length
[wireprotocol-responses-generic] — on success, p_resp_data contains the requested information.