public sealed class SpannerDataAdapter : DbDataAdapter, IComponent, IDisposable, ICloneable, IDbDataAdapter, IDataAdapter
Reference documentation and code samples for the Google.Cloud.Spanner.Data class SpannerDataAdapter.
Represents a set of data commands and a database connection that are used to fill the DataSet and update a Spanner database.
Inheritance
object > MarshalByRefObject > Component > DataAdapter > DbDataAdapter > SpannerDataAdapterNamespace
Google.Cloud.Spanner.DataAssembly
Google.Cloud.Spanner.Data.dll
Constructors
SpannerDataAdapter()
public SpannerDataAdapter()
Initializes a new instance of the SpannerDataAdapter class
SpannerDataAdapter(SpannerConnection, string, params string[])
public SpannerDataAdapter(SpannerConnection connection, string autoGeneratedCommandTable, params string[] primaryKeys)
Initializes a new instance of the SpannerDataAdapter class with the specified
Parameters | |
---|---|
Name | Description |
connection | SpannerConnection A connection to the Spanner database. Must not be null. |
autoGeneratedCommandTable | string The Spanner database table to use for automatically generated commands. May be null. |
primaryKeys | string The set of columns that form the primary key for
|
Properties
AutoGeneratedCommandPrimaryKeys
public ISet<string> AutoGeneratedCommandPrimaryKeys { get; }
The set of primary keys defined for AutoGeneratedCommandTable.
Property Value | |
---|---|
Type | Description |
ISetstring |
AutoGeneratedCommandTable
public string AutoGeneratedCommandTable { get; set; }
The table to use for automatically built commands. If set, the SpannerDataAdapter will automatically create commands for SelectCommand, InsertCommand, UpdateCommand and DeleteCommand selecting all columns for that Table. You can choose to customize some or all of the commands and use the autogenerated commands for ones you do not modify. For example, you can set SelectCommand to be a custom SQL Query, and leave the other commands to be based on AutoGeneratedCommandTable
Property Value | |
---|---|
Type | Description |
string |
DeleteCommand
public SpannerCommand DeleteCommand { get; set; }
The SpannerCommand used to delete rows.
Property Value | |
---|---|
Type | Description |
SpannerCommand |
InsertCommand
public SpannerCommand InsertCommand { get; set; }
The SpannerCommand used to insert rows.
Property Value | |
---|---|
Type | Description |
SpannerCommand |
SelectCommand
public SpannerCommand SelectCommand { get; set; }
The SpannerCommand used to run a SQL Query.
Property Value | |
---|---|
Type | Description |
SpannerCommand |
SpannerConnection
public SpannerConnection SpannerConnection { get; set; }
The connection to the Spanner database.
Property Value | |
---|---|
Type | Description |
SpannerConnection |
UpdateCommand
public SpannerCommand UpdateCommand { get; set; }
The SpannerCommand used to update rows.
Property Value | |
---|---|
Type | Description |
SpannerCommand |
Methods
CreateRowUpdatedEvent(DataRow, IDbCommand, StatementType, DataTableMapping)
protected override RowUpdatedEventArgs CreateRowUpdatedEvent(DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)
Initializes a new instance of the RowUpdatedEventArgs class.
Parameters | |
---|---|
Name | Description |
dataRow | DataRow The DataRow used to update the data source. |
command | IDbCommand The IDbCommand executed during the Update(DataSet). |
statementType | StatementType Whether the command is an UPDATE, INSERT, DELETE, or SELECT statement. |
tableMapping | DataTableMapping A DataTableMapping object. |
Returns | |
---|---|
Type | Description |
RowUpdatedEventArgs | A new instance of the RowUpdatedEventArgs class. |
CreateRowUpdatingEvent(DataRow, IDbCommand, StatementType, DataTableMapping)
protected override RowUpdatingEventArgs CreateRowUpdatingEvent(DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)
Initializes a new instance of the RowUpdatingEventArgs class.
Parameters | |
---|---|
Name | Description |
dataRow | DataRow The DataRow that updates the data source. |
command | IDbCommand The IDbCommand to execute during the Update(DataSet). |
statementType | StatementType Whether the command is an UPDATE, INSERT, DELETE, or SELECT statement. |
tableMapping | DataTableMapping A DataTableMapping object. |
Returns | |
---|---|
Type | Description |
RowUpdatingEventArgs | A new instance of the RowUpdatingEventArgs class. |
Fill(DataSet, int, int, string, IDbCommand, CommandBehavior)
protected override int Fill(DataSet dataSet, int startRecord, int maxRecords, string srcTable, IDbCommand command, CommandBehavior behavior)
Adds or refreshes rows in a specified range in the DataSet to match those in the data source using the DataSet and source table names, command string, and command behavior.
Parameters | |
---|---|
Name | Description |
dataSet | DataSet A DataSet to fill with records and, if necessary, schema. |
startRecord | int The zero-based record number to start with. |
maxRecords | int The maximum number of records to retrieve. |
srcTable | string The name of the source table to use for table mapping. |
command | IDbCommand The SQL SELECT statement used to retrieve rows from the data source. |
behavior | CommandBehavior One of the CommandBehavior values. |
Returns | |
---|---|
Type | Description |
int | The number of rows successfully added to or refreshed in the DataSet. This does not include rows affected by statements that do not return rows. |
Exceptions | |
---|---|
Type | Description |
InvalidOperationException | The source table is invalid. |
ArgumentException | The |
Fill(DataSet, string, IDataReader, int, int)
protected override int Fill(DataSet dataSet, string srcTable, IDataReader dataReader, int startRecord, int maxRecords)
Adds or refreshes rows in a specified range in the DataSet to match those in the data source using the DataSet and DataTable names.
Parameters | |
---|---|
Name | Description |
dataSet | DataSet A DataSet to fill with records. |
srcTable | string A string indicating the name of the source table. |
dataReader | IDataReader An instance of IDataReader. |
startRecord | int The zero-based index of the starting record. |
maxRecords | int An integer indicating the maximum number of records. |
Returns | |
---|---|
Type | Description |
int | The number of rows successfully added to or refreshed in the DataSet. This does not include rows affected by statements that do not return rows. |
OnRowUpdated(RowUpdatedEventArgs)
protected override void OnRowUpdated(RowUpdatedEventArgs rowUpdatedEventArgs)
Raises the RowUpdated
event of a .NET Framework data provider.
Parameter | |
---|---|
Name | Description |
rowUpdatedEventArgs | RowUpdatedEventArgs |
OnRowUpdating(RowUpdatingEventArgs)
protected override void OnRowUpdating(RowUpdatingEventArgs rowUpdatingEventArgs)
Raises the RowUpdating
event of a .NET Framework data provider.
Parameter | |
---|---|
Name | Description |
rowUpdatingEventArgs | RowUpdatingEventArgs |
Events
RowUpdated
public event EventHandler<SpannerRowUpdatedEventArgs> RowUpdated
Occurs during Update after a command is executed against the data source.
Event Type | |
---|---|
Type | Description |
EventHandlerSpannerRowUpdatedEventArgs |
RowUpdating
public event EventHandler<SpannerRowUpdatingEventArgs> RowUpdating
Occurs during Update before a command is executed against the data source.
Event Type | |
---|---|
Type | Description |
EventHandlerSpannerRowUpdatingEventArgs |