Mallard
Search Results for

    Show / Hide Table of Contents

    Class DuckDbDataReader

    ADO.NET-compatible reader for the results of a query in DuckDB.

    Inheritance
    object
    MarshalByRefObject
    DbDataReader
    DuckDbDataReader
    Implements
    IEnumerable
    IDataReader
    IDataRecord
    IDisposable
    IAsyncDisposable
    Inherited Members
    DbDataReader.CloseAsync()
    DbDataReader.DisposeAsync()
    DbDataReader.GetFieldValueAsync<T>(int)
    DbDataReader.GetFieldValueAsync<T>(int, CancellationToken)
    DbDataReader.GetSchemaTableAsync(CancellationToken)
    DbDataReader.GetColumnSchemaAsync(CancellationToken)
    DbDataReader.IsDBNullAsync(int)
    DbDataReader.IsDBNullAsync(int, CancellationToken)
    DbDataReader.NextResultAsync()
    DbDataReader.NextResultAsync(CancellationToken)
    DbDataReader.ReadAsync()
    DbDataReader.ReadAsync(CancellationToken)
    DbDataReader.VisibleFieldCount
    MarshalByRefObject.GetLifetimeService()
    MarshalByRefObject.InitializeLifetimeService()
    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 DuckDbDataReader : DbDataReader, IEnumerable, IDataReader, IDataRecord, IDisposable, IAsyncDisposable

    Properties

    | Edit this page View Source

    Depth

    Gets a value indicating the depth of nesting for the current row.

    Declaration
    public override int Depth { get; }
    Property Value
    Type Description
    int

    The depth of nesting for the current row.

    Overrides
    DbDataReader.Depth
    | Edit this page View Source

    FieldCount

    When overridden in a derived class, gets the number of columns in the current row.

    Declaration
    public override int FieldCount { get; }
    Property Value
    Type Description
    int

    The number of columns in the current row.

    Overrides
    DbDataReader.FieldCount
    Exceptions
    Type Condition
    NotSupportedException

    There is no current connection to an instance of SQL Server.

    | Edit this page View Source

    HasRows

    When overridden in a derived class, gets a value that indicates whether this DbDataReader contains one or more rows.

    Declaration
    public override bool HasRows { get; }
    Property Value
    Type Description
    bool

    true if the DbDataReader contains one or more rows; otherwise, false.

    Overrides
    DbDataReader.HasRows
    | Edit this page View Source

    IsClosed

    When overridden in a derived class, gets a value indicating whether the DbDataReader is closed.

    Declaration
    public override bool IsClosed { get; }
    Property Value
    Type Description
    bool

    true if the DbDataReader is closed; otherwise, false.

    Overrides
    DbDataReader.IsClosed
    Exceptions
    Type Condition
    InvalidOperationException

    The DbDataReader is closed.

    | Edit this page View Source

    this[int]

    When overridden in a derived class, gets the value of the specified column as an instance of object.

    Declaration
    public override object this[int ordinal] { get; }
    Parameters
    Type Name Description
    int ordinal

    The zero-based column ordinal.

    Property Value
    Type Description
    object

    The value of the specified column.

    Overrides
    DbDataReader.this[int]
    Exceptions
    Type Condition
    IndexOutOfRangeException

    The column index is out of range.

    | Edit this page View Source

    this[string]

    When overridden in a derived class, gets the value of the specified column as an instance of object.

    Declaration
    public override object this[string name] { get; }
    Parameters
    Type Name Description
    string name

    The name of the column.

    Property Value
    Type Description
    object

    The value of the specified column.

    Overrides
    DbDataReader.this[string]
    Exceptions
    Type Condition
    IndexOutOfRangeException

    No column with the specified name was found.

    | Edit this page View Source

    RecordsAffected

    When overridden in a derived class, gets the number of rows changed, inserted, or deleted by execution of the SQL statement.

    Declaration
    public override int RecordsAffected { get; }
    Property Value
    Type Description
    int

    The number of rows changed, inserted, or deleted. -1 for SELECT statements; 0 if no rows were affected or the statement failed.

    Overrides
    DbDataReader.RecordsAffected

    Methods

    | Edit this page View Source

    Close()

    Closes the DbDataReader object.

    Declaration
    public override void Close()
    Overrides
    DbDataReader.Close()
    | Edit this page View Source

    GetBoolean(int)

    When overridden in a derived class, gets the value of the specified column as a Boolean.

    Declaration
    public override bool GetBoolean(int ordinal)
    Parameters
    Type Name Description
    int ordinal

    The zero-based column ordinal.

    Returns
    Type Description
    bool

    The value of the specified column.

    Overrides
    DbDataReader.GetBoolean(int)
    Exceptions
    Type Condition
    IndexOutOfRangeException

    The column index is out of range.

    InvalidCastException

    The specified cast is not valid.

    | Edit this page View Source

    GetByte(int)

    When overridden in a derived class, gets the value of the specified column as a byte.

    Declaration
    public override byte GetByte(int ordinal)
    Parameters
    Type Name Description
    int ordinal

    The zero-based column ordinal.

    Returns
    Type Description
    byte

    The value of the specified column.

    Overrides
    DbDataReader.GetByte(int)
    Exceptions
    Type Condition
    IndexOutOfRangeException

    The column index is out of range.

    InvalidCastException

    The specified cast is not valid.

    | Edit this page View Source

    GetBytes(int, long, byte[]?, int, int)

    When overridden in a derived class, reads a specified number of bytes from the specified column starting at a specified index and writes them to a buffer starting at a specified position in the buffer.

    Declaration
    public override long GetBytes(int ordinal, long dataOffset, byte[]? buffer, int bufferOffset, int length)
    Parameters
    Type Name Description
    int ordinal

    The zero-based column ordinal.

    long dataOffset

    The index within the row from which to begin the read operation.

    byte[] buffer

    The buffer into which to copy the data.

    int bufferOffset

    The index with the buffer to which the data will be copied.

    int length

    The maximum number of bytes to read.

    Returns
    Type Description
    long

    The actual number of bytes read.

    Overrides
    DbDataReader.GetBytes(int, long, byte[], int, int)
    Exceptions
    Type Condition
    IndexOutOfRangeException

    The column index is out of range.

    InvalidCastException

    The specified cast is not valid.

    | Edit this page View Source

    GetChar(int)

    When overridden in a derived class, gets the value of the specified column as a single character.

    Declaration
    public override char GetChar(int ordinal)
    Parameters
    Type Name Description
    int ordinal

    The zero-based column ordinal.

    Returns
    Type Description
    char

    The value of the specified column.

    Overrides
    DbDataReader.GetChar(int)
    Exceptions
    Type Condition
    IndexOutOfRangeException

    The column index is out of range.

    InvalidCastException

    The specified cast is not valid.

    | Edit this page View Source

    GetChars(int, long, char[]?, int, int)

    When overridden in a derived class, reads a specified number of characters from a specified column starting at a specified index, and writes them to a buffer starting at a specified position.

    Declaration
    public override long GetChars(int ordinal, long dataOffset, char[]? buffer, int bufferOffset, int length)
    Parameters
    Type Name Description
    int ordinal

    The zero-based column ordinal.

    long dataOffset

    The index within the row from which to begin the read operation.

    char[] buffer

    The buffer into which to copy the data.

    int bufferOffset

    The index with the buffer to which the data will be copied.

    int length

    The maximum number of characters to read.

    Returns
    Type Description
    long

    The actual number of characters read.

    Overrides
    DbDataReader.GetChars(int, long, char[], int, int)
    | Edit this page View Source

    GetDataTypeName(int)

    When overridden in a derived class, gets name of the data type of the specified column.

    Declaration
    public override string GetDataTypeName(int ordinal)
    Parameters
    Type Name Description
    int ordinal

    The zero-based column ordinal.

    Returns
    Type Description
    string

    The name of the data type.

    Overrides
    DbDataReader.GetDataTypeName(int)
    Exceptions
    Type Condition
    IndexOutOfRangeException

    The column index is out of range.

    | Edit this page View Source

    GetDateTime(int)

    When overridden in a derived class, gets the value of the specified column as a DateTime object.

    Declaration
    public override DateTime GetDateTime(int ordinal)
    Parameters
    Type Name Description
    int ordinal

    The zero-based column ordinal.

    Returns
    Type Description
    DateTime

    The value of the specified column.

    Overrides
    DbDataReader.GetDateTime(int)
    Exceptions
    Type Condition
    IndexOutOfRangeException

    The column index is out of range.

    InvalidCastException

    The specified cast is not valid.

    | Edit this page View Source

    GetDecimal(int)

    When overridden in a derived class, gets the value of the specified column as a decimal.

    Declaration
    public override decimal GetDecimal(int ordinal)
    Parameters
    Type Name Description
    int ordinal

    The zero-based column ordinal.

    Returns
    Type Description
    decimal

    The value of the specified column.

    Overrides
    DbDataReader.GetDecimal(int)
    Exceptions
    Type Condition
    IndexOutOfRangeException

    The column index is out of range.

    InvalidCastException

    The specified cast is not valid.

    | Edit this page View Source

    GetDouble(int)

    When overridden in a derived class, gets the value of the specified column as a double-precision floating point number.

    Declaration
    public override double GetDouble(int ordinal)
    Parameters
    Type Name Description
    int ordinal

    The zero-based column ordinal.

    Returns
    Type Description
    double

    The value of the specified column.

    Overrides
    DbDataReader.GetDouble(int)
    Exceptions
    Type Condition
    InvalidCastException

    The specified cast is not valid.

    | Edit this page View Source

    GetEnumerator()

    When overridden in a derived class, returns an enumerator that can be used to iterate through the rows in the data reader.

    Declaration
    public override IEnumerator GetEnumerator()
    Returns
    Type Description
    IEnumerator

    An enumerator that can be used to iterate through the rows in the data reader.

    Overrides
    System.Data.Common.DbDataReader.GetEnumerator()
    | Edit this page View Source

    GetFieldType(int)

    When overridden in a derived class, gets the data type of the specified column.

    Declaration
    public override Type GetFieldType(int ordinal)
    Parameters
    Type Name Description
    int ordinal

    The zero-based column ordinal.

    Returns
    Type Description
    Type

    The data type of the specified column.

    Overrides
    DbDataReader.GetFieldType(int)
    Exceptions
    Type Condition
    IndexOutOfRangeException

    The column index is out of range.

    InvalidCastException

    The specified cast is not valid.

    | Edit this page View Source

    GetFieldValue<T>(int)

    Gets the value of the specified column as the requested type.

    Declaration
    public override T GetFieldValue<T>(int ordinal)
    Parameters
    Type Name Description
    int ordinal

    The zero-based column ordinal.

    Returns
    Type Description
    T

    The value of the specified column.

    Type Parameters
    Name Description
    T

    The type of the value to be returned.

    Overrides
    DbDataReader.GetFieldValue<T>(int)
    Exceptions
    Type Condition
    InvalidOperationException

    The connection was dropped or closed during data retrieval.

    -or-

    The data reader was closed during data retrieval.

    -or-

    There is no data ready to be read (for example, the first Read() hasn't been called, or it returned false).

    -or-

    The reader tried to read a previously-read column in sequential mode.

    -or-

    There was an asynchronous operation in progress. This applies to all Get* methods when running in sequential mode, as they could be called while reading a stream.

    IndexOutOfRangeException

    The column index is out of range.

    InvalidCastException

    The value returned by the database doesn't match or cannot be cast to T.

    | Edit this page View Source

    GetFloat(int)

    When overridden in a derived class, gets the value of the specified column as a single-precision floating point number.

    Declaration
    public override float GetFloat(int ordinal)
    Parameters
    Type Name Description
    int ordinal

    The zero-based column ordinal.

    Returns
    Type Description
    float

    The value of the specified column.

    Overrides
    DbDataReader.GetFloat(int)
    Exceptions
    Type Condition
    IndexOutOfRangeException

    The column index is out of range.

    InvalidCastException

    The specified cast is not valid.

    | Edit this page View Source

    GetGuid(int)

    When overridden in a derived class, gets the value of the specified column as a globally unique identifier (GUID).

    Declaration
    public override Guid GetGuid(int ordinal)
    Parameters
    Type Name Description
    int ordinal

    The zero-based column ordinal.

    Returns
    Type Description
    Guid

    The value of the specified column.

    Overrides
    DbDataReader.GetGuid(int)
    Exceptions
    Type Condition
    IndexOutOfRangeException

    The column index is out of range.

    InvalidCastException

    The specified cast is not valid.

    | Edit this page View Source

    GetInt16(int)

    When overridden in a derived class, gets the value of the specified column as a 16-bit signed integer.

    Declaration
    public override short GetInt16(int ordinal)
    Parameters
    Type Name Description
    int ordinal

    The zero-based column ordinal.

    Returns
    Type Description
    short

    The value of the specified column.

    Overrides
    DbDataReader.GetInt16(int)
    Exceptions
    Type Condition
    IndexOutOfRangeException

    The column index is out of range.

    InvalidCastException

    The specified cast is not valid.

    | Edit this page View Source

    GetInt32(int)

    When overridden in a derived class, gets the value of the specified column as a 32-bit signed integer.

    Declaration
    public override int GetInt32(int ordinal)
    Parameters
    Type Name Description
    int ordinal

    The zero-based column ordinal.

    Returns
    Type Description
    int

    The value of the specified column.

    Overrides
    DbDataReader.GetInt32(int)
    Exceptions
    Type Condition
    IndexOutOfRangeException

    The column index is out of range.

    InvalidCastException

    The specified cast is not valid.

    | Edit this page View Source

    GetInt64(int)

    When overridden in a derived class, gets the value of the specified column as a 64-bit signed integer.

    Declaration
    public override long GetInt64(int ordinal)
    Parameters
    Type Name Description
    int ordinal

    The zero-based column ordinal.

    Returns
    Type Description
    long

    The value of the specified column.

    Overrides
    DbDataReader.GetInt64(int)
    Exceptions
    Type Condition
    IndexOutOfRangeException

    The column index is out of range.

    InvalidCastException

    The specified cast is not valid.

    | Edit this page View Source

    GetName(int)

    When overridden in a derived class, gets the name of the column, given the zero-based column ordinal.

    Declaration
    public override string GetName(int ordinal)
    Parameters
    Type Name Description
    int ordinal

    The zero-based column ordinal.

    Returns
    Type Description
    string

    The name of the specified column.

    Overrides
    DbDataReader.GetName(int)
    | Edit this page View Source

    GetOrdinal(string)

    When overridden in a derived class, gets the column ordinal given the name of the column.

    Declaration
    public override int GetOrdinal(string name)
    Parameters
    Type Name Description
    string name

    The name of the column.

    Returns
    Type Description
    int

    The zero-based column ordinal.

    Overrides
    DbDataReader.GetOrdinal(string)
    Exceptions
    Type Condition
    IndexOutOfRangeException

    The name specified is not a valid column name.

    | Edit this page View Source

    GetSchemaTable()

    Returns a DataTable that describes the result columns.

    Declaration
    public override DataTable GetSchemaTable()
    Returns
    Type Description
    DataTable

    A DataTable with the columns:

    Overrides
    DbDataReader.GetSchemaTable()
    Remarks

    Implementations of this method in other ADO.NET providers re-query the database to obtain detailed information on the columns such as key constraints. Doing the same is difficult in DuckDB's C API, so this implementation provides basic information only.

    The returned instance is created anew by this method and is not cached.

    | Edit this page View Source

    GetStream(int)

    Gets a stream to retrieve data from the specified column.

    Declaration
    public override Stream GetStream(int ordinal)
    Parameters
    Type Name Description
    int ordinal

    The zero-based column ordinal.

    Returns
    Type Description
    Stream

    A stream.

    Overrides
    DbDataReader.GetStream(int)
    Exceptions
    Type Condition
    InvalidOperationException

    The connection was dropped or closed during the data retrieval.

    -or-

    The data reader is closed during the data retrieval.

    -or-

    There is no data ready to be read (for example, the first Read() hasn't been called, or returned false).

    -or-

    The data reader tried to read a previously-read column in sequential mode.

    -or-

    There was an asynchronous operation in progress. This applies to all Get* methods when running in sequential mode, as they could be called while reading a stream.

    IndexOutOfRangeException

    The column index is out of range.

    InvalidCastException

    The specified column isn't a binary type that supports reading with a Stream.

    | Edit this page View Source

    GetString(int)

    When overridden in a derived class, gets the value of the specified column as an instance of string.

    Declaration
    public override string GetString(int ordinal)
    Parameters
    Type Name Description
    int ordinal

    The zero-based column ordinal.

    Returns
    Type Description
    string

    The value of the specified column.

    Overrides
    DbDataReader.GetString(int)
    Exceptions
    Type Condition
    IndexOutOfRangeException

    The column index is out of range.

    InvalidCastException

    The specified cast is not valid.

    | Edit this page View Source

    GetTextReader(int)

    Gets a text reader to retrieve data from the column.

    Declaration
    public override TextReader GetTextReader(int ordinal)
    Parameters
    Type Name Description
    int ordinal

    The zero-based column ordinal.

    Returns
    Type Description
    TextReader

    A text reader.

    Overrides
    DbDataReader.GetTextReader(int)
    Exceptions
    Type Condition
    InvalidOperationException

    The connection was dropped or closed during the data retrieval.

    -or-

    The data reader is closed during the data retrieval.

    -or-

    There is no data ready to be read (for example, the first Read() hasn't been called, or returned false).

    -or-

    The data reader tried to read a previously-read column in sequential mode.

    -or-

    There was an asynchronous operation in progress. This applies to all Get* methods when running in sequential mode, as they could be called while reading a stream.

    IndexOutOfRangeException

    The column index is out of range.

    InvalidCastException

    The specified column isn't a text type that supports reading with a TextReader.

    | Edit this page View Source

    GetValue(int)

    When overridden in a derived class, gets the value of the specified column as an instance of object.

    Declaration
    public override object GetValue(int ordinal)
    Parameters
    Type Name Description
    int ordinal

    The zero-based column ordinal.

    Returns
    Type Description
    object

    The value of the specified column.

    Overrides
    DbDataReader.GetValue(int)
    Exceptions
    Type Condition
    IndexOutOfRangeException

    The column index is out of range.

    | Edit this page View Source

    GetValues(object[])

    When overridden in a derived class, populates an array of objects with the column values of the current row.

    Declaration
    public override int GetValues(object[] values)
    Parameters
    Type Name Description
    object[] values

    An array of object into which to copy the attribute columns.

    Returns
    Type Description
    int

    The number of instances of object in the array.

    Overrides
    DbDataReader.GetValues(object[])
    | Edit this page View Source

    IsDBNull(int)

    When overridden in a derived class, gets a value that indicates whether the column contains nonexistent or missing values.

    Declaration
    public override bool IsDBNull(int ordinal)
    Parameters
    Type Name Description
    int ordinal

    The zero-based column ordinal.

    Returns
    Type Description
    bool

    true if the specified column is equivalent to DBNull; otherwise, false.

    Overrides
    DbDataReader.IsDBNull(int)
    Exceptions
    Type Condition
    IndexOutOfRangeException

    The column index is out of range.

    | Edit this page View Source

    NextResult()

    When overridden in a derived class, advances the reader to the next result when reading the results of a batch of statements.

    Declaration
    public override bool NextResult()
    Returns
    Type Description
    bool

    true if there are more result sets; otherwise, false.

    Overrides
    DbDataReader.NextResult()
    | Edit this page View Source

    Read()

    When overridden in a derived class, advances the reader to the next record in a result set.

    Declaration
    public override bool Read()
    Returns
    Type Description
    bool

    true if there are more rows; otherwise, false.

    Overrides
    DbDataReader.Read()

    Implements

    IEnumerable
    IDataReader
    IDataRecord
    IDisposable
    IAsyncDisposable
    • Edit this page
    • View Source
    In this article
    Back to top Generated by DocFX