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