Skip to content

SpiParameter

Namespace: Ankus

Assembly: Ankus.Runtime.dll

Describes a typed positional SQL parameter, including the PostgreSQL type of a NULL value.

public readonly struct SpiParameter

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.

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:

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:

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.

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