Skip to main content

open_query

Function open_query 

Source
pub async fn open_query(
    client: &Client,
    sql: &str,
    page_size: usize,
    previous: Option<ActiveCursor>,
) -> Result<(ExecutionOutcome, Option<ActiveCursor>), PgError>
Expand description

Open a new query. Closes any previously-active cursor (and its transaction) before starting. Returns the first page synchronously along with a cursor id when more rows remain.

page_size is the soft window for the first page. Non-row-returning statements (DDL, INSERT without RETURNING) skip the cursor path entirely — they run via batch_execute and report rows_affected. Multi-statement scripts (SET …; SELECT … etc) run via simple_query; the last row-returning statement’s result is surfaced and cursor pagination isn’t offered.