com.google.api.services.spanner.v1.model.ExecuteSqlRequest Maven / Gradle / Ivy
/*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
/*
* This code was generated by https://github.com/googleapis/google-api-java-client-services/
* Modify at your own risk.
*/
package com.google.api.services.spanner.v1.model;
/**
* The request for ExecuteSql and ExecuteStreamingSql.
*
* This is the Java data model class that specifies how to parse/serialize into the JSON that is
* transmitted over HTTP when working with the Cloud Spanner API. For a detailed explanation see:
* https://developers.google.com/api-client-library/java/google-http-java-client/json
*
*
* @author Google, Inc.
*/
@SuppressWarnings("javadoc")
public final class ExecuteSqlRequest extends com.google.api.client.json.GenericJson {
/**
* If this is for a partitioned query and this field is set to `true`, the request is executed
* with Spanner Data Boost independent compute resources. If the field is set to `true` but the
* request does not set `partition_token`, the API returns an `INVALID_ARGUMENT` error.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.lang.Boolean dataBoostEnabled;
/**
* Directed read options for this request.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private DirectedReadOptions directedReadOptions;
/**
* It is not always possible for Cloud Spanner to infer the right SQL type from a JSON value. For
* example, values of type `BYTES` and values of type `STRING` both appear in params as JSON
* strings. In these cases, `param_types` can be used to specify the exact SQL type for some or
* all of the SQL statement parameters. See the definition of Type for more information about SQL
* types.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.util.Map paramTypes;
/**
* Parameter names and values that bind to placeholders in the SQL string. A parameter placeholder
* consists of the `@` character followed by the parameter name (for example, `@firstName`).
* Parameter names must conform to the naming requirements of identifiers as specified at
* https://cloud.google.com/spanner/docs/lexical#identifiers. Parameters can appear anywhere that
* a literal value is expected. The same parameter name can be used more than once, for example:
* `"WHERE id > @msg_id AND id < @msg_id + 100"` It is an error to execute a SQL statement with
* unbound parameters.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.util.Map params;
/**
* If present, results will be restricted to the specified partition previously created using
* PartitionQuery(). There must be an exact match for the values of fields common to this message
* and the PartitionQueryRequest message used to create this partition_token.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.lang.String partitionToken;
/**
* Used to control the amount of debugging information returned in ResultSetStats. If
* partition_token is set, query_mode can only be set to QueryMode.NORMAL.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.lang.String queryMode;
/**
* Query optimizer configuration to use for the given query.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private QueryOptions queryOptions;
/**
* Common options for this request.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private RequestOptions requestOptions;
/**
* If this request is resuming a previously interrupted SQL statement execution, `resume_token`
* should be copied from the last PartialResultSet yielded before the interruption. Doing this
* enables the new SQL statement execution to resume where the last one left off. The rest of the
* request parameters must exactly match the request that yielded this token.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.lang.String resumeToken;
/**
* A per-transaction sequence number used to identify this request. This field makes each request
* idempotent such that if the request is received multiple times, at most one will succeed. The
* sequence number must be monotonically increasing within the transaction. If a request arrives
* for the first time with an out-of-order sequence number, the transaction may be aborted.
* Replays of previously handled requests will yield the same response as the first execution.
* Required for DML statements. Ignored for queries.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key @com.google.api.client.json.JsonString
private java.lang.Long seqno;
/**
* Required. The SQL string.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.lang.String sql;
/**
* The transaction to use. For queries, if none is provided, the default is a temporary read-only
* transaction with strong concurrency. Standard DML statements require a read-write transaction.
* To protect against replays, single-use transactions are not supported. The caller must either
* supply an existing transaction ID or begin a new transaction. Partitioned DML requires an
* existing Partitioned DML transaction ID.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private TransactionSelector transaction;
/**
* If this is for a partitioned query and this field is set to `true`, the request is executed
* with Spanner Data Boost independent compute resources. If the field is set to `true` but the
* request does not set `partition_token`, the API returns an `INVALID_ARGUMENT` error.
* @return value or {@code null} for none
*/
public java.lang.Boolean getDataBoostEnabled() {
return dataBoostEnabled;
}
/**
* If this is for a partitioned query and this field is set to `true`, the request is executed
* with Spanner Data Boost independent compute resources. If the field is set to `true` but the
* request does not set `partition_token`, the API returns an `INVALID_ARGUMENT` error.
* @param dataBoostEnabled dataBoostEnabled or {@code null} for none
*/
public ExecuteSqlRequest setDataBoostEnabled(java.lang.Boolean dataBoostEnabled) {
this.dataBoostEnabled = dataBoostEnabled;
return this;
}
/**
* Directed read options for this request.
* @return value or {@code null} for none
*/
public DirectedReadOptions getDirectedReadOptions() {
return directedReadOptions;
}
/**
* Directed read options for this request.
* @param directedReadOptions directedReadOptions or {@code null} for none
*/
public ExecuteSqlRequest setDirectedReadOptions(DirectedReadOptions directedReadOptions) {
this.directedReadOptions = directedReadOptions;
return this;
}
/**
* It is not always possible for Cloud Spanner to infer the right SQL type from a JSON value. For
* example, values of type `BYTES` and values of type `STRING` both appear in params as JSON
* strings. In these cases, `param_types` can be used to specify the exact SQL type for some or
* all of the SQL statement parameters. See the definition of Type for more information about SQL
* types.
* @return value or {@code null} for none
*/
public java.util.Map getParamTypes() {
return paramTypes;
}
/**
* It is not always possible for Cloud Spanner to infer the right SQL type from a JSON value. For
* example, values of type `BYTES` and values of type `STRING` both appear in params as JSON
* strings. In these cases, `param_types` can be used to specify the exact SQL type for some or
* all of the SQL statement parameters. See the definition of Type for more information about SQL
* types.
* @param paramTypes paramTypes or {@code null} for none
*/
public ExecuteSqlRequest setParamTypes(java.util.Map paramTypes) {
this.paramTypes = paramTypes;
return this;
}
/**
* Parameter names and values that bind to placeholders in the SQL string. A parameter placeholder
* consists of the `@` character followed by the parameter name (for example, `@firstName`).
* Parameter names must conform to the naming requirements of identifiers as specified at
* https://cloud.google.com/spanner/docs/lexical#identifiers. Parameters can appear anywhere that
* a literal value is expected. The same parameter name can be used more than once, for example:
* `"WHERE id > @msg_id AND id < @msg_id + 100"` It is an error to execute a SQL statement with
* unbound parameters.
* @return value or {@code null} for none
*/
public java.util.Map getParams() {
return params;
}
/**
* Parameter names and values that bind to placeholders in the SQL string. A parameter placeholder
* consists of the `@` character followed by the parameter name (for example, `@firstName`).
* Parameter names must conform to the naming requirements of identifiers as specified at
* https://cloud.google.com/spanner/docs/lexical#identifiers. Parameters can appear anywhere that
* a literal value is expected. The same parameter name can be used more than once, for example:
* `"WHERE id > @msg_id AND id < @msg_id + 100"` It is an error to execute a SQL statement with
* unbound parameters.
* @param params params or {@code null} for none
*/
public ExecuteSqlRequest setParams(java.util.Map params) {
this.params = params;
return this;
}
/**
* If present, results will be restricted to the specified partition previously created using
* PartitionQuery(). There must be an exact match for the values of fields common to this message
* and the PartitionQueryRequest message used to create this partition_token.
* @see #decodePartitionToken()
* @return value or {@code null} for none
*/
public java.lang.String getPartitionToken() {
return partitionToken;
}
/**
* If present, results will be restricted to the specified partition previously created using
* PartitionQuery(). There must be an exact match for the values of fields common to this message
* and the PartitionQueryRequest message used to create this partition_token.
* @see #getPartitionToken()
* @return Base64 decoded value or {@code null} for none
*
* @since 1.14
*/
public byte[] decodePartitionToken() {
return com.google.api.client.util.Base64.decodeBase64(partitionToken);
}
/**
* If present, results will be restricted to the specified partition previously created using
* PartitionQuery(). There must be an exact match for the values of fields common to this message
* and the PartitionQueryRequest message used to create this partition_token.
* @see #encodePartitionToken()
* @param partitionToken partitionToken or {@code null} for none
*/
public ExecuteSqlRequest setPartitionToken(java.lang.String partitionToken) {
this.partitionToken = partitionToken;
return this;
}
/**
* If present, results will be restricted to the specified partition previously created using
* PartitionQuery(). There must be an exact match for the values of fields common to this message
* and the PartitionQueryRequest message used to create this partition_token.
* @see #setPartitionToken()
*
*
* The value is encoded Base64 or {@code null} for none.
*
*
* @since 1.14
*/
public ExecuteSqlRequest encodePartitionToken(byte[] partitionToken) {
this.partitionToken = com.google.api.client.util.Base64.encodeBase64URLSafeString(partitionToken);
return this;
}
/**
* Used to control the amount of debugging information returned in ResultSetStats. If
* partition_token is set, query_mode can only be set to QueryMode.NORMAL.
* @return value or {@code null} for none
*/
public java.lang.String getQueryMode() {
return queryMode;
}
/**
* Used to control the amount of debugging information returned in ResultSetStats. If
* partition_token is set, query_mode can only be set to QueryMode.NORMAL.
* @param queryMode queryMode or {@code null} for none
*/
public ExecuteSqlRequest setQueryMode(java.lang.String queryMode) {
this.queryMode = queryMode;
return this;
}
/**
* Query optimizer configuration to use for the given query.
* @return value or {@code null} for none
*/
public QueryOptions getQueryOptions() {
return queryOptions;
}
/**
* Query optimizer configuration to use for the given query.
* @param queryOptions queryOptions or {@code null} for none
*/
public ExecuteSqlRequest setQueryOptions(QueryOptions queryOptions) {
this.queryOptions = queryOptions;
return this;
}
/**
* Common options for this request.
* @return value or {@code null} for none
*/
public RequestOptions getRequestOptions() {
return requestOptions;
}
/**
* Common options for this request.
* @param requestOptions requestOptions or {@code null} for none
*/
public ExecuteSqlRequest setRequestOptions(RequestOptions requestOptions) {
this.requestOptions = requestOptions;
return this;
}
/**
* If this request is resuming a previously interrupted SQL statement execution, `resume_token`
* should be copied from the last PartialResultSet yielded before the interruption. Doing this
* enables the new SQL statement execution to resume where the last one left off. The rest of the
* request parameters must exactly match the request that yielded this token.
* @see #decodeResumeToken()
* @return value or {@code null} for none
*/
public java.lang.String getResumeToken() {
return resumeToken;
}
/**
* If this request is resuming a previously interrupted SQL statement execution, `resume_token`
* should be copied from the last PartialResultSet yielded before the interruption. Doing this
* enables the new SQL statement execution to resume where the last one left off. The rest of the
* request parameters must exactly match the request that yielded this token.
* @see #getResumeToken()
* @return Base64 decoded value or {@code null} for none
*
* @since 1.14
*/
public byte[] decodeResumeToken() {
return com.google.api.client.util.Base64.decodeBase64(resumeToken);
}
/**
* If this request is resuming a previously interrupted SQL statement execution, `resume_token`
* should be copied from the last PartialResultSet yielded before the interruption. Doing this
* enables the new SQL statement execution to resume where the last one left off. The rest of the
* request parameters must exactly match the request that yielded this token.
* @see #encodeResumeToken()
* @param resumeToken resumeToken or {@code null} for none
*/
public ExecuteSqlRequest setResumeToken(java.lang.String resumeToken) {
this.resumeToken = resumeToken;
return this;
}
/**
* If this request is resuming a previously interrupted SQL statement execution, `resume_token`
* should be copied from the last PartialResultSet yielded before the interruption. Doing this
* enables the new SQL statement execution to resume where the last one left off. The rest of the
* request parameters must exactly match the request that yielded this token.
* @see #setResumeToken()
*
*
* The value is encoded Base64 or {@code null} for none.
*
*
* @since 1.14
*/
public ExecuteSqlRequest encodeResumeToken(byte[] resumeToken) {
this.resumeToken = com.google.api.client.util.Base64.encodeBase64URLSafeString(resumeToken);
return this;
}
/**
* A per-transaction sequence number used to identify this request. This field makes each request
* idempotent such that if the request is received multiple times, at most one will succeed. The
* sequence number must be monotonically increasing within the transaction. If a request arrives
* for the first time with an out-of-order sequence number, the transaction may be aborted.
* Replays of previously handled requests will yield the same response as the first execution.
* Required for DML statements. Ignored for queries.
* @return value or {@code null} for none
*/
public java.lang.Long getSeqno() {
return seqno;
}
/**
* A per-transaction sequence number used to identify this request. This field makes each request
* idempotent such that if the request is received multiple times, at most one will succeed. The
* sequence number must be monotonically increasing within the transaction. If a request arrives
* for the first time with an out-of-order sequence number, the transaction may be aborted.
* Replays of previously handled requests will yield the same response as the first execution.
* Required for DML statements. Ignored for queries.
* @param seqno seqno or {@code null} for none
*/
public ExecuteSqlRequest setSeqno(java.lang.Long seqno) {
this.seqno = seqno;
return this;
}
/**
* Required. The SQL string.
* @return value or {@code null} for none
*/
public java.lang.String getSql() {
return sql;
}
/**
* Required. The SQL string.
* @param sql sql or {@code null} for none
*/
public ExecuteSqlRequest setSql(java.lang.String sql) {
this.sql = sql;
return this;
}
/**
* The transaction to use. For queries, if none is provided, the default is a temporary read-only
* transaction with strong concurrency. Standard DML statements require a read-write transaction.
* To protect against replays, single-use transactions are not supported. The caller must either
* supply an existing transaction ID or begin a new transaction. Partitioned DML requires an
* existing Partitioned DML transaction ID.
* @return value or {@code null} for none
*/
public TransactionSelector getTransaction() {
return transaction;
}
/**
* The transaction to use. For queries, if none is provided, the default is a temporary read-only
* transaction with strong concurrency. Standard DML statements require a read-write transaction.
* To protect against replays, single-use transactions are not supported. The caller must either
* supply an existing transaction ID or begin a new transaction. Partitioned DML requires an
* existing Partitioned DML transaction ID.
* @param transaction transaction or {@code null} for none
*/
public ExecuteSqlRequest setTransaction(TransactionSelector transaction) {
this.transaction = transaction;
return this;
}
@Override
public ExecuteSqlRequest set(String fieldName, Object value) {
return (ExecuteSqlRequest) super.set(fieldName, value);
}
@Override
public ExecuteSqlRequest clone() {
return (ExecuteSqlRequest) super.clone();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy