Cursor¶
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.
Public Functions¶
fetch¶
Fetch the next row.
Returns¶
- (Row val | EndOfRows val | FetchError val)
fetch_into¶
Fetch the next row into a reusable MutableRow.
Parameters¶
- row: MutableRow ref
Returns¶
- (MutableRow ref | EndOfRows val | FetchError val)
cancel_token¶
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().
Returns¶
- CancelToken val
values¶
Return an iterator for use with Pony's for loop.
Yields (Row val | FetchError) — match on each result.
Returns¶
- CursorIterator ref
last_warnings¶
Returns¶
close¶
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).
Returns¶
- None val