SpiParameter
Namespace: Ankus
Assembly: Ankus.Runtime.dll
Describes a typed positional SQL parameter, including the PostgreSQL type of a NULL value.
public readonly struct SpiParameterMethods
Section titled “Methods”Create(PgDatum)
Section titled “Create(PgDatum)”Binds a raw datum with its exact declared PostgreSQL type and SQL NULL flag.
public static SpiParameter Create(PgDatum value)Parameters:
value — PgDatum
The raw value, whose native owner must remain live through execution.
Returns: SpiParameter
The typed raw parameter.
Create(PgHeapTuple?, PgTupleDescriptor)
Section titled “Create(PgHeapTuple?, PgTupleDescriptor)”Binds a tuple or SQL NULL using an explicit composite descriptor. A base composite can bind to its domain; PostgreSQL validates the target domain when consuming the value.
public static SpiParameter Create(PgHeapTuple? value, PgTupleDescriptor descriptor)Parameters:
value — PgHeapTuple
The tuple, or null for SQL NULL.
descriptor — PgTupleDescriptor
The parameter’s PostgreSQL composite identity.
Returns: SpiParameter
The typed parameter.
Exceptions:
- InvalidOperationException: The descriptor has no PostgreSQL row type.
CreateArray(PgArray<PgHeapTuple?>?, PgTupleDescriptor)
Section titled “CreateArray(PgArray<PgHeapTuple?>?, PgTupleDescriptor)”Binds a shape-preserving composite array or SQL NULL using an explicit element descriptor. Base composite elements can bind to a domain array with the same underlying row type.
public static SpiParameter CreateArray(PgArray<PgHeapTuple?>? value, PgTupleDescriptor descriptor)Parameters:
value — PgArray<PgHeapTuple>
The tuple array, or null for SQL NULL.
descriptor — PgTupleDescriptor
The array element’s PostgreSQL type identity.
Returns: SpiParameter
The typed array parameter.
Exceptions:
- InvalidOperationException: The descriptor has no PostgreSQL row type.
Create<T>(T)
Section titled “Create<T>(T)”Creates a positional parameter using the declared CLR type, including nullable types. Parameters appear in SQL as $1, $2, and so on.
public static SpiParameter Create<T>(T value)Type parameters:
T
The managed parameter type.
Parameters:
value — T
The parameter value.
Returns: SpiParameter
A typed parameter.
Properties
Section titled “Properties”TypeOid
Section titled “TypeOid”Gets the PostgreSQL type OID used when binding the parameter.
public uint TypeOid { get; }Value: uint
Gets the managed value or raw datum handle. Ordinary SQL NULL parameters have a null value; raw parameters carry their NULL flag in PgDatum.IsNull.
public object? Value { get; }Value: object