Class DuckDBDataReader
public class DuckDBDataReader : DbDataReader, IEnumerable, IDataReader, IDataRecord, IDisposable, IAsyncDisposable
- Inheritance
-
Duck
DBData Reader
- Implements
- Inherited Members
Properties
Depth
Gets a value indicating the depth of nesting for the current row.
Property Value
- int
The depth of nesting for the current row.
FieldCount
When overridden in a derived class, gets the number of columns in the current row.
Property Value
- int
The number of columns in the current row.
Exceptions
- Not
Supported Exception There is no current connection to an instance of SQL Server.
HasRows
When overridden in a derived class, gets a value that indicates whether this Db
Property Value
- bool
true if the Db
Data contains one or more rows; otherwise, false.Reader
IsClosed
When overridden in a derived class, gets a value indicating whether the Db
Property Value
- bool
true if the Db
Data is closed; otherwise, false.Reader
Exceptions
- Invalid
Operation Exception The Db
Data is closed.Reader
this[int]
When overridden in a derived class, gets the value of the specified column as an instance of object.
Parameters
ordinal
intThe zero-based column ordinal.
Property Value
- object
The value of the specified column.
Exceptions
- Index
Out OfRange Exception The column index is out of range.
this[string]
When overridden in a derived class, gets the value of the specified column as an instance of object.
Parameters
name
stringThe name of the column.
Property Value
- object
The value of the specified column.
Exceptions
- Index
Out OfRange Exception No column with the specified name was found.
RecordsAffected
When overridden in a derived class, gets the number of rows changed, inserted, or deleted by execution of the SQL statement.
Property Value
- int
The number of rows changed, inserted, or deleted. -1 for SELECT statements; 0 if no rows were affected or the statement failed.
Methods
Close()
Closes the Db
GetBoolean(int)
When overridden in a derived class, gets the value of the specified column as a Boolean.
Parameters
ordinal
intThe zero-based column ordinal.
Returns
- bool
The value of the specified column.
Exceptions
- Index
Out OfRange Exception The column index is out of range.
- Invalid
Cast Exception The specified cast is not valid.
GetByte(int)
When overridden in a derived class, gets the value of the specified column as a byte.
Parameters
ordinal
intThe zero-based column ordinal.
Returns
- byte
The value of the specified column.
Exceptions
- Index
Out OfRange Exception The column index is out of range.
- Invalid
Cast Exception The specified cast is not valid.
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.
public override long GetBytes(int ordinal, long dataOffset, byte[]? buffer, int bufferOffset, int length)
Parameters
ordinal
intThe zero-based column ordinal.
dataOffset
longThe index within the row from which to begin the read operation.
buffer
byte[]The buffer into which to copy the data.
bufferOffset
intThe index with the buffer to which the data will be copied.
length
intThe maximum number of bytes to read.
Returns
- long
The actual number of bytes read.
Exceptions
- Index
Out OfRange Exception The column index is out of range.
- Invalid
Cast Exception The specified cast is not valid.
GetChar(int)
When overridden in a derived class, gets the value of the specified column as a single character.
Parameters
ordinal
intThe zero-based column ordinal.
Returns
- char
The value of the specified column.
Exceptions
- Index
Out OfRange Exception The column index is out of range.
- Invalid
Cast Exception The specified cast is not valid.
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.
public override long GetChars(int ordinal, long dataOffset, char[]? buffer, int bufferOffset, int length)
Parameters
ordinal
intThe zero-based column ordinal.
dataOffset
longThe index within the row from which to begin the read operation.
buffer
char[]The buffer into which to copy the data.
bufferOffset
intThe index with the buffer to which the data will be copied.
length
intThe maximum number of characters to read.
Returns
- long
The actual number of characters read.
GetDataTypeName(int)
When overridden in a derived class, gets name of the data type of the specified column.
Parameters
ordinal
intThe zero-based column ordinal.
Returns
- string
The name of the data type.
Exceptions
- Index
Out OfRange Exception The column index is out of range.
GetDateTime(int)
When overridden in a derived class, gets the value of the specified column as a Date
Parameters
ordinal
intThe zero-based column ordinal.
Returns
- Date
Time The value of the specified column.
Exceptions
- Index
Out OfRange Exception The column index is out of range.
- Invalid
Cast Exception The specified cast is not valid.
GetDecimal(int)
When overridden in a derived class, gets the value of the specified column as a decimal.
Parameters
ordinal
intThe zero-based column ordinal.
Returns
- decimal
The value of the specified column.
Exceptions
- Index
Out OfRange Exception The column index is out of range.
- Invalid
Cast Exception The specified cast is not valid.
GetDouble(int)
When overridden in a derived class, gets the value of the specified column as a double-precision floating point number.
Parameters
ordinal
intThe zero-based column ordinal.
Returns
- double
The value of the specified column.
Exceptions
- Invalid
Cast Exception The specified cast is not valid.
GetEnumerator()
When overridden in a derived class, returns an enumerator that can be used to iterate through the rows in the data reader.
Returns
- IEnumerator
An enumerator that can be used to iterate through the rows in the data reader.
GetFieldType(int)
When overridden in a derived class, gets the data type of the specified column.
Parameters
ordinal
intThe zero-based column ordinal.
Returns
- Type
The data type of the specified column.
Exceptions
- Index
Out OfRange Exception The column index is out of range.
- Invalid
Cast Exception The specified cast is not valid.
GetFieldValue<T>(int)
Gets the value of the specified column as the requested type.
Parameters
ordinal
intThe zero-based column ordinal.
Returns
- T
The value of the specified column.
Type Parameters
T
The type of the value to be returned.
Exceptions
- Invalid
Operation Exception 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.
- Index
Out OfRange Exception The column index is out of range.
- Invalid
Cast Exception The value returned by the database doesn't match or cannot be cast to
T
.
GetFloat(int)
When overridden in a derived class, gets the value of the specified column as a single-precision floating point number.
Parameters
ordinal
intThe zero-based column ordinal.
Returns
- float
The value of the specified column.
Exceptions
- Index
Out OfRange Exception The column index is out of range.
- Invalid
Cast Exception The specified cast is not valid.
GetGuid(int)
When overridden in a derived class, gets the value of the specified column as a globally unique identifier (GUID).
Parameters
ordinal
intThe zero-based column ordinal.
Returns
- Guid
The value of the specified column.
Exceptions
- Index
Out OfRange Exception The column index is out of range.
- Invalid
Cast Exception The specified cast is not valid.
GetInt16(int)
When overridden in a derived class, gets the value of the specified column as a 16-bit signed integer.
Parameters
ordinal
intThe zero-based column ordinal.
Returns
- short
The value of the specified column.
Exceptions
- Index
Out OfRange Exception The column index is out of range.
- Invalid
Cast Exception The specified cast is not valid.
GetInt32(int)
When overridden in a derived class, gets the value of the specified column as a 32-bit signed integer.
Parameters
ordinal
intThe zero-based column ordinal.
Returns
- int
The value of the specified column.
Exceptions
- Index
Out OfRange Exception The column index is out of range.
- Invalid
Cast Exception The specified cast is not valid.
GetInt64(int)
When overridden in a derived class, gets the value of the specified column as a 64-bit signed integer.
Parameters
ordinal
intThe zero-based column ordinal.
Returns
- long
The value of the specified column.
Exceptions
- Index
Out OfRange Exception The column index is out of range.
- Invalid
Cast Exception The specified cast is not valid.
GetName(int)
When overridden in a derived class, gets the name of the column, given the zero-based column ordinal.
Parameters
ordinal
intThe zero-based column ordinal.
Returns
- string
The name of the specified column.
GetOrdinal(string)
When overridden in a derived class, gets the column ordinal given the name of the column.
Parameters
name
stringThe name of the column.
Returns
- int
The zero-based column ordinal.
Exceptions
- Index
Out OfRange Exception The name specified is not a valid column name.
GetProviderSpecificFieldType(int)
Gets the provider-specific type of the specified column.
Parameters
ordinal
intThe zero-based column ordinal.
Returns
- Type
A provider-specific .NET type.
Exceptions
- Index
Out OfRange Exception The column index is out of range.
GetProviderSpecificValue(int)
Gets the value of the specified column as an instance of a provider-specific type.
Parameters
ordinal
intThe zero-based column ordinal.
Returns
- object
The value of the specified column.
GetSchemaTable()
Returns a Data
Returns
Exceptions
- Invalid
Operation Exception The Db
Data is closed.Reader - Index
Out OfRange Exception The column index is out of range.
- Not
Supported Exception .NET Core and .NET 5+ only: In all cases.
GetStream(int)
Gets a stream to retrieve data from the specified column.
Parameters
ordinal
intThe zero-based column ordinal.
Returns
- Stream
A stream.
Exceptions
- Invalid
Operation Exception 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.
- Index
Out OfRange Exception The column index is out of range.
- Invalid
Cast Exception The specified column isn't a binary type that supports reading with a Stream.
GetString(int)
When overridden in a derived class, gets the value of the specified column as an instance of string.
Parameters
ordinal
intThe zero-based column ordinal.
Returns
- string
The value of the specified column.
Exceptions
- Index
Out OfRange Exception The column index is out of range.
- Invalid
Cast Exception The specified cast is not valid.
GetValue(int)
When overridden in a derived class, gets the value of the specified column as an instance of object.
Parameters
ordinal
intThe zero-based column ordinal.
Returns
- object
The value of the specified column.
Exceptions
- Index
Out OfRange Exception The column index is out of range.
GetValues(object[])
When overridden in a derived class, populates an array of objects with the column values of the current row.
Parameters
Returns
IsDBNull(int)
When overridden in a derived class, gets a value that indicates whether the column contains nonexistent or missing values.
Parameters
ordinal
intThe zero-based column ordinal.
Returns
Exceptions
- Index
Out OfRange Exception The column index is out of range.
NextResult()
When overridden in a derived class, advances the reader to the next result when reading the results of a batch of statements.
Returns
Read()
When overridden in a derived class, advances the reader to the next record in a result set.