SqlValue¶
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.
Public Functions¶
c_data_type¶
Returns¶
- I16 val
sql_type¶
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).
Returns¶
- I16 val
len_or_indptr¶
Returns¶
- I64 val
bind_to_odbc¶
fun box bind_to_odbc(
hstmt: Pointer[None val] tag,
param_num: U16 val,
ind_ptr: Pointer[I64 val] tag)
: I16 val
Parameters¶
Returns¶
- I16 val