Mallard
Search Results for

    Show / Hide Table of Contents

    Struct DuckDbStatement.ParametersCollection

    The collection of formal parameters in a prepared statement from DuckDB.

    Implements
    IReadOnlyCollection<DuckDbStatement.Parameter>
    IEnumerable<DuckDbStatement.Parameter>
    IEnumerable
    Inherited Members
    ValueType.Equals(object)
    ValueType.GetHashCode()
    ValueType.ToString()
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: Mallard
    Assembly: Mallard.dll
    Syntax
    public readonly struct DuckDbStatement.ParametersCollection : IReadOnlyCollection<DuckDbStatement.Parameter>, IEnumerable<DuckDbStatement.Parameter>, IEnumerable
    Remarks

    This collection is essentially an ordered list of the parameters. (It does not implement IReadOnlyList<T> only because DuckDB's parameters are defined to be numbered starting from 1, not 0.)

    Parameters may also be looked up by the name they have been defined under in the SQL prepared statement.

    Properties

    | Edit this page View Source

    Count

    Get the number of parameters available to bind in the DuckDB statement.

    Declaration
    public int Count { get; }
    Property Value
    Type Description
    int

    The total number of parameters.

    | Edit this page View Source

    this[int]

    Get one of the parameters, by positional index.

    Declaration
    public DuckDbStatement.Parameter this[int index] { get; }
    Parameters
    Type Name Description
    int index

    1-based index of the parameter.

    Currently, DuckDB does not support mixing named and positional parameters, so if positional parameters are being used, this index should match up exactly with the ordinal of the parameter in the SQL statement, e.g. $1 maps to index 1.

    Property Value
    Type Description
    DuckDbStatement.Parameter
    Exceptions
    Type Condition
    ArgumentOutOfRangeException

    index is less than 1 or greater than Count.

    | Edit this page View Source

    this[string]

    Get one of the parameters, by name.

    Declaration
    public DuckDbStatement.Parameter this[string name] { get; }
    Parameters
    Type Name Description
    string name

    The name of the parameter. For positional parameters in the SQL statement, the name is the decimal representation of the ordinal (in ASCII digits, no leading zeros).

    Property Value
    Type Description
    DuckDbStatement.Parameter
    Exceptions
    Type Condition
    ArgumentException

    There is no parameter with the given name from the prepared statement.

    ObjectDisposedException

    The prepared statement for this parameter collection has already been disposed. (Looking up the name requires querying the native prepared statement object from DuckDB.)

    Methods

    | Edit this page View Source

    GetEnumerator()

    Returns an enumerator that iterates through the collection.

    Declaration
    public IEnumerator<DuckDbStatement.Parameter> GetEnumerator()
    Returns
    Type Description
    IEnumerator<DuckDbStatement.Parameter>

    An enumerator that can be used to iterate through the collection.

    | Edit this page View Source

    GetIndexForName(string)

    Get the index of the parameter with the given name.

    Declaration
    public int GetIndexForName(string name)
    Parameters
    Type Name Description
    string name

    The name of the parameter in the SQL statement.

    Returns
    Type Description
    int

    The 1-based index of the named parameter, suitable for indexing into this collection. If no parameter with the given name exists, -1 is returned.

    Exceptions
    Type Condition
    ObjectDisposedException

    The prepared statement for this parameter collection has already been disposed. (Looking up the name requires querying the native prepared statement object from DuckDB.)

    Implements

    IReadOnlyCollection<T>
    IEnumerable<T>
    IEnumerable
    • Edit this page
    • View Source
    In this article
    Back to top Generated by DocFX