ODBCErrorFrame¶
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
Implements¶
- Comparable[ODBCErrorFrame val] ref
Constructors¶
create¶
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¶
- 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
Returns¶
- ODBCErrorFrame val^
Public fields¶
let operation: String val¶
let source_loc: SourceLoc val¶
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)
let diagnostics: Array[(String val , String val)] val¶
let sequence: USize val¶
let sql_text: (String val | None val)¶
let handle_type: String val¶
let is_success: Bool val¶
Public Functions¶
string¶
Formatted error for display.
Format: "[handle_type] operation at file:line - SQLSTATE: message" For success frames: "[handle_type] operation at file:line - OK"
Returns¶
- String val
sqlstate¶
Returns the first SQLSTATE code or an empty string if none available.
Returns¶
- String val
message¶
Returns the first diagnostic message or a generic error description.
Returns¶
- String val
lt¶
Compare by sequence number for sorting.
Parameters¶
- that: ODBCErrorFrame box
Returns¶
- Bool val
eq¶
Compare by sequence number for equality.
Parameters¶
- that: ODBCErrorFrame box
Returns¶
- Bool val
le¶
Parameters¶
- that: ODBCErrorFrame val
Returns¶
- Bool val
ge¶
Parameters¶
- that: ODBCErrorFrame val
Returns¶
- Bool val
gt¶
Parameters¶
- that: ODBCErrorFrame val
Returns¶
- Bool val
compare¶
Parameters¶
- that: ODBCErrorFrame val
Returns¶
ne¶
Parameters¶
- that: ODBCErrorFrame val
Returns¶
- Bool val