public sealed class SpannerDataReader : DbDataReader, IEnumerable, IDataReader, IDataRecord, IDisposable, IAsyncDisposable
Reference documentation and code samples for the Google.Cloud.Spanner.Data class SpannerDataReader.
Reads a forward-only stream of rows from a data source.
Namespace
Google.Cloud.Spanner.Data
Assembly
Google.Cloud.Spanner.Data.dll
Properties
Depth
public override int Depth { get; }
Property Value |
---|
Type | Description |
int | |
Overrides
FieldCount
public override int FieldCount { get; }
Property Value |
---|
Type | Description |
int | |
Overrides
HasRows
public override bool HasRows { get; }
Gets a value that indicates whether the SpannerDataReader contains one or more rows.
If any rows have been read, this will continue to return true even when there are no more rows.
Property Value |
---|
Type | Description |
bool | |
Overrides
IsClosed
public override bool IsClosed { get; }
Property Value |
---|
Type | Description |
bool | |
Overrides
this[int]
public override object this[int i] { get; }
Parameter |
---|
Name | Description |
i | int
|
Property Value |
---|
Type | Description |
object | |
Overrides
this[string]
public override object this[string name] { get; }
Parameter |
---|
Name | Description |
name | string
|
Property Value |
---|
Type | Description |
object | |
Overrides
RecordsAffected
public override int RecordsAffected { get; }
Property Value |
---|
Type | Description |
int | |
Overrides
Methods
Close()
public override void Close()
Overrides
Dispose(bool)
protected override void Dispose(bool disposing)
Parameter |
---|
Name | Description |
disposing | bool
|
Overrides
GetBoolean(int)
public override bool GetBoolean(int i)
Parameter |
---|
Name | Description |
i | int
|
Returns |
---|
Type | Description |
bool | |
Overrides
GetByte(int)
public override byte GetByte(int i)
Parameter |
---|
Name | Description |
i | int
|
Returns |
---|
Type | Description |
byte | |
Overrides
GetBytes(int, long, byte[], int, int)
public override long GetBytes(int ordinal, long fieldOffset, byte[] buffer, int bufferOffset, int length)
Returns |
---|
Type | Description |
long | |
Overrides
GetChar(int)
public override char GetChar(int i)
Parameter |
---|
Name | Description |
i | int
|
Returns |
---|
Type | Description |
char | |
Overrides
GetChars(int, long, char[], int, int)
public override long GetChars(int i, long fieldoffset, char[] buffer, int bufferoffset, int length)
Returns |
---|
Type | Description |
long | |
Overrides
GetDataTypeName(int)
public override string GetDataTypeName(int i)
Parameter |
---|
Name | Description |
i | int
|
Overrides
GetDateTime(int)
public override DateTime GetDateTime(int i)
Parameter |
---|
Name | Description |
i | int
|
Overrides
GetDecimal(int)
public override decimal GetDecimal(int i)
Parameter |
---|
Name | Description |
i | int
|
Overrides
GetDouble(int)
public override double GetDouble(int i)
Parameter |
---|
Name | Description |
i | int
|
Overrides
GetEnumerator()
public override IEnumerator GetEnumerator()
Overrides
GetFieldType(int)
public override Type GetFieldType(int i)
Parameter |
---|
Name | Description |
i | int
|
Returns |
---|
Type | Description |
Type | |
Overrides
GetFieldValue<T>(int)
public override T GetFieldValue<T>(int ordinal)
Parameter |
---|
Name | Description |
ordinal | int
|
Type Parameter |
---|
Name | Description |
T | |
Overrides
GetFieldValue<T>(string)
public T GetFieldValue<T>(string columnName)
Gets the value of the specified column as type T.
Parameter |
---|
Name | Description |
columnName | string
The name of the column whose value will be returned. Must not be null.
|
Returns |
---|
Type | Description |
T | The value of the column at the current row, converted to type T.
|
Type Parameter |
---|
Name | Description |
T | The expected return type. If possible the return type will be converted to this type.
If conversion is requested between incompatible types, an InvalidOperationException
will be thrown.
If the conversion fails due to the contents returned (for example a string representing a
boolean does not have either 'true' or 'false') then a FormatException exception will be
thrown as documented by the Convert class.
|
GetFloat(int)
public override float GetFloat(int i)
Parameter |
---|
Name | Description |
i | int
|
Returns |
---|
Type | Description |
float | |
Overrides
GetGuid(int)
public override Guid GetGuid(int i)
Parameter |
---|
Name | Description |
i | int
|
Returns |
---|
Type | Description |
Guid | |
Overrides
GetInt16(int)
public override short GetInt16(int i)
Parameter |
---|
Name | Description |
i | int
|
Returns |
---|
Type | Description |
short | |
Overrides
GetInt32(int)
public override int GetInt32(int i)
Parameter |
---|
Name | Description |
i | int
|
Returns |
---|
Type | Description |
int | |
Overrides
GetInt64(int)
public override long GetInt64(int i)
Parameter |
---|
Name | Description |
i | int
|
Returns |
---|
Type | Description |
long | |
Overrides
GetJsonValue(int)
public Value GetJsonValue(int i)
Gets the value of the specified column as a pure Protobuf type.
Parameter |
---|
Name | Description |
i | int
The index of the column whose value will be returned.
|
Returns |
---|
Type | Description |
Value | The raw protobuf as a Value.
|
GetName(int)
public override string GetName(int i)
Parameter |
---|
Name | Description |
i | int
|
Overrides
GetNumeric(int)
public SpannerNumeric GetNumeric(int i)
Gets the value of the specified column as type Google.Cloud.Spanner.V1.SpannerNumeric.
Parameter |
---|
Name | Description |
i | int
The index of the column to retrieve.
|
Returns |
---|
Type | Description |
Google.Cloud.Spanner.V1.SpannerNumeric | The value converted to a Google.Cloud.Spanner.V1.SpannerNumeric.
|
GetOrdinal(string)
public override int GetOrdinal(string name)
Parameter |
---|
Name | Description |
name | string
|
Returns |
---|
Type | Description |
int | |
Overrides
GetOrdinalAsync(string, CancellationToken)
public Task<int> GetOrdinalAsync(string name, CancellationToken cancellationToken = default)
Returns the column ordinal given the name of the column, asynchronously requesting metadata from
the database if necessary.
Parameters |
---|
Name | Description |
name | string
The name of the column.
|
cancellationToken | CancellationToken
A cancellation token to cancel reading metadata. Defaults to None.
|
Returns |
---|
Type | Description |
Taskint | The zero-based column ordinal.
|
GetPgNumeric(int)
public PgNumeric GetPgNumeric(int i)
Gets the value of the specified column as type Google.Cloud.Spanner.V1.PgNumeric.
Parameter |
---|
Name | Description |
i | int
The index of the column to retrieve.
|
Returns |
---|
Type | Description |
Google.Cloud.Spanner.V1.PgNumeric | The value converted to a Google.Cloud.Spanner.V1.PgNumeric.
|
GetReadTimestamp()
public Timestamp GetReadTimestamp()
Remarks
GetReadTimestampAsync(CancellationToken)
public Task<Timestamp> GetReadTimestampAsync(CancellationToken cancellationToken)
GetSchemaTable()
public override DataTable GetSchemaTable()
When enabled, returns the schema of the query as a DataTable. This feature needs
to be enabled in the connection string via the EnableGetSchemaTable property.
Returns |
---|
Type | Description |
DataTable | A DataTable with schema information about the query, or null if the feature
is not enabled in the connection string.
|
Overrides
Remarks
GetSpannerDate(int)
public SpannerDate GetSpannerDate(int i)
Gets the value of the specified column as type Google.Cloud.Spanner.V1.SpannerDate.
Parameter |
---|
Name | Description |
i | int
The index of the column to retrieve.
|
Returns |
---|
Type | Description |
Google.Cloud.Spanner.V1.SpannerDate | The value converted to a Google.Cloud.Spanner.V1.SpannerDate.
|
GetString(int)
public override string GetString(int i)
Parameter |
---|
Name | Description |
i | int
|
Overrides
GetTimestamp(int)
public Timestamp GetTimestamp(int i)
Gets the value of the specified column as type Timestamp.
Parameter |
---|
Name | Description |
i | int
The index of the column to retrieve.
|
GetValue(int)
public override object GetValue(int i)
Parameter |
---|
Name | Description |
i | int
|
Overrides
GetValues(object[])
public override int GetValues(object[] values)
Parameter |
---|
Name | Description |
values | object
|
Returns |
---|
Type | Description |
int | |
Overrides
IsDBNull(int)
public override bool IsDBNull(int i)
Parameter |
---|
Name | Description |
i | int
|
Returns |
---|
Type | Description |
bool | |
Overrides
NextResult()
public override bool NextResult()
Returns |
---|
Type | Description |
bool | |
Overrides
Read()
public override bool Read()
Returns |
---|
Type | Description |
bool | |
Overrides
ReadAsync(CancellationToken)
public override Task<bool> ReadAsync(CancellationToken cancellationToken)
Reads the next row of values from Cloud Spanner.
Important: Cloud Spanner supports limited cancellation of this task.
Parameter |
---|
Name | Description |
cancellationToken | CancellationToken
A cancellation token to cancel the read. Cloud Spanner currently
supports limited cancellation while advancing the read to the next row.
|
Returns |
---|
Type | Description |
Taskbool | True if another row was read.
|
Overrides