Class SpannerParameter
Represents a parameter to a SpannerCommand and optionally its mapping to DataSet columns.
Inherited Members
Namespace: Google.Cloud.Spanner.Data
Assembly: Google.Cloud.Spanner.Data.dll
Syntax
public sealed class SpannerParameter : DbParameter, IDbDataParameter, IDataParameter, ICloneable
Constructors
SpannerParameter()
Initializes a new instance of the SpannerParameter class.
Declaration
public SpannerParameter()
SpannerParameter(string, SpannerDbType, object, string)
Initializes a new instance of the SpannerParameter class.
Declaration
public SpannerParameter(string parameterName, SpannerDbType type, object value = null, string sourceColumn = null)
Parameters
Type | Name | Description |
---|---|---|
string | parameterName | The name of the parameter. For Insert, Update and Delete commands, this name should be the name of a valid column in a Spanner table. In Select commands, this name should be the name of a parameter used in the SQL Query. This value is case sensitive. Must not be null. |
SpannerDbType | type | One of the SpannerDbType values that indicates the type of the parameter. Must not be null. |
object | value | An object that is the value of the SpannerParameter. May be null. |
string | sourceColumn | The name of the DataTable source column (SourceColumn) if this SpannerParameter is used in a call to Update. May be null. |
Properties
CommitTimestamp
Returns a value that will be replaced with a commit timestamp on insert or update. Only suitable for Timestamp values.
Declaration
public static object CommitTimestamp { get; }
Property Value
Type | Description |
---|---|
object |
DbType
Specifies the data type of a field, a property, or a Parameter object of a .NET Framework data provider.
Declaration
public override DbType DbType { get; set; }
Property Value
Type | Description |
---|---|
DbType |
Overrides
Remarks
Using DbType of VarNumeric will always default to SpannerDbType of SpannerNumeric and never to PgNumeric.
Direction
Gets or sets a value that indicates whether the parameter is input-only, output-only, bidirectional, or a stored procedure return value parameter.
Declaration
public override ParameterDirection Direction { get; set; }
Property Value
Type | Description |
---|---|
ParameterDirection | One of the ParameterDirection values. The default is |
Overrides
Exceptions
Type | Condition |
---|---|
ArgumentException | The property is not set to one of the valid ParameterDirection values. |
IsNullable
Gets or sets a value that indicates whether the parameter accepts null values.
Declaration
public override bool IsNullable { get; set; }
Property Value
Type | Description |
---|---|
bool | true if null values are accepted; otherwise false. The default is false. |
Overrides
ParameterName
Gets or sets the name of the DbParameter.
Declaration
public override string ParameterName { get; set; }
Property Value
Type | Description |
---|---|
string | The name of the DbParameter. The default is an empty string (""). |
Overrides
Size
Gets or sets the maximum size, in bytes, of the data within the column.
Declaration
public override int Size { get; set; }
Property Value
Type | Description |
---|---|
int | The maximum size, in bytes, of the data within the column. The default value is inferred from the parameter value. |
Overrides
SourceColumn
Gets or sets the name of the source column mapped to the DataSet and used for loading or returning the Value.
Declaration
public override string SourceColumn { get; set; }
Property Value
Type | Description |
---|---|
string | The name of the source column mapped to the DataSet. The default is an empty string. |
Overrides
SourceColumnNullMapping
Sets or gets a value which indicates whether the source column is nullable. This allows DbCommandBuilder to correctly generate Update statements for nullable columns.
Declaration
public override bool SourceColumnNullMapping { get; set; }
Property Value
Type | Description |
---|---|
bool |
Overrides
SourceVersion
Gets or sets the DataRowVersion to use when you load Value.
Declaration
public override DataRowVersion SourceVersion { get; set; }
Property Value
Type | Description |
---|---|
DataRowVersion | One of the DataRowVersion values. The default is |
Overrides
Exceptions
Type | Condition |
---|---|
ArgumentException | The property is not set to one of the DataRowVersion values. |
SpannerDbType
The SpannerDbType of the parameter or column. This should match the type as defined in Spanner or as defined by the result of a SQL Query.
Declaration
public SpannerDbType SpannerDbType { get; set; }
Property Value
Type | Description |
---|---|
SpannerDbType |
Value
Gets or sets the value of the parameter.
Declaration
public override object Value { get; set; }
Property Value
Type | Description |
---|---|
object | An object that is the value of the parameter. The default value is null. |
Overrides
Methods
Clone()
Creates a new object that is a copy of the current instance.
Declaration
public object Clone()
Returns
Type | Description |
---|---|
object | A new object that is a copy of this instance. |
Implements
ResetDbType()
Resets the DbType property to its original settings.
Declaration
public override void ResetDbType()