Class DuckDbValue
Contains methods to input (parameter) values of various types into DuckDB.
Inherited Members
Namespace: Mallard
Assembly: Mallard.dll
Syntax
public static class DuckDbValue
Remarks
The methods here work with types that implement ISettableDuckDbValue. In particular, they are used to set values for parameters in prepared statements.
The methods here, depending on a particular type of the receiver (implementation of ISettableDuckDbValue), may throw exceptions when, for whatever reason, the parameter value cannot be set. DuckDbException is thrown if DuckDB reports an error in setting the value. ObjectDisposedException is thrown if the parameter object or its container/parent object has already been disposed.
Methods
| Edit this page View SourceSetBitString<TReceiver>(TReceiver, ReadOnlySpan<byte>, int)
Set a bit string as the value of a DuckDB parameter.
Declaration
public static void SetBitString<TReceiver>(this TReceiver receiver, ReadOnlySpan<byte> data, int bitLength) where TReceiver : ISettableDuckDbValue
Parameters
Type | Name | Description |
---|---|---|
TReceiver | receiver | The parameter or other object from DuckDB that can accept a value. |
ReadOnlySpan<byte> | data | The bit string encoded as little-endian byte order, the same format used by BitArray internally. |
int | bitLength | The number of bits in the bit string, excluding padding.
This value must be consistent with the length of |
Type Parameters
Name | Description |
---|---|
TReceiver | The type of |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException |
|
ArgumentException |
|
SetBlob<TReceiver>(TReceiver, ReadOnlySpan<byte>)
Set a blob value into a DuckDB parameter.
Declaration
public static void SetBlob<TReceiver>(this TReceiver receiver, ReadOnlySpan<byte> data) where TReceiver : ISettableDuckDbValue
Parameters
Type | Name | Description |
---|---|---|
TReceiver | receiver | The parameter or other object from DuckDB that can accept a value. |
ReadOnlySpan<byte> | data | The binary data to set.
Note that byte arrays ( |
Type Parameters
Name | Description |
---|---|
TReceiver | The type of |
SetGeneric<TReceiver, TInput>(TReceiver, TInput)
Set the value of a DuckDB parameter from a value of generic type.
Declaration
public static void SetGeneric<TReceiver, TInput>(this TReceiver receiver, TInput input) where TReceiver : ISettableDuckDbValue
Parameters
Type | Name | Description |
---|---|---|
TReceiver | receiver | The parameter or other object from DuckDB that can accept a value. |
TInput | input | The value to set. |
Type Parameters
Name | Description |
---|---|
TReceiver | The type of |
TInput | The .NET type of the value to set. |
Exceptions
Type | Condition |
---|---|
NotSupportedException | The run-time type of |
SetNull<TReceiver>(TReceiver)
Set a null (SQL NULL) value into a DuckDB parameter.
Declaration
public static void SetNull<TReceiver>(this TReceiver receiver) where TReceiver : ISettableDuckDbValue
Parameters
Type | Name | Description |
---|---|---|
TReceiver | receiver | The parameter or other object from DuckDB that can accept a value. |
Type Parameters
Name | Description |
---|---|
TReceiver |
SetObject<TReceiver>(TReceiver, object?)
Set the value of a DuckDB parameter from a (boxed) .NET object.
Declaration
public static void SetObject<TReceiver>(this TReceiver receiver, object? input) where TReceiver : ISettableDuckDbValue
Parameters
Type | Name | Description |
---|---|---|
TReceiver | receiver | The parameter or other object from DuckDB that can accept a value. |
object | input | The object containing the value to set. |
Type Parameters
Name | Description |
---|---|
TReceiver | The type of |
Exceptions
Type | Condition |
---|---|
NotSupportedException | The run-time type of |
SetStringUtf16<TReceiver>(TReceiver, ReadOnlySpan<char>)
Set a UTF-16-encoded string value into a DuckDB parameter.
Declaration
public static void SetStringUtf16<TReceiver>(this TReceiver receiver, ReadOnlySpan<char> text) where TReceiver : ISettableDuckDbValue
Parameters
Type | Name | Description |
---|---|---|
TReceiver | receiver | The parameter or other object from DuckDB that can accept a value. |
ReadOnlySpan<char> | text | The string encoded in UTF-16. |
Type Parameters
Name | Description |
---|---|
TReceiver | The type of |
SetStringUtf8<TReceiver>(TReceiver, ReadOnlySpan<byte>)
Set a UTF-8-encoded string value into a DuckDB parameter.
Declaration
public static void SetStringUtf8<TReceiver>(this TReceiver receiver, ReadOnlySpan<byte> text) where TReceiver : ISettableDuckDbValue
Parameters
Type | Name | Description |
---|---|---|
TReceiver | receiver | The parameter or other object from DuckDB that can accept a value. |
ReadOnlySpan<byte> | text | The string encoded in UTF-8. |
Type Parameters
Name | Description |
---|---|
TReceiver | The type of |
Set<TReceiver>(TReceiver, DuckDbDate)
Set a date into a DuckDB parameter.
Declaration
public static void Set<TReceiver>(this TReceiver receiver, DuckDbDate value) where TReceiver : ISettableDuckDbValue
Parameters
Type | Name | Description |
---|---|---|
TReceiver | receiver | The parameter or other object from DuckDB that can accept a value. |
DuckDbDate | value | The value to set. |
Type Parameters
Name | Description |
---|---|
TReceiver | The type of |
Set<TReceiver>(TReceiver, DuckDbDecimal)
Set a decimal value into a DuckDB parameter.
Declaration
public static void Set<TReceiver>(this TReceiver receiver, DuckDbDecimal value) where TReceiver : ISettableDuckDbValue
Parameters
Type | Name | Description |
---|---|---|
TReceiver | receiver | The parameter or other object from DuckDB that can accept a value. |
DuckDbDecimal | value | The value to set. Instances of decimal may be (losslessly) implicitly converted in order to call this method. |
Type Parameters
Name | Description |
---|---|
TReceiver | The type of |
Set<TReceiver>(TReceiver, DuckDbInterval)
Set a time interval into a DuckDB parameter.
Declaration
public static void Set<TReceiver>(this TReceiver receiver, DuckDbInterval value) where TReceiver : ISettableDuckDbValue
Parameters
Type | Name | Description |
---|---|---|
TReceiver | receiver | The parameter or other object from DuckDB that can accept a value. |
DuckDbInterval | value | The value to set. |
Type Parameters
Name | Description |
---|---|
TReceiver | The type of |
Set<TReceiver>(TReceiver, DuckDbTimestamp)
Set a timestamp into a DuckDB parameter.
Declaration
public static void Set<TReceiver>(this TReceiver receiver, DuckDbTimestamp value) where TReceiver : ISettableDuckDbValue
Parameters
Type | Name | Description |
---|---|---|
TReceiver | receiver | The parameter or other object from DuckDB that can accept a value. |
DuckDbTimestamp | value | The value to set. |
Type Parameters
Name | Description |
---|---|
TReceiver | The type of |
Set<TReceiver>(TReceiver, bool)
Set a boolean value into a DuckDB parameter.
Declaration
public static void Set<TReceiver>(this TReceiver receiver, bool value) where TReceiver : ISettableDuckDbValue
Parameters
Type | Name | Description |
---|---|---|
TReceiver | receiver | The parameter or other object from DuckDB that can accept a value. |
bool | value | The value to set. |
Type Parameters
Name | Description |
---|---|
TReceiver | The type of |
Set<TReceiver>(TReceiver, byte)
Set an 8-bit unsigned integer value into a DuckDB parameter.
Declaration
public static void Set<TReceiver>(this TReceiver receiver, byte value) where TReceiver : ISettableDuckDbValue
Parameters
Type | Name | Description |
---|---|---|
TReceiver | receiver | The parameter or other object from DuckDB that can accept a value. |
byte | value | The value to set. |
Type Parameters
Name | Description |
---|---|
TReceiver | The type of |
Set<TReceiver>(TReceiver, BitArray)
Set a bit string as the value of a DuckDB parameter.
Declaration
public static void Set<TReceiver>(this TReceiver receiver, BitArray value) where TReceiver : ISettableDuckDbValue
Parameters
Type | Name | Description |
---|---|---|
TReceiver | receiver | The parameter or other object from DuckDB that can accept a value. |
BitArray | value | The bit string to set. |
Type Parameters
Name | Description |
---|---|
TReceiver | The type of |
Set<TReceiver>(TReceiver, double)
Set a double-precision floating-point value into a DuckDB parameter.
Declaration
public static void Set<TReceiver>(this TReceiver receiver, double value) where TReceiver : ISettableDuckDbValue
Parameters
Type | Name | Description |
---|---|---|
TReceiver | receiver | The parameter or other object from DuckDB that can accept a value. |
double | value | The value to set. |
Type Parameters
Name | Description |
---|---|
TReceiver | The type of |
Set<TReceiver>(TReceiver, Int128)
Set a 128-bit signed integer value into a DuckDB parameter.
Declaration
public static void Set<TReceiver>(this TReceiver receiver, Int128 value) where TReceiver : ISettableDuckDbValue
Parameters
Type | Name | Description |
---|---|---|
TReceiver | receiver | The parameter or other object from DuckDB that can accept a value. |
Int128 | value | The value to set. |
Type Parameters
Name | Description |
---|---|
TReceiver | The type of |
Set<TReceiver>(TReceiver, short)
Set a 16-bit signed integer value into a DuckDB parameter.
Declaration
public static void Set<TReceiver>(this TReceiver receiver, short value) where TReceiver : ISettableDuckDbValue
Parameters
Type | Name | Description |
---|---|---|
TReceiver | receiver | The parameter or other object from DuckDB that can accept a value. |
short | value | The value to set. |
Type Parameters
Name | Description |
---|---|
TReceiver | The type of |
Set<TReceiver>(TReceiver, int)
Set a 32-bit signed integer value into a DuckDB parameter.
Declaration
public static void Set<TReceiver>(this TReceiver receiver, int value) where TReceiver : ISettableDuckDbValue
Parameters
Type | Name | Description |
---|---|---|
TReceiver | receiver | The parameter or other object from DuckDB that can accept a value. |
int | value | The value to set. |
Type Parameters
Name | Description |
---|---|
TReceiver | The type of |
Set<TReceiver>(TReceiver, long)
Set a 64-bit signed integer value into a DuckDB parameter.
Declaration
public static void Set<TReceiver>(this TReceiver receiver, long value) where TReceiver : ISettableDuckDbValue
Parameters
Type | Name | Description |
---|---|---|
TReceiver | receiver | The parameter or other object from DuckDB that can accept a value. |
long | value | The value to set. |
Type Parameters
Name | Description |
---|---|
TReceiver | The type of |
Set<TReceiver>(TReceiver, BigInteger)
Set a variable-length integer value into a DuckDB parameter.
Declaration
public static void Set<TReceiver>(this TReceiver receiver, BigInteger value) where TReceiver : ISettableDuckDbValue
Parameters
Type | Name | Description |
---|---|---|
TReceiver | receiver | The parameter or other object from DuckDB that can accept a value. |
BigInteger | value | The value to set. |
Type Parameters
Name | Description |
---|---|
TReceiver | The type of |
Set<TReceiver>(TReceiver, sbyte)
Set an 8-bit signed integer value into a DuckDB parameter.
Declaration
public static void Set<TReceiver>(this TReceiver receiver, sbyte value) where TReceiver : ISettableDuckDbValue
Parameters
Type | Name | Description |
---|---|---|
TReceiver | receiver | The parameter or other object from DuckDB that can accept a value. |
sbyte | value | The value to set. |
Type Parameters
Name | Description |
---|---|
TReceiver | The type of |
Set<TReceiver>(TReceiver, float)
Set a single-precision floating-point value into a DuckDB parameter.
Declaration
public static void Set<TReceiver>(this TReceiver receiver, float value) where TReceiver : ISettableDuckDbValue
Parameters
Type | Name | Description |
---|---|---|
TReceiver | receiver | The parameter or other object from DuckDB that can accept a value. |
float | value | The value to set. |
Type Parameters
Name | Description |
---|---|
TReceiver | The type of |
Set<TReceiver>(TReceiver, string)
Set a string value into a DuckDB parameter.
Declaration
public static void Set<TReceiver>(this TReceiver receiver, string value) where TReceiver : ISettableDuckDbValue
Parameters
Type | Name | Description |
---|---|---|
TReceiver | receiver | The parameter or other object from DuckDB that can accept a value. |
string | value | The UTF-8 encoded bytes to set. |
Type Parameters
Name | Description |
---|---|
TReceiver | The type of |
Set<TReceiver>(TReceiver, UInt128)
Set a 128-bit unsigned integer value into a DuckDB parameter.
Declaration
public static void Set<TReceiver>(this TReceiver receiver, UInt128 value) where TReceiver : ISettableDuckDbValue
Parameters
Type | Name | Description |
---|---|---|
TReceiver | receiver | The parameter or other object from DuckDB that can accept a value. |
UInt128 | value | The value to set. |
Type Parameters
Name | Description |
---|---|
TReceiver | The type of |
Set<TReceiver>(TReceiver, ushort)
Set a 16-bit unsigned integer value into a DuckDB parameter.
Declaration
public static void Set<TReceiver>(this TReceiver receiver, ushort value) where TReceiver : ISettableDuckDbValue
Parameters
Type | Name | Description |
---|---|---|
TReceiver | receiver | The parameter or other object from DuckDB that can accept a value. |
ushort | value | The value to set. |
Type Parameters
Name | Description |
---|---|
TReceiver | The type of |
Set<TReceiver>(TReceiver, uint)
Set a 32-bit unsigned integer value into a DuckDB parameter.
Declaration
public static void Set<TReceiver>(this TReceiver receiver, uint value) where TReceiver : ISettableDuckDbValue
Parameters
Type | Name | Description |
---|---|---|
TReceiver | receiver | The parameter or other object from DuckDB that can accept a value. |
uint | value | The value to set. |
Type Parameters
Name | Description |
---|---|
TReceiver | The type of |
Set<TReceiver>(TReceiver, ulong)
Set a 64-bit unsigned integer value into a DuckDB parameter.
Declaration
public static void Set<TReceiver>(this TReceiver receiver, ulong value) where TReceiver : ISettableDuckDbValue
Parameters
Type | Name | Description |
---|---|---|
TReceiver | receiver | The parameter or other object from DuckDB that can accept a value. |
ulong | value | The value to set. |
Type Parameters
Name | Description |
---|---|
TReceiver | The type of |
TrySetGeneric<TReceiver, TInput>(TReceiver, TInput)
Attempt to set the value of a DuckDB parameter from a value of generic type.
Declaration
public static bool TrySetGeneric<TReceiver, TInput>(this TReceiver receiver, TInput input) where TReceiver : ISettableDuckDbValue
Parameters
Type | Name | Description |
---|---|---|
TReceiver | receiver | The parameter or other object from DuckDB that can accept a value. |
TInput | input | The value to set. |
Returns
Type | Description |
---|---|
bool | True if the value has been set successfully. False if the run-time type of |
Type Parameters
Name | Description |
---|---|
TReceiver | The type of |
TInput | The .NET type of the value to set. |
TrySetObject<TReceiver>(TReceiver, object?)
Attempt to set the value of a DuckDB parameter from a (boxed) .NET object.
Declaration
public static bool TrySetObject<TReceiver>(this TReceiver receiver, object? input) where TReceiver : ISettableDuckDbValue
Parameters
Type | Name | Description |
---|---|---|
TReceiver | receiver | The parameter or other object from DuckDB that can accept a value. |
object | input | The object containing the value to set. |
Returns
Type | Description |
---|---|
bool | True if the value has been set successfully. False if the run-time type of |
Type Parameters
Name | Description |
---|---|
TReceiver | The type of |