async fn stream_ws_peek_rows(
ws: &mut WebSocket,
client: &mut SessionClient,
desc: &RelationDesc,
rows_stream: &mut RecordFirstRowStream,
max_result_size: usize,
ends_group: bool,
) -> Result<(bool, Vec<WebSocketResponse>, Option<(StatementEndedExecutionReason, ExecuteContextGuard)>), Error>Expand description
Streams a result with rows, such as that of a SELECT, to a WebSocket
client one batch at a time, flushing between batches so a slow client
applies real backpressure and only one batch is resident. This gives a large
SELECT over WebSocket the same bounded memory profile as pgwire SELECT,
and mirrors the Subscribe arm of WebSocket::add_result.
On success returns the (is_err, msgs, stmt_logging) triple that
add_result folds into its response. An Err means a write to the socket
failed, so the server should disconnect. add_result turns that into a
cancellation to match pgwire.
The Rows descriptor is sent lazily, right before the first batch of rows
or an empty successful result, but never before an error. So a query that
fails before producing any rows emits only an Error.