Skip to content

Connection

[Source]

Non-sendable database connection wrapping SQLHDBC (and its own SQLHENV). All methods check internal state and return errors for misuse.

class ref Connection

Public Functions

exec

[Source]

Execute a non-parameterized statement via SQLExecDirect. Returns affected row count, or None for DDL.

fun ref exec(
  sql: String val)
: (RowCount | ExecError val)

Parameters

Returns


exec_p

[Source]

Partial variant of exec(). Raises error on failure. For try/else chaining of multiple statements.

fun ref exec_p(
  sql: String val)
: RowCount ?

Parameters

Returns


prepare

[Source]

Prepare a statement for parameter binding and repeated execution.

fun ref prepare(
  sql: String val)
: (Statement ref | PrepareError val)

Parameters

Returns


prepare_p

[Source]

Partial variant of prepare(). Raises error on failure.

fun ref prepare_p(
  sql: String val)
: Statement ref ?

Parameters

Returns


query

[Source]

Execute a SELECT via SQLExecDirect and return a Cursor.

fun ref query(
  sql: String val)
: (Cursor ref | ExecError val)

Parameters

Returns


query_p

[Source]

Partial variant of query(). Raises error on failure.

fun ref query_p(
  sql: String val)
: Cursor ref ?

Parameters

Returns


begin

[Source]

Set autocommit off. Returns error if already in a transaction or if the connection is closed.

fun ref begin()
: (TxBegun val | TxBeginError val)

Returns


commit

[Source]

Commit the current transaction and re-enable autocommit.

fun ref commit()
: (TxCommitted val | TxCommitError val)

Returns


rollback

[Source]

Rollback the current transaction and re-enable autocommit.

fun ref rollback()
: (TxRolledBack val | TxRollbackError val)

Returns


begin_p

[Source]

Partial variant of begin(). Raises error on failure.

fun ref begin_p()
: None val ?

Returns


commit_p

[Source]

Partial variant of commit(). Raises error on failure.

fun ref commit_p()
: None val ?

Returns


rollback_p

[Source]

Partial variant of rollback(). Raises error on failure.

fun ref rollback_p()
: None val ?

Returns


last_warnings

[Source]

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

Returns


close

[Source]

Close the connection. Idempotent. Auto-rollbacks if in a transaction. Sets shared _alive flag to false.

fun ref close()
: None val

Returns