Skip to content

CancelToken

[Source]

Sendable cancellation token. Can be sent to another actor and used to cancel a long-running ODBC operation via SQLCancel.

Usage:

// In the querying actor:
let stmt = conn.prepare_p("SELECT ... complex query ...")?
let token = stmt.cancel_token()
supervisor.register_cancel(token)
stmt.execute_p()?
for result in stmt.values() do ... end

// In the supervising actor:
be timeout(token: CancelToken) =>
  token.cancel()

SQLCancel is thread-safe — it can be called from any thread while another thread is blocked on SQLFetch/SQLExecute. The blocked call will return SQL_ERROR with SQLSTATE HY008 (operation canceled).

class val CancelToken

Constructors

create

[Source]

new val create(
  hstmt: Pointer[None val] tag)
: CancelToken val^

Parameters

Returns


Public Functions

cancel

[Source]

Request cancellation of the in-progress operation on this statement. Safe to call from any actor while the operation is in progress.

WARNING: The token holds a raw copy of the SQLHSTMT pointer. If the owning Statement or Cursor has been closed (freeing the handle), this calls SQLCancel on a freed handle — undefined behavior. Callers must ensure the token is not used after close(). See Statement.cancel_token() and Cursor.cancel_token() for the lifetime contract.

fun box cancel()
: None val

Returns