Class BigQueryParameter (2.4.0)

public sealed class BigQueryParameter

A parameter within a SQL query.

Inheritance

Object > BigQueryParameter

Namespace

Google.Cloud.BigQuery.V2

Assembly

Google.Cloud.BigQuery.V2.dll

Remarks

Each parameter has a name, type and value. Names are irrelevant for queries using positional parameters. All scalar types are converted into strings before being passed to the server, but the nature of the conversion depends on the specified type.

The following list shows the correspondence between the parameter type and valid value types. All scalar types may be specified as a string value, which will not be validated or converted on the client, but passed to the API as-is.

  • Bool: System.Boolean
  • Int64: System.Int16, System.Int32, System.Int64, System.UInt16, System.UInt32, System.UInt64
  • Float64: Any type valid for Int64, as well as System.Single and System.Double
  • String: System.String
  • Bytes: System.Byte[]
  • Date: System.DateTime, System.DateTimeOffset
  • DateTime: System.DateTime, System.DateTimeOffset
  • Time: System.DateTime, System.DateTimeOffset, System.TimeSpan
  • Timestamp: System.DateTime, System.DateTimeOffset
  • Numeric: Google.Cloud.BigQuery.V1.BigQueryNumeric
  • Geography: Google.Cloud.BigQuery.V1.BigQueryGeography
  • Array: An IReadOnlyList<T> of any of the above types corresponding to the ArrayElementType, which will be inferred from the value's element type if not otherwise specified.

If the parameter type is null, it is inferred from the value. A TimeSpan value is always assumed to be a Time, a DateTimeOffset value is always assumed to be a Timestamp, and a DateTime value is assumed to be DateTime regardless of its Kind.

If an array parameter doesn't specify the array type, the type is inferred from the type of the value.

Array parameters must not have a value of null, and all the elements must be non-null as well.

If a DateTime value is provided for a Timestamp parameter, the value must have a Kind of Utc.

Struct parameters are currently not supported.

Constructors

BigQueryParameter()

public BigQueryParameter()

Constructs a parameter with no name, initial value or type.

BigQueryParameter(BigQueryDbType)

public BigQueryParameter(BigQueryDbType type)

Constructs a parameter with no name, initial value or type.

Parameter
NameDescription
typeBigQueryDbType

The initial type of the parameter.

BigQueryParameter(Nullable<BigQueryDbType>, Object)

public BigQueryParameter(BigQueryDbType? type, object value)

Constructs a parameter with no name, and the specified type and value.

Parameters
NameDescription
typeNullable<BigQueryDbType>

The initial type of the parameter.

valueObject

The initial value of the parameter.

BigQueryParameter(String)

public BigQueryParameter(string name)

Constructs a parameter with the given name but no initial value or type.

Parameter
NameDescription
nameString

The initial name of the parameter.

BigQueryParameter(String, Nullable<BigQueryDbType>)

public BigQueryParameter(string name, BigQueryDbType? type)

Constructs a parameter with the given name and type, but no initial value.

Parameters
NameDescription
nameString

The initial name of the parameter.

typeNullable<BigQueryDbType>

The initial type of the parameter.

BigQueryParameter(String, Nullable<BigQueryDbType>, Object)

public BigQueryParameter(string name, BigQueryDbType? type, object value)

Constructs a parameter with the given name, type and value.

Parameters
NameDescription
nameString

The initial name of the parameter.

typeNullable<BigQueryDbType>

The initial type of the parameter.

valueObject

The initial value of the parameter.

Properties

ArrayElementType

public BigQueryDbType? ArrayElementType { get; set; }

The type of the nested elements, for array parameters. If this is null, the type is inferred from the value.

Property Value
TypeDescription
Nullable<BigQueryDbType>

Name

public string Name { get; set; }

The name of the parameter. This is irrelevant for positional parameters.

Property Value
TypeDescription
String

Type

public BigQueryDbType? Type { get; set; }

The type of the parameter. If this is null, the type of the parameter is inferred from the value. Otherwise, the value must be of one of the supported types for the parameter type. See the class documentation for details.

Property Value
TypeDescription
Nullable<BigQueryDbType>

Value

public object Value { get; set; }

The value of the parameter. If this is null, the type of the parameter must be specified explicitly.

Property Value
TypeDescription
Object