Mallard
Search Results for

    Show / Hide Table of Contents

    Class DuckDbParameterCollection

    ADO.NET-compatible collection of parameters for DuckDbCommand.

    Inheritance
    object
    DuckDbParameterCollection
    Implements
    IDataParameterCollection
    IList
    ICollection
    IList<IDbDataParameter>
    ICollection<IDbDataParameter>
    IEnumerable<IDbDataParameter>
    IEnumerable
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Mallard.Ado
    Assembly: Mallard.dll
    Syntax
    public sealed class DuckDbParameterCollection : IDataParameterCollection, IList, ICollection, IList<IDbDataParameter>, ICollection<IDbDataParameter>, IEnumerable<IDbDataParameter>, IEnumerable
    Remarks

    This implementation of IDataParameterCollection is essentially a plain list of the parameters. Most validation happens when the DuckDbCommand is executed, not when a parameter is added to this collection.

    Parameter objects that may be set into this collection can be named or unnamed, respectively meaning that they have ParameterName being a non-empty string, or not. Unnamed parameters are assumed to refer to positional parameters in the DuckDB SQL statement. Positional parameters may also be named with a string that is the decimal representation (in ASCII digits, no leading zeros) of the positional index.

    It is not recommended to mix named and unnamed parameter objects in the same collection. While that is not outright disallowed by this implementation (mainly because the validation is not trivial), there may be surprising behavior regarding how the parameter objects are actually mapped to the formal parameters in the SQL statement.

    Properties

    | Edit this page View Source

    Count

    The number of parameters in this collection.

    Declaration
    public int Count { get; }
    Property Value
    Type Description
    int
    | Edit this page View Source

    IsFixedSize

    Gets a value indicating whether the IList has a fixed size.

    Declaration
    public bool IsFixedSize { get; }
    Property Value
    Type Description
    bool

    true if the IList has a fixed size; otherwise, false.

    | Edit this page View Source

    IsReadOnly

    Gets a value indicating whether the IList is read-only.

    Declaration
    public bool IsReadOnly { get; }
    Property Value
    Type Description
    bool

    true if the IList is read-only; otherwise, false.

    | Edit this page View Source

    IsSynchronized

    Gets a value indicating whether access to the ICollection is synchronized (thread safe).

    Declaration
    public bool IsSynchronized { get; }
    Property Value
    Type Description
    bool

    true if access to the ICollection is synchronized (thread safe); otherwise, false.

    | Edit this page View Source

    this[int]

    Set a parameter at a given index of this collection.

    Declaration
    public IDbDataParameter this[int index] { get; set; }
    Parameters
    Type Name Description
    int index

    Index of the slot to set the parameter object into, from 0 (inclusive) to Count (exclusive). This value is only for indexing into the parameter collection in .NET; it is not necessarily connected to the index of positional parameters in a DuckDB SQL statement. Which formal parameter in the SQL statement that the IDbDataParameter object is mapped to depends on ParameterName.

    Property Value
    Type Description
    IDbDataParameter
    Remarks

    That being said, unnamed parameter objects (those with an empty string for ParameterName) will be assigned to increasing indices for positional parameters in the SQL statement when it is executed.

    | Edit this page View Source

    this[string]

    Set (the value of) a parameter keyed by its name.

    Declaration
    public IDbDataParameter this[string parameterName] { get; set; }
    Parameters
    Type Name Description
    string parameterName

    The name of the parameter to set. A parameter object with this name must have been added earlier to this collection.

    Property Value
    Type Description
    IDbDataParameter
    Remarks

    Every parameter is stored with an index within this container, that has no relation with its name (ParameterName). Calling the setter on this property will replace the parameter object, at the index where a current parameter with the given name lives. The new parameter object may have a different name, replacing the old parameter's name (if different). (This behavior is consistent with other implementations of IDataParameterCollection.)

    If the new parameter object being set is unnamed, meaning that ParameterName is an empty string, its name will automatically be set to parameterName.

    | Edit this page View Source

    SyncRoot

    Gets an object that can be used to synchronize access to the ICollection.

    Declaration
    public object SyncRoot { get; }
    Property Value
    Type Description
    object

    An object that can be used to synchronize access to the ICollection.

    Methods

    | Edit this page View Source

    Add(IDbDataParameter)

    Adds an item to the ICollection<T>.

    Declaration
    public void Add(IDbDataParameter value)
    Parameters
    Type Name Description
    IDbDataParameter value
    Exceptions
    Type Condition
    NotSupportedException

    The ICollection<T> is read-only.

    | Edit this page View Source

    Clear()

    Removes all items from the IList.

    Declaration
    public void Clear()
    Exceptions
    Type Condition
    NotSupportedException

    The IList is read-only.

    | Edit this page View Source

    Contains(IDbDataParameter)

    Determines whether the ICollection<T> contains a specific value.

    Declaration
    public bool Contains(IDbDataParameter value)
    Parameters
    Type Name Description
    IDbDataParameter value
    Returns
    Type Description
    bool

    true if item is found in the ICollection<T>; otherwise, false.

    | Edit this page View Source

    Contains(string)

    Gets a value indicating whether a parameter in the collection has the specified name.

    Declaration
    public bool Contains(string parameterName)
    Parameters
    Type Name Description
    string parameterName

    The name of the parameter.

    Returns
    Type Description
    bool

    true if the collection contains the parameter; otherwise, false.

    | Edit this page View Source

    CopyTo(Array, int)

    Copies the elements of the ICollection to an Array, starting at a particular Array index.

    Declaration
    public void CopyTo(Array array, int index)
    Parameters
    Type Name Description
    Array array

    The one-dimensional Array that is the destination of the elements copied from ICollection. The Array must have zero-based indexing.

    int index

    The zero-based index in array at which copying begins.

    Exceptions
    Type Condition
    ArgumentNullException

    array is null.

    ArgumentOutOfRangeException

    index is less than zero.

    ArgumentException
       <code class="paramref">array</code> is multidimensional.  
    

    -or-

    The number of elements in the source ICollection is greater than the available space from index to the end of the destination array.

    -or-

    The type of the source ICollection cannot be cast automatically to the type of the destination array.

    | Edit this page View Source

    CopyTo(IDbDataParameter[], int)

    Copies the elements of the ICollection<T> to an Array, starting at a particular Array index.

    Declaration
    public void CopyTo(IDbDataParameter[] array, int arrayIndex)
    Parameters
    Type Name Description
    IDbDataParameter[] array

    The one-dimensional Array that is the destination of the elements copied from ICollection<T>. The Array must have zero-based indexing.

    int arrayIndex

    The zero-based index in array at which copying begins.

    Exceptions
    Type Condition
    ArgumentNullException

    array is null.

    ArgumentOutOfRangeException

    arrayIndex is less than 0.

    ArgumentException

    The number of elements in the source ICollection<T> is greater than the available space from arrayIndex to the end of the destination array.

    | Edit this page View Source

    IndexOf(IDbDataParameter)

    Determines the index of a specific item in the IList<T>.

    Declaration
    public int IndexOf(IDbDataParameter value)
    Parameters
    Type Name Description
    IDbDataParameter value
    Returns
    Type Description
    int

    The index of item if found in the list; otherwise, -1.

    | Edit this page View Source

    IndexOf(string)

    Gets the location of the IDataParameter within the collection.

    Declaration
    public int IndexOf(string parameterName)
    Parameters
    Type Name Description
    string parameterName

    The name of the parameter.

    Returns
    Type Description
    int

    The zero-based location of the IDataParameter within the collection.

    | Edit this page View Source

    Insert(int, IDbDataParameter)

    Inserts an item to the IList<T> at the specified index.

    Declaration
    public void Insert(int index, IDbDataParameter item)
    Parameters
    Type Name Description
    int index

    The zero-based index at which item should be inserted.

    IDbDataParameter item

    The object to insert into the IList<T>.

    Exceptions
    Type Condition
    ArgumentOutOfRangeException

    index is not a valid index in the IList<T>.

    NotSupportedException

    The IList<T> is read-only.

    | Edit this page View Source

    Remove(IDbDataParameter)

    Removes the first occurrence of a specific object from the ICollection<T>.

    Declaration
    public bool Remove(IDbDataParameter item)
    Parameters
    Type Name Description
    IDbDataParameter item

    The object to remove from the ICollection<T>.

    Returns
    Type Description
    bool

    true if item was successfully removed from the ICollection<T>; otherwise, false. This method also returns false if item is not found in the original ICollection<T>.

    Exceptions
    Type Condition
    NotSupportedException

    The ICollection<T> is read-only.

    | Edit this page View Source

    RemoveAt(int)

    Removes the IList item at the specified index.

    Declaration
    public void RemoveAt(int index)
    Parameters
    Type Name Description
    int index

    The zero-based index of the item to remove.

    Exceptions
    Type Condition
    ArgumentOutOfRangeException

    index is not a valid index in the IList.

    NotSupportedException

    The IList is read-only.

    -or-

    The IList has a fixed size.

    | Edit this page View Source

    RemoveAt(string)

    Removes the IDataParameter from the collection.

    Declaration
    public void RemoveAt(string parameterName)
    Parameters
    Type Name Description
    string parameterName

    The name of the parameter.

    Implements

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