C# Class Mono.Data.Sqlite.SqliteDataReader

SQLite implementation of DbDataReader.
Inheritance: System.Data.Common.DbDataReader
Show file Open project: rubenv/tripod Class Usage Examples

Public Methods

Method Description
Close ( ) : void

Closes the datareader, potentially closing the connection as well if CommandBehavior.CloseConnection was specified.

GetBoolean ( int i ) : bool

Retrieves the column as a boolean value

GetByte ( int i ) : byte

Retrieves the column as a single byte value

GetBytes ( int i, long fieldOffset, byte buffer, int bufferoffset, int length ) : long

Retrieves a column as an array of bytes (blob)

To determine the number of bytes in the column, pass a null value for the buffer. The total length will be returned.

GetChar ( int i ) : char

Returns the column as a single character

GetChars ( int i, long fieldoffset, char buffer, int bufferoffset, int length ) : long

Retrieves a column as an array of chars (blob)

To determine the number of characters in the column, pass a null value for the buffer. The total length will be returned.

GetDataTypeName ( int i ) : string

Retrieves the name of the back-end datatype of the column

GetDateTime ( int i ) : System.DateTime

Retrieve the column as a date/time value

GetDecimal ( int i ) : decimal

Retrieve the column as a decimal value

GetDouble ( int i ) : double

Returns the column as a double

GetEnumerator ( ) : System.Collections.IEnumerator

Enumerator support

GetFieldType ( int i ) : Type

Returns the .NET type of a given column

GetFloat ( int i ) : float

Returns a column as a float value

GetGuid ( int i ) : System.Guid

Returns the column as a Guid

GetInt16 ( int i ) : Int16

Returns the column as a short

GetInt32 ( int i ) : Int32

Retrieves the column as an int

GetInt64 ( int i ) : System.Int64

Retrieves the column as a long

GetName ( int i ) : string

Retrieves the name of the column

GetOrdinal ( string name ) : int

Retrieves the i of a column, given its name

GetSchemaTable ( ) : DataTable

Schema information in Sqlite is difficult to map into .NET conventions, so a lot of work must be done to gather the necessary information so it can be represented in an ADO.NET manner.

GetString ( int i ) : string

Retrieves the column as a string

GetValue ( int i ) : object

Retrieves the column as an object corresponding to the underlying datatype of the column

GetValues ( object values ) : int

Retreives the values of multiple columns, up to the size of the supplied array

IsDBNull ( int i ) : bool

Returns True if the specified column is null

NextResult ( ) : bool

Moves to the next resultset in multiple row-returning SQL command.

Read ( ) : bool

Reads the next row from the resultset

this ( int i ) : object

Indexer to retrieve data from a column given its i

this ( string name ) : object

Indexer to retrieve data from a column given its name

Protected Methods

Method Description
Dispose ( bool disposing ) : void

Disposes the datareader. Calls Close() to ensure everything is cleaned up.

Private Methods

Method Description
CheckClosed ( ) : void

Throw an error if the datareader is closed

CheckValidRow ( ) : void

Throw an error if a row is not loaded

GetSchemaTable ( bool wantUniqueInfo, bool wantDefaultValue ) : DataTable
GetSqliteType ( int i ) : SqliteType

Retrieves the SqliteType for a given column, and caches it to avoid repetetive interop calls.

LoadKeyInfo ( ) : void
SqliteDataReader ( SqliteCommand cmd, CommandBehavior behave ) : System

Internal constructor, initializes the datareader and sets up to begin executing statements

VerifyType ( int i, DbType typ ) : TypeAffinity

Sqlite is inherently un-typed. All datatypes in Sqlite are natively strings. The definition of the columns of a table and the affinity of returned types are all we have to go on to type-restrict data in the reader. This function attempts to verify that the type of data being requested of a column matches the datatype of the column. In the case of columns that are not backed into a table definition, we attempt to match up the affinity of a column (int, double, string or blob) to a set of known types that closely match that affinity. It's not an exact science, but its the best we can do.

Method Details

Close() public method

Closes the datareader, potentially closing the connection as well if CommandBehavior.CloseConnection was specified.
public Close ( ) : void
return void

Dispose() protected method

Disposes the datareader. Calls Close() to ensure everything is cleaned up.
protected Dispose ( bool disposing ) : void
disposing bool
return void

GetBoolean() public method

Retrieves the column as a boolean value
public GetBoolean ( int i ) : bool
i int The index of the column to retrieve
return bool

GetByte() public method

Retrieves the column as a single byte value
public GetByte ( int i ) : byte
i int The index of the column to retrieve
return byte

GetBytes() public method

Retrieves a column as an array of bytes (blob)
To determine the number of bytes in the column, pass a null value for the buffer. The total length will be returned.
public GetBytes ( int i, long fieldOffset, byte buffer, int bufferoffset, int length ) : long
i int The index of the column to retrieve
fieldOffset long The zero-based index of where to begin reading the data
buffer byte The buffer to write the bytes into
bufferoffset int The zero-based index of where to begin writing into the array
length int The number of bytes to retrieve
return long

GetChar() public method

Returns the column as a single character
public GetChar ( int i ) : char
i int The index of the column to retrieve
return char

GetChars() public method

Retrieves a column as an array of chars (blob)
To determine the number of characters in the column, pass a null value for the buffer. The total length will be returned.
public GetChars ( int i, long fieldoffset, char buffer, int bufferoffset, int length ) : long
i int The index of the column to retrieve
fieldoffset long The zero-based index of where to begin reading the data
buffer char The buffer to write the characters into
bufferoffset int The zero-based index of where to begin writing into the array
length int The number of bytes to retrieve
return long

GetDataTypeName() public method

Retrieves the name of the back-end datatype of the column
public GetDataTypeName ( int i ) : string
i int The index of the column to retrieve
return string

GetDateTime() public method

Retrieve the column as a date/time value
public GetDateTime ( int i ) : System.DateTime
i int The index of the column to retrieve
return System.DateTime

GetDecimal() public method

Retrieve the column as a decimal value
public GetDecimal ( int i ) : decimal
i int The index of the column to retrieve
return decimal

GetDouble() public method

Returns the column as a double
public GetDouble ( int i ) : double
i int The index of the column to retrieve
return double

GetEnumerator() public method

Enumerator support
public GetEnumerator ( ) : System.Collections.IEnumerator
return System.Collections.IEnumerator

GetFieldType() public method

Returns the .NET type of a given column
public GetFieldType ( int i ) : Type
i int The index of the column to retrieve
return System.Type

GetFloat() public method

Returns a column as a float value
public GetFloat ( int i ) : float
i int The index of the column to retrieve
return float

GetGuid() public method

Returns the column as a Guid
public GetGuid ( int i ) : System.Guid
i int The index of the column to retrieve
return System.Guid

GetInt16() public method

Returns the column as a short
public GetInt16 ( int i ) : Int16
i int The index of the column to retrieve
return System.Int16

GetInt32() public method

Retrieves the column as an int
public GetInt32 ( int i ) : Int32
i int The index of the column to retrieve
return System.Int32

GetInt64() public method

Retrieves the column as a long
public GetInt64 ( int i ) : System.Int64
i int The index of the column to retrieve
return System.Int64

GetName() public method

Retrieves the name of the column
public GetName ( int i ) : string
i int The index of the column to retrieve
return string

GetOrdinal() public method

Retrieves the i of a column, given its name
public GetOrdinal ( string name ) : int
name string The name of the column to retrieve
return int

GetSchemaTable() public method

Schema information in Sqlite is difficult to map into .NET conventions, so a lot of work must be done to gather the necessary information so it can be represented in an ADO.NET manner.
public GetSchemaTable ( ) : DataTable
return System.Data.DataTable

GetString() public method

Retrieves the column as a string
public GetString ( int i ) : string
i int The index of the column to retrieve
return string

GetValue() public method

Retrieves the column as an object corresponding to the underlying datatype of the column
public GetValue ( int i ) : object
i int The index of the column to retrieve
return object

GetValues() public method

Retreives the values of multiple columns, up to the size of the supplied array
public GetValues ( object values ) : int
values object The array to fill with values from the columns in the current resultset
return int

IsDBNull() public method

Returns True if the specified column is null
public IsDBNull ( int i ) : bool
i int The index of the column to retrieve
return bool

NextResult() public method

Moves to the next resultset in multiple row-returning SQL command.
public NextResult ( ) : bool
return bool

Read() public method

Reads the next row from the resultset
public Read ( ) : bool
return bool

this() public method

Indexer to retrieve data from a column given its i
public this ( int i ) : object
i int The index of the column to retrieve
return object

this() public method

Indexer to retrieve data from a column given its name
public this ( string name ) : object
name string The name of the column to retrieve data for
return object