Skip to content

SqlValue

[Source]

A value that can be bound to a prepared statement parameter slot.

Each SqlValue owns its own storage — a fixed-width type points ODBC at addressof self.value, a text/decimal points at its String's cpointer(), and composite types (date/time/timestamp) hold a packed Array[U8] buffer. Statement keeps the bound SqlValue alive until the next rebind so the pointer registered with SQLBindParameter remains valid for SQLExecute.

Custom types typically only need to supply c_data_type() and bind_to_odbc(). sql_type() has a default mapping; override for types where the C and SQL types differ (e.g. DECIMAL carried as CHAR).

bind_to_odbc() must call @SQLBindParameter directly — Pony's addressof operator is only usable in FFI argument positions, so no primitive helper can hide the FFI call for fixed-width types that bind via addressof self.value.

trait val SqlValue

Public Functions

c_data_type

[Source]

fun box c_data_type()
: I16 val

Returns


sql_type

[Source]

SQL type the driver should interpret the parameter as. Default maps from c_data_type() using the obvious 1:1 pairing; override when the SQL type differs (e.g. DECIMAL stored as a C string).

fun box sql_type()
: I16 val

Returns


len_or_indptr

[Source]

fun box len_or_indptr()
: I64 val

Returns


bind_to_odbc

[Source]

fun box bind_to_odbc(
  hstmt: Pointer[None val] tag,
  param_num: U16 val,
  ind_ptr: Pointer[I64 val] tag)
: I16 val

Parameters

Returns