Skip to content

ODBCErrorFrame

[Source]

Captures a single error event from an ODBC operation.

Each frame records: - The operation that failed (e.g., "prepare", "execute", "bind_parameter") - Source location where the operation was called - The ODBC return code - Diagnostic information (SQLSTATE codes and messages) - A sequence number for ordering in an error chain - Optional SQL text if applicable - The handle type ("env", "dbc", "stmt") - Whether this was a successful operation (when log_success is enabled)

Example Usage

match stmt.last_error()
| let err: ODBCErrorFrame val =>
  env.err.print(err.string())
  // Output: [stmt] execute at main.pony:42 - 42S02: Table not found
end
class val ODBCErrorFrame is
  Comparable[ODBCErrorFrame val] ref

Implements


Constructors

create

[Source]

new val create(
  operation': String val,
  source_loc': SourceLoc val,
  sql_return': (SQLSuccess val | SQLSuccessWithInfo val | SQLStillExecuting val | 
    SQLError val | SQLInvalidHandle val | SQLNeedData val | 
    PonyDriverError val | SQLNoData val),
  diagnostics': Array[(String val , String val)] val,
  sequence': USize val,
  sql_text': (String val | None val) = reference,
  handle_type': String val = "stmt",
  is_success': Bool val = false)
: ODBCErrorFrame val^

Parameters

Returns


Public fields

let operation: String val

[Source]


let source_loc: SourceLoc val

[Source]


let sql_return: (SQLSuccess val | SQLSuccessWithInfo val | SQLStillExecuting val |

[SQLError](pony-odbc-SQLError.md) val | [SQLInvalidHandle](pony-odbc-SQLInvalidHandle.md) val | [SQLNeedData](pony-odbc-SQLNeedData.md) val | 
[PonyDriverError](pony-odbc-PonyDriverError.md) val | [SQLNoData](pony-odbc-SQLNoData.md) val)

[Source]


let diagnostics: Array[(String val , String val)] val

[Source]


let sequence: USize val

[Source]


let sql_text: (String val | None val)

[Source]


let handle_type: String val

[Source]


let is_success: Bool val

[Source]


Public Functions

string

[Source]

Formatted error for display.

Format: "[handle_type] operation at file:line - SQLSTATE: message" For success frames: "[handle_type] operation at file:line - OK"

fun box string()
: String val

Returns


sqlstate

[Source]

Returns the first SQLSTATE code or an empty string if none available.

fun box sqlstate()
: String val

Returns


message

[Source]

Returns the first diagnostic message or a generic error description.

fun box message()
: String val

Returns


lt

[Source]

Compare by sequence number for sorting.

fun box lt(
  that: ODBCErrorFrame box)
: Bool val

Parameters

Returns


eq

[Source]

Compare by sequence number for equality.

fun box eq(
  that: ODBCErrorFrame box)
: Bool val

Parameters

Returns


le

fun box le(
  that: ODBCErrorFrame val)
: Bool val

Parameters

Returns


ge

fun box ge(
  that: ODBCErrorFrame val)
: Bool val

Parameters

Returns


gt

fun box gt(
  that: ODBCErrorFrame val)
: Bool val

Parameters

Returns


compare

fun box compare(
  that: ODBCErrorFrame val)
: (Less val | Equal val | Greater val)

Parameters

Returns


ne

fun box ne(
  that: ODBCErrorFrame val)
: Bool val

Parameters

Returns