Skip to content

ODBCEnv

[Source]

ODBCEnv

The class that wraps our ODBC Environment handle.

Usage

It is currently very simple as very few of the attributes are implemented as of yet.

Currently, we only support ODBC version 3.0.

var oenv: ODBCEnv = ODBCEnv

Error Handling

ODBCEnv maintains an error chain that can aggregate errors from all child connections and their statements via all_errors():

// Get all errors across entire handle hierarchy, sorted by sequence
for err in env.all_errors().values() do
  env.err.print(err.string())
end
class ref ODBCEnv is
  SqlState ref

Implements


Constructors

create

[Source]

new ref create()
: ODBCEnv ref^

Returns


Public fields

let odbcenv: ODBCHandleEnv tag

[Source]


var strict: Bool val

[Source]


Public Functions

dbc

[Source]

Used to create an ODBCDbc object from this ODBCEnv.

fun ref dbc(
  sl: SourceLoc val = __loc)
: ODBCDbc ref ?

Parameters

Returns


sqlstates

[Source]

Returns an array of SQL States

fun box sqlstates()
: Array[(String val , String val)] val

Returns


error_chain

[Source]

Access the error chain for inspection.

fun box error_chain()
: ODBCErrorChain box

Returns


last_error

[Source]

Convenience method: get the most recent error frame.

fun box last_error()
: (ODBCErrorFrame val | None val)

Returns


configure_error_chain

[Source]

Configure error chain behavior.

  • max_frames: Maximum number of frames to store (default: 100)
  • auto_clear: Clear chain on prepare()/finish() (default: true)
  • log_success: Also record successful operations (default: false)
fun ref configure_error_chain(
  max_frames: USize val = 100,
  auto_clear: Bool val = true,
  log_success: Bool val = false)
: None val

Parameters

  • max_frames: USize val = 100
  • auto_clear: Bool val = true
  • log_success: Bool val = false

Returns


all_errors

[Source]

Returns all errors across the entire handle hierarchy, sorted by sequence.

fun box all_errors()
: Array[ODBCErrorFrame val] val

Returns