public sealed class BigQueryParameter
A parameter within a SQL query.
Namespace
Google.Cloud.BigQuery.V2Assembly
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 forInt64
, as well asSystem.Single
andSystem.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
: AnIReadOnlyList<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 | |
---|---|
Name | Description |
type | BigQueryDbType 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 | |
---|---|
Name | Description |
type | Nullable<BigQueryDbType> The initial type of the parameter. |
value | Object 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 | |
---|---|
Name | Description |
name | String 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 | |
---|---|
Name | Description |
name | String The initial name of the parameter. |
type | Nullable<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 | |
---|---|
Name | Description |
name | String The initial name of the parameter. |
type | Nullable<BigQueryDbType> The initial type of the parameter. |
value | Object 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 | |
---|---|
Type | Description |
Nullable<BigQueryDbType> |
Name
public string Name { get; set; }
The name of the parameter. This is irrelevant for positional parameters.
Property Value | |
---|---|
Type | Description |
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 BigQueryParameter for details.
Property Value | |
---|---|
Type | Description |
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 | |
---|---|
Type | Description |
Object |