Skip to content

Cursor

[Source]

Non-sendable result set from an ad-hoc query (Connection.query()). Supports fetch and close only — no binding, no re-execution. close() frees the underlying SQLHSTMT entirely.

class ref Cursor

Public Functions

fetch

[Source]

Fetch the next row.

fun ref fetch()
: (Row val | EndOfRows val | FetchError val)

Returns


fetch_into

[Source]

Fetch the next row into a reusable MutableRow.

fun ref fetch_into(
  row: MutableRow ref)
: (MutableRow ref | EndOfRows val | FetchError val)

Parameters

Returns


cancel_token

[Source]

Return a sendable token that can cancel this cursor's in-progress operation from another actor.

The token captures a raw copy of the SQLHSTMT pointer. It does not track whether the cursor has been closed. Calling cancel() on a token after close() invokes SQLCancel on a freed handle — undefined behavior. The caller must ensure all outstanding tokens are discarded before calling close().

fun box cancel_token()
: CancelToken val

Returns


values

[Source]

Return an iterator for use with Pony's for loop. Yields (Row val | FetchError) — match on each result.

fun ref values()
: CursorIterator ref

Returns


last_warnings

[Source]

fun ref last_warnings()
: (Warnings val | None val)

Returns


close

[Source]

Free the SQLHSTMT. Idempotent.

Any CancelTokens obtained from cancel_token() become invalid after this call. Using a token after close() is undefined behavior — see cancel_token() for the lifetime contract.

If the connection has already been closed, the driver freed this handle transitively via SQLFreeHandle(SQL_HANDLE_DBC); in that case we only mark ourselves closed without a second SQLFreeHandle call (which would be UB on a dangling handle).

fun ref close()
: None val

Returns