From a249d9564d8c27ab4439abc6562d7f3b9b7f655d Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Wed, 6 Mar 2019 00:52:00 -0800 Subject: [PATCH] Regenerate spanner client --- .../com/google/spanner/v1/SpannerGrpc.java | 218 +- .../spanner/v1/ExecuteBatchDmlRequest.java | 3128 +++++++++++++++++ .../v1/ExecuteBatchDmlRequestOrBuilder.java | 154 + .../spanner/v1/ExecuteBatchDmlResponse.java | 1333 +++++++ .../v1/ExecuteBatchDmlResponseOrBuilder.java | 120 + .../com/google/spanner/v1/SpannerProto.java | 347 +- .../proto/google/spanner/v1/spanner.proto | 125 +- .../database/v1/DatabaseAdminClient.java | 4 +- .../instance/v1/InstanceAdminClient.java | 7 +- .../cloud/spanner/v1/SpannerClient.java | 108 +- .../cloud/spanner/v1/SpannerSettings.java | 14 + .../spanner/v1/stub/GrpcSpannerStub.java | 26 + .../cloud/spanner/v1/stub/SpannerStub.java | 6 + .../spanner/v1/stub/SpannerStubSettings.java | 29 + .../cloud/spanner/v1/MockSpannerImpl.java | 17 + .../google-cloud-spanner/synth.metadata | 10 +- 16 files changed, 5482 insertions(+), 164 deletions(-) create mode 100644 google-api-grpc/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ExecuteBatchDmlRequest.java create mode 100644 google-api-grpc/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ExecuteBatchDmlRequestOrBuilder.java create mode 100644 google-api-grpc/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ExecuteBatchDmlResponse.java create mode 100644 google-api-grpc/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ExecuteBatchDmlResponseOrBuilder.java diff --git a/google-api-grpc/grpc-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/SpannerGrpc.java b/google-api-grpc/grpc-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/SpannerGrpc.java index 723de5ed800f..b972e19f5dc4 100644 --- a/google-api-grpc/grpc-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/SpannerGrpc.java +++ b/google-api-grpc/grpc-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/SpannerGrpc.java @@ -325,6 +325,61 @@ private SpannerGrpc() {} return getExecuteStreamingSqlMethod; } + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + @java.lang.Deprecated // Use {@link #getExecuteBatchDmlMethod()} instead. + public static final io.grpc.MethodDescriptor< + com.google.spanner.v1.ExecuteBatchDmlRequest, + com.google.spanner.v1.ExecuteBatchDmlResponse> + METHOD_EXECUTE_BATCH_DML = getExecuteBatchDmlMethodHelper(); + + private static volatile io.grpc.MethodDescriptor< + com.google.spanner.v1.ExecuteBatchDmlRequest, + com.google.spanner.v1.ExecuteBatchDmlResponse> + getExecuteBatchDmlMethod; + + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + public static io.grpc.MethodDescriptor< + com.google.spanner.v1.ExecuteBatchDmlRequest, + com.google.spanner.v1.ExecuteBatchDmlResponse> + getExecuteBatchDmlMethod() { + return getExecuteBatchDmlMethodHelper(); + } + + private static io.grpc.MethodDescriptor< + com.google.spanner.v1.ExecuteBatchDmlRequest, + com.google.spanner.v1.ExecuteBatchDmlResponse> + getExecuteBatchDmlMethodHelper() { + io.grpc.MethodDescriptor< + com.google.spanner.v1.ExecuteBatchDmlRequest, + com.google.spanner.v1.ExecuteBatchDmlResponse> + getExecuteBatchDmlMethod; + if ((getExecuteBatchDmlMethod = SpannerGrpc.getExecuteBatchDmlMethod) == null) { + synchronized (SpannerGrpc.class) { + if ((getExecuteBatchDmlMethod = SpannerGrpc.getExecuteBatchDmlMethod) == null) { + SpannerGrpc.getExecuteBatchDmlMethod = + getExecuteBatchDmlMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + generateFullMethodName("google.spanner.v1.Spanner", "ExecuteBatchDml")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.spanner.v1.ExecuteBatchDmlRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.spanner.v1.ExecuteBatchDmlResponse.getDefaultInstance())) + .setSchemaDescriptor(new SpannerMethodDescriptorSupplier("ExecuteBatchDml")) + .build(); + } + } + } + return getExecuteBatchDmlMethod; + } + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") @java.lang.Deprecated // Use {@link #getReadMethod()} instead. public static final io.grpc.MethodDescriptor< @@ -757,7 +812,9 @@ public void listSessions( * * *
-     * Ends a session, releasing server resources associated with it.
+     * Ends a session, releasing server resources associated with it. This will
+     * asynchronously trigger cancellation of any operations that are running with
+     * this session.
      * 
*/ public void deleteSession( @@ -806,6 +863,35 @@ public void executeStreamingSql( asyncUnimplementedUnaryCall(getExecuteStreamingSqlMethodHelper(), responseObserver); } + /** + * + * + *
+     * Executes a batch of SQL DML statements. This method allows many statements
+     * to be run with lower latency than submitting them sequentially with
+     * [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql].
+     * Statements are executed in order, sequentially.
+     * [ExecuteBatchDmlResponse][Spanner.ExecuteBatchDmlResponse] will contain a
+     * [ResultSet][google.spanner.v1.ResultSet] for each DML statement that has successfully executed. If a
+     * statement fails, its error status will be returned as part of the
+     * [ExecuteBatchDmlResponse][Spanner.ExecuteBatchDmlResponse]. Execution will
+     * stop at the first failed statement; the remaining statements will not run.
+     * ExecuteBatchDml is expected to return an OK status with a response even if
+     * there was an error while processing one of the DML statements. Clients must
+     * inspect response.status to determine if there were any errors while
+     * processing the request.
+     * See more details in
+     * [ExecuteBatchDmlRequest][Spanner.ExecuteBatchDmlRequest] and
+     * [ExecuteBatchDmlResponse][Spanner.ExecuteBatchDmlResponse].
+     * 
+ */ + public void executeBatchDml( + com.google.spanner.v1.ExecuteBatchDmlRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + asyncUnimplementedUnaryCall(getExecuteBatchDmlMethodHelper(), responseObserver); + } + /** * * @@ -991,6 +1077,13 @@ public final io.grpc.ServerServiceDefinition bindService() { com.google.spanner.v1.ExecuteSqlRequest, com.google.spanner.v1.PartialResultSet>( this, METHODID_EXECUTE_STREAMING_SQL))) + .addMethod( + getExecuteBatchDmlMethodHelper(), + asyncUnaryCall( + new MethodHandlers< + com.google.spanner.v1.ExecuteBatchDmlRequest, + com.google.spanner.v1.ExecuteBatchDmlResponse>( + this, METHODID_EXECUTE_BATCH_DML))) .addMethod( getReadMethodHelper(), asyncUnaryCall( @@ -1129,7 +1222,9 @@ public void listSessions( * * *
-     * Ends a session, releasing server resources associated with it.
+     * Ends a session, releasing server resources associated with it. This will
+     * asynchronously trigger cancellation of any operations that are running with
+     * this session.
      * 
*/ public void deleteSession( @@ -1187,6 +1282,38 @@ public void executeStreamingSql( responseObserver); } + /** + * + * + *
+     * Executes a batch of SQL DML statements. This method allows many statements
+     * to be run with lower latency than submitting them sequentially with
+     * [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql].
+     * Statements are executed in order, sequentially.
+     * [ExecuteBatchDmlResponse][Spanner.ExecuteBatchDmlResponse] will contain a
+     * [ResultSet][google.spanner.v1.ResultSet] for each DML statement that has successfully executed. If a
+     * statement fails, its error status will be returned as part of the
+     * [ExecuteBatchDmlResponse][Spanner.ExecuteBatchDmlResponse]. Execution will
+     * stop at the first failed statement; the remaining statements will not run.
+     * ExecuteBatchDml is expected to return an OK status with a response even if
+     * there was an error while processing one of the DML statements. Clients must
+     * inspect response.status to determine if there were any errors while
+     * processing the request.
+     * See more details in
+     * [ExecuteBatchDmlRequest][Spanner.ExecuteBatchDmlRequest] and
+     * [ExecuteBatchDmlResponse][Spanner.ExecuteBatchDmlResponse].
+     * 
+ */ + public void executeBatchDml( + com.google.spanner.v1.ExecuteBatchDmlRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + asyncUnaryCall( + getChannel().newCall(getExecuteBatchDmlMethodHelper(), getCallOptions()), + request, + responseObserver); + } + /** * * @@ -1436,7 +1563,9 @@ public com.google.spanner.v1.ListSessionsResponse listSessions( * * *
-     * Ends a session, releasing server resources associated with it.
+     * Ends a session, releasing server resources associated with it. This will
+     * asynchronously trigger cancellation of any operations that are running with
+     * this session.
      * 
*/ public com.google.protobuf.Empty deleteSession( @@ -1485,6 +1614,34 @@ public java.util.Iterator executeStreami getChannel(), getExecuteStreamingSqlMethodHelper(), getCallOptions(), request); } + /** + * + * + *
+     * Executes a batch of SQL DML statements. This method allows many statements
+     * to be run with lower latency than submitting them sequentially with
+     * [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql].
+     * Statements are executed in order, sequentially.
+     * [ExecuteBatchDmlResponse][Spanner.ExecuteBatchDmlResponse] will contain a
+     * [ResultSet][google.spanner.v1.ResultSet] for each DML statement that has successfully executed. If a
+     * statement fails, its error status will be returned as part of the
+     * [ExecuteBatchDmlResponse][Spanner.ExecuteBatchDmlResponse]. Execution will
+     * stop at the first failed statement; the remaining statements will not run.
+     * ExecuteBatchDml is expected to return an OK status with a response even if
+     * there was an error while processing one of the DML statements. Clients must
+     * inspect response.status to determine if there were any errors while
+     * processing the request.
+     * See more details in
+     * [ExecuteBatchDmlRequest][Spanner.ExecuteBatchDmlRequest] and
+     * [ExecuteBatchDmlResponse][Spanner.ExecuteBatchDmlResponse].
+     * 
+ */ + public com.google.spanner.v1.ExecuteBatchDmlResponse executeBatchDml( + com.google.spanner.v1.ExecuteBatchDmlRequest request) { + return blockingUnaryCall( + getChannel(), getExecuteBatchDmlMethodHelper(), getCallOptions(), request); + } + /** * * @@ -1710,7 +1867,9 @@ protected SpannerFutureStub build(io.grpc.Channel channel, io.grpc.CallOptions c * * *
-     * Ends a session, releasing server resources associated with it.
+     * Ends a session, releasing server resources associated with it. This will
+     * asynchronously trigger cancellation of any operations that are running with
+     * this session.
      * 
*/ public com.google.common.util.concurrent.ListenableFuture @@ -1742,6 +1901,35 @@ protected SpannerFutureStub build(io.grpc.Channel channel, io.grpc.CallOptions c getChannel().newCall(getExecuteSqlMethodHelper(), getCallOptions()), request); } + /** + * + * + *
+     * Executes a batch of SQL DML statements. This method allows many statements
+     * to be run with lower latency than submitting them sequentially with
+     * [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql].
+     * Statements are executed in order, sequentially.
+     * [ExecuteBatchDmlResponse][Spanner.ExecuteBatchDmlResponse] will contain a
+     * [ResultSet][google.spanner.v1.ResultSet] for each DML statement that has successfully executed. If a
+     * statement fails, its error status will be returned as part of the
+     * [ExecuteBatchDmlResponse][Spanner.ExecuteBatchDmlResponse]. Execution will
+     * stop at the first failed statement; the remaining statements will not run.
+     * ExecuteBatchDml is expected to return an OK status with a response even if
+     * there was an error while processing one of the DML statements. Clients must
+     * inspect response.status to determine if there were any errors while
+     * processing the request.
+     * See more details in
+     * [ExecuteBatchDmlRequest][Spanner.ExecuteBatchDmlRequest] and
+     * [ExecuteBatchDmlResponse][Spanner.ExecuteBatchDmlResponse].
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.spanner.v1.ExecuteBatchDmlResponse> + executeBatchDml(com.google.spanner.v1.ExecuteBatchDmlRequest request) { + return futureUnaryCall( + getChannel().newCall(getExecuteBatchDmlMethodHelper(), getCallOptions()), request); + } + /** * * @@ -1879,13 +2067,14 @@ public com.google.common.util.concurrent.ListenableFuture implements io.grpc.stub.ServerCalls.UnaryMethod, @@ -1936,6 +2125,12 @@ public void invoke(Req request, io.grpc.stub.StreamObserver responseObserv (io.grpc.stub.StreamObserver) responseObserver); break; + case METHODID_EXECUTE_BATCH_DML: + serviceImpl.executeBatchDml( + (com.google.spanner.v1.ExecuteBatchDmlRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; case METHODID_READ: serviceImpl.read( (com.google.spanner.v1.ReadRequest) request, @@ -2042,6 +2237,7 @@ public static io.grpc.ServiceDescriptor getServiceDescriptor() { .addMethod(getDeleteSessionMethodHelper()) .addMethod(getExecuteSqlMethodHelper()) .addMethod(getExecuteStreamingSqlMethodHelper()) + .addMethod(getExecuteBatchDmlMethodHelper()) .addMethod(getReadMethodHelper()) .addMethod(getStreamingReadMethodHelper()) .addMethod(getBeginTransactionMethodHelper()) diff --git a/google-api-grpc/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ExecuteBatchDmlRequest.java b/google-api-grpc/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ExecuteBatchDmlRequest.java new file mode 100644 index 000000000000..5832f27b8f19 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ExecuteBatchDmlRequest.java @@ -0,0 +1,3128 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/spanner/v1/spanner.proto + +package com.google.spanner.v1; + +/** + * + * + *
+ * The request for [ExecuteBatchDml][google.spanner.v1.Spanner.ExecuteBatchDml]
+ * 
+ * + * Protobuf type {@code google.spanner.v1.ExecuteBatchDmlRequest} + */ +public final class ExecuteBatchDmlRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.spanner.v1.ExecuteBatchDmlRequest) + ExecuteBatchDmlRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use ExecuteBatchDmlRequest.newBuilder() to construct. + private ExecuteBatchDmlRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ExecuteBatchDmlRequest() { + session_ = ""; + statements_ = java.util.Collections.emptyList(); + seqno_ = 0L; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ExecuteBatchDmlRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + session_ = s; + break; + } + case 18: + { + com.google.spanner.v1.TransactionSelector.Builder subBuilder = null; + if (transaction_ != null) { + subBuilder = transaction_.toBuilder(); + } + transaction_ = + input.readMessage( + com.google.spanner.v1.TransactionSelector.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(transaction_); + transaction_ = subBuilder.buildPartial(); + } + + break; + } + case 26: + { + if (!((mutable_bitField0_ & 0x00000004) == 0x00000004)) { + statements_ = + new java.util.ArrayList< + com.google.spanner.v1.ExecuteBatchDmlRequest.Statement>(); + mutable_bitField0_ |= 0x00000004; + } + statements_.add( + input.readMessage( + com.google.spanner.v1.ExecuteBatchDmlRequest.Statement.parser(), + extensionRegistry)); + break; + } + case 32: + { + seqno_ = input.readInt64(); + break; + } + default: + { + if (!parseUnknownFieldProto3(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000004) == 0x00000004)) { + statements_ = java.util.Collections.unmodifiableList(statements_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.spanner.v1.SpannerProto + .internal_static_google_spanner_v1_ExecuteBatchDmlRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.spanner.v1.SpannerProto + .internal_static_google_spanner_v1_ExecuteBatchDmlRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.spanner.v1.ExecuteBatchDmlRequest.class, + com.google.spanner.v1.ExecuteBatchDmlRequest.Builder.class); + } + + public interface StatementOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.spanner.v1.ExecuteBatchDmlRequest.Statement) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+     * Required. The DML string.
+     * 
+ * + * string sql = 1; + */ + java.lang.String getSql(); + /** + * + * + *
+     * Required. The DML string.
+     * 
+ * + * string sql = 1; + */ + com.google.protobuf.ByteString getSqlBytes(); + + /** + * + * + *
+     * The DML string can contain parameter placeholders. A parameter
+     * placeholder consists of `'@'` followed by the parameter
+     * name. Parameter names consist of any combination of letters,
+     * numbers, and underscores.
+     * 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 an SQL statement with unbound parameters.
+     * Parameter values are specified using `params`, which is a JSON
+     * object whose keys are parameter names, and whose values are the
+     * corresponding parameter values.
+     * 
+ * + * .google.protobuf.Struct params = 2; + */ + boolean hasParams(); + /** + * + * + *
+     * The DML string can contain parameter placeholders. A parameter
+     * placeholder consists of `'@'` followed by the parameter
+     * name. Parameter names consist of any combination of letters,
+     * numbers, and underscores.
+     * 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 an SQL statement with unbound parameters.
+     * Parameter values are specified using `params`, which is a JSON
+     * object whose keys are parameter names, and whose values are the
+     * corresponding parameter values.
+     * 
+ * + * .google.protobuf.Struct params = 2; + */ + com.google.protobuf.Struct getParams(); + /** + * + * + *
+     * The DML string can contain parameter placeholders. A parameter
+     * placeholder consists of `'@'` followed by the parameter
+     * name. Parameter names consist of any combination of letters,
+     * numbers, and underscores.
+     * 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 an SQL statement with unbound parameters.
+     * Parameter values are specified using `params`, which is a JSON
+     * object whose keys are parameter names, and whose values are the
+     * corresponding parameter values.
+     * 
+ * + * .google.protobuf.Struct params = 2; + */ + com.google.protobuf.StructOrBuilder getParamsOrBuilder(); + + /** + * + * + *
+     * 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][google.spanner.v1.ExecuteBatchDmlRequest.Statement.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][google.spanner.v1.Type] for more information
+     * about SQL types.
+     * 
+ * + * map<string, .google.spanner.v1.Type> param_types = 3; + */ + int getParamTypesCount(); + /** + * + * + *
+     * 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][google.spanner.v1.ExecuteBatchDmlRequest.Statement.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][google.spanner.v1.Type] for more information
+     * about SQL types.
+     * 
+ * + * map<string, .google.spanner.v1.Type> param_types = 3; + */ + boolean containsParamTypes(java.lang.String key); + /** Use {@link #getParamTypesMap()} instead. */ + @java.lang.Deprecated + java.util.Map getParamTypes(); + /** + * + * + *
+     * 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][google.spanner.v1.ExecuteBatchDmlRequest.Statement.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][google.spanner.v1.Type] for more information
+     * about SQL types.
+     * 
+ * + * map<string, .google.spanner.v1.Type> param_types = 3; + */ + java.util.Map getParamTypesMap(); + /** + * + * + *
+     * 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][google.spanner.v1.ExecuteBatchDmlRequest.Statement.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][google.spanner.v1.Type] for more information
+     * about SQL types.
+     * 
+ * + * map<string, .google.spanner.v1.Type> param_types = 3; + */ + com.google.spanner.v1.Type getParamTypesOrDefault( + java.lang.String key, com.google.spanner.v1.Type defaultValue); + /** + * + * + *
+     * 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][google.spanner.v1.ExecuteBatchDmlRequest.Statement.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][google.spanner.v1.Type] for more information
+     * about SQL types.
+     * 
+ * + * map<string, .google.spanner.v1.Type> param_types = 3; + */ + com.google.spanner.v1.Type getParamTypesOrThrow(java.lang.String key); + } + /** + * + * + *
+   * A single DML statement.
+   * 
+ * + * Protobuf type {@code google.spanner.v1.ExecuteBatchDmlRequest.Statement} + */ + public static final class Statement extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.spanner.v1.ExecuteBatchDmlRequest.Statement) + StatementOrBuilder { + private static final long serialVersionUID = 0L; + // Use Statement.newBuilder() to construct. + private Statement(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private Statement() { + sql_ = ""; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private Statement( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + sql_ = s; + break; + } + case 18: + { + com.google.protobuf.Struct.Builder subBuilder = null; + if (params_ != null) { + subBuilder = params_.toBuilder(); + } + params_ = input.readMessage(com.google.protobuf.Struct.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(params_); + params_ = subBuilder.buildPartial(); + } + + break; + } + case 26: + { + if (!((mutable_bitField0_ & 0x00000004) == 0x00000004)) { + paramTypes_ = + com.google.protobuf.MapField.newMapField( + ParamTypesDefaultEntryHolder.defaultEntry); + mutable_bitField0_ |= 0x00000004; + } + com.google.protobuf.MapEntry + paramTypes__ = + input.readMessage( + ParamTypesDefaultEntryHolder.defaultEntry.getParserForType(), + extensionRegistry); + paramTypes_.getMutableMap().put(paramTypes__.getKey(), paramTypes__.getValue()); + break; + } + default: + { + if (!parseUnknownFieldProto3(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.spanner.v1.SpannerProto + .internal_static_google_spanner_v1_ExecuteBatchDmlRequest_Statement_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + @java.lang.Override + protected com.google.protobuf.MapField internalGetMapField(int number) { + switch (number) { + case 3: + return internalGetParamTypes(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.spanner.v1.SpannerProto + .internal_static_google_spanner_v1_ExecuteBatchDmlRequest_Statement_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.spanner.v1.ExecuteBatchDmlRequest.Statement.class, + com.google.spanner.v1.ExecuteBatchDmlRequest.Statement.Builder.class); + } + + private int bitField0_; + public static final int SQL_FIELD_NUMBER = 1; + private volatile java.lang.Object sql_; + /** + * + * + *
+     * Required. The DML string.
+     * 
+ * + * string sql = 1; + */ + public java.lang.String getSql() { + java.lang.Object ref = sql_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + sql_ = s; + return s; + } + } + /** + * + * + *
+     * Required. The DML string.
+     * 
+ * + * string sql = 1; + */ + public com.google.protobuf.ByteString getSqlBytes() { + java.lang.Object ref = sql_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + sql_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PARAMS_FIELD_NUMBER = 2; + private com.google.protobuf.Struct params_; + /** + * + * + *
+     * The DML string can contain parameter placeholders. A parameter
+     * placeholder consists of `'@'` followed by the parameter
+     * name. Parameter names consist of any combination of letters,
+     * numbers, and underscores.
+     * 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 an SQL statement with unbound parameters.
+     * Parameter values are specified using `params`, which is a JSON
+     * object whose keys are parameter names, and whose values are the
+     * corresponding parameter values.
+     * 
+ * + * .google.protobuf.Struct params = 2; + */ + public boolean hasParams() { + return params_ != null; + } + /** + * + * + *
+     * The DML string can contain parameter placeholders. A parameter
+     * placeholder consists of `'@'` followed by the parameter
+     * name. Parameter names consist of any combination of letters,
+     * numbers, and underscores.
+     * 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 an SQL statement with unbound parameters.
+     * Parameter values are specified using `params`, which is a JSON
+     * object whose keys are parameter names, and whose values are the
+     * corresponding parameter values.
+     * 
+ * + * .google.protobuf.Struct params = 2; + */ + public com.google.protobuf.Struct getParams() { + return params_ == null ? com.google.protobuf.Struct.getDefaultInstance() : params_; + } + /** + * + * + *
+     * The DML string can contain parameter placeholders. A parameter
+     * placeholder consists of `'@'` followed by the parameter
+     * name. Parameter names consist of any combination of letters,
+     * numbers, and underscores.
+     * 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 an SQL statement with unbound parameters.
+     * Parameter values are specified using `params`, which is a JSON
+     * object whose keys are parameter names, and whose values are the
+     * corresponding parameter values.
+     * 
+ * + * .google.protobuf.Struct params = 2; + */ + public com.google.protobuf.StructOrBuilder getParamsOrBuilder() { + return getParams(); + } + + public static final int PARAM_TYPES_FIELD_NUMBER = 3; + + private static final class ParamTypesDefaultEntryHolder { + static final com.google.protobuf.MapEntry + defaultEntry = + com.google.protobuf.MapEntry + .newDefaultInstance( + com.google.spanner.v1.SpannerProto + .internal_static_google_spanner_v1_ExecuteBatchDmlRequest_Statement_ParamTypesEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.MESSAGE, + com.google.spanner.v1.Type.getDefaultInstance()); + } + + private com.google.protobuf.MapField paramTypes_; + + private com.google.protobuf.MapField + internalGetParamTypes() { + if (paramTypes_ == null) { + return com.google.protobuf.MapField.emptyMapField( + ParamTypesDefaultEntryHolder.defaultEntry); + } + return paramTypes_; + } + + public int getParamTypesCount() { + return internalGetParamTypes().getMap().size(); + } + /** + * + * + *
+     * 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][google.spanner.v1.ExecuteBatchDmlRequest.Statement.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][google.spanner.v1.Type] for more information
+     * about SQL types.
+     * 
+ * + * map<string, .google.spanner.v1.Type> param_types = 3; + */ + public boolean containsParamTypes(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + return internalGetParamTypes().getMap().containsKey(key); + } + /** Use {@link #getParamTypesMap()} instead. */ + @java.lang.Deprecated + public java.util.Map getParamTypes() { + return getParamTypesMap(); + } + /** + * + * + *
+     * 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][google.spanner.v1.ExecuteBatchDmlRequest.Statement.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][google.spanner.v1.Type] for more information
+     * about SQL types.
+     * 
+ * + * map<string, .google.spanner.v1.Type> param_types = 3; + */ + public java.util.Map getParamTypesMap() { + return internalGetParamTypes().getMap(); + } + /** + * + * + *
+     * 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][google.spanner.v1.ExecuteBatchDmlRequest.Statement.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][google.spanner.v1.Type] for more information
+     * about SQL types.
+     * 
+ * + * map<string, .google.spanner.v1.Type> param_types = 3; + */ + public com.google.spanner.v1.Type getParamTypesOrDefault( + java.lang.String key, com.google.spanner.v1.Type defaultValue) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map map = + internalGetParamTypes().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+     * 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][google.spanner.v1.ExecuteBatchDmlRequest.Statement.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][google.spanner.v1.Type] for more information
+     * about SQL types.
+     * 
+ * + * map<string, .google.spanner.v1.Type> param_types = 3; + */ + public com.google.spanner.v1.Type getParamTypesOrThrow(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map map = + internalGetParamTypes().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!getSqlBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, sql_); + } + if (params_ != null) { + output.writeMessage(2, getParams()); + } + com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( + output, internalGetParamTypes(), ParamTypesDefaultEntryHolder.defaultEntry, 3); + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getSqlBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, sql_); + } + if (params_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getParams()); + } + for (java.util.Map.Entry entry : + internalGetParamTypes().getMap().entrySet()) { + com.google.protobuf.MapEntry paramTypes__ = + ParamTypesDefaultEntryHolder.defaultEntry + .newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, paramTypes__); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.spanner.v1.ExecuteBatchDmlRequest.Statement)) { + return super.equals(obj); + } + com.google.spanner.v1.ExecuteBatchDmlRequest.Statement other = + (com.google.spanner.v1.ExecuteBatchDmlRequest.Statement) obj; + + boolean result = true; + result = result && getSql().equals(other.getSql()); + result = result && (hasParams() == other.hasParams()); + if (hasParams()) { + result = result && getParams().equals(other.getParams()); + } + result = result && internalGetParamTypes().equals(other.internalGetParamTypes()); + result = result && unknownFields.equals(other.unknownFields); + return result; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + SQL_FIELD_NUMBER; + hash = (53 * hash) + getSql().hashCode(); + if (hasParams()) { + hash = (37 * hash) + PARAMS_FIELD_NUMBER; + hash = (53 * hash) + getParams().hashCode(); + } + if (!internalGetParamTypes().getMap().isEmpty()) { + hash = (37 * hash) + PARAM_TYPES_FIELD_NUMBER; + hash = (53 * hash) + internalGetParamTypes().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.spanner.v1.ExecuteBatchDmlRequest.Statement parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.v1.ExecuteBatchDmlRequest.Statement parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.v1.ExecuteBatchDmlRequest.Statement parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.v1.ExecuteBatchDmlRequest.Statement parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.v1.ExecuteBatchDmlRequest.Statement parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.v1.ExecuteBatchDmlRequest.Statement parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.v1.ExecuteBatchDmlRequest.Statement parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.spanner.v1.ExecuteBatchDmlRequest.Statement parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.spanner.v1.ExecuteBatchDmlRequest.Statement parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.spanner.v1.ExecuteBatchDmlRequest.Statement parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.spanner.v1.ExecuteBatchDmlRequest.Statement parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.spanner.v1.ExecuteBatchDmlRequest.Statement parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.spanner.v1.ExecuteBatchDmlRequest.Statement prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+     * A single DML statement.
+     * 
+ * + * Protobuf type {@code google.spanner.v1.ExecuteBatchDmlRequest.Statement} + */ + public static final class Builder + extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.spanner.v1.ExecuteBatchDmlRequest.Statement) + com.google.spanner.v1.ExecuteBatchDmlRequest.StatementOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.spanner.v1.SpannerProto + .internal_static_google_spanner_v1_ExecuteBatchDmlRequest_Statement_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMapField(int number) { + switch (number) { + case 3: + return internalGetParamTypes(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMutableMapField(int number) { + switch (number) { + case 3: + return internalGetMutableParamTypes(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.spanner.v1.SpannerProto + .internal_static_google_spanner_v1_ExecuteBatchDmlRequest_Statement_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.spanner.v1.ExecuteBatchDmlRequest.Statement.class, + com.google.spanner.v1.ExecuteBatchDmlRequest.Statement.Builder.class); + } + + // Construct using com.google.spanner.v1.ExecuteBatchDmlRequest.Statement.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + sql_ = ""; + + if (paramsBuilder_ == null) { + params_ = null; + } else { + params_ = null; + paramsBuilder_ = null; + } + internalGetMutableParamTypes().clear(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.spanner.v1.SpannerProto + .internal_static_google_spanner_v1_ExecuteBatchDmlRequest_Statement_descriptor; + } + + @java.lang.Override + public com.google.spanner.v1.ExecuteBatchDmlRequest.Statement getDefaultInstanceForType() { + return com.google.spanner.v1.ExecuteBatchDmlRequest.Statement.getDefaultInstance(); + } + + @java.lang.Override + public com.google.spanner.v1.ExecuteBatchDmlRequest.Statement build() { + com.google.spanner.v1.ExecuteBatchDmlRequest.Statement result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.spanner.v1.ExecuteBatchDmlRequest.Statement buildPartial() { + com.google.spanner.v1.ExecuteBatchDmlRequest.Statement result = + new com.google.spanner.v1.ExecuteBatchDmlRequest.Statement(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + result.sql_ = sql_; + if (paramsBuilder_ == null) { + result.params_ = params_; + } else { + result.params_ = paramsBuilder_.build(); + } + result.paramTypes_ = internalGetParamTypes(); + result.paramTypes_.makeImmutable(); + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return (Builder) super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return (Builder) super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, + java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.spanner.v1.ExecuteBatchDmlRequest.Statement) { + return mergeFrom((com.google.spanner.v1.ExecuteBatchDmlRequest.Statement) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.spanner.v1.ExecuteBatchDmlRequest.Statement other) { + if (other == com.google.spanner.v1.ExecuteBatchDmlRequest.Statement.getDefaultInstance()) + return this; + if (!other.getSql().isEmpty()) { + sql_ = other.sql_; + onChanged(); + } + if (other.hasParams()) { + mergeParams(other.getParams()); + } + internalGetMutableParamTypes().mergeFrom(other.internalGetParamTypes()); + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.spanner.v1.ExecuteBatchDmlRequest.Statement parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.spanner.v1.ExecuteBatchDmlRequest.Statement) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.lang.Object sql_ = ""; + /** + * + * + *
+       * Required. The DML string.
+       * 
+ * + * string sql = 1; + */ + public java.lang.String getSql() { + java.lang.Object ref = sql_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + sql_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+       * Required. The DML string.
+       * 
+ * + * string sql = 1; + */ + public com.google.protobuf.ByteString getSqlBytes() { + java.lang.Object ref = sql_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + sql_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+       * Required. The DML string.
+       * 
+ * + * string sql = 1; + */ + public Builder setSql(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + sql_ = value; + onChanged(); + return this; + } + /** + * + * + *
+       * Required. The DML string.
+       * 
+ * + * string sql = 1; + */ + public Builder clearSql() { + + sql_ = getDefaultInstance().getSql(); + onChanged(); + return this; + } + /** + * + * + *
+       * Required. The DML string.
+       * 
+ * + * string sql = 1; + */ + public Builder setSqlBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + sql_ = value; + onChanged(); + return this; + } + + private com.google.protobuf.Struct params_ = null; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Struct, + com.google.protobuf.Struct.Builder, + com.google.protobuf.StructOrBuilder> + paramsBuilder_; + /** + * + * + *
+       * The DML string can contain parameter placeholders. A parameter
+       * placeholder consists of `'@'` followed by the parameter
+       * name. Parameter names consist of any combination of letters,
+       * numbers, and underscores.
+       * 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 an SQL statement with unbound parameters.
+       * Parameter values are specified using `params`, which is a JSON
+       * object whose keys are parameter names, and whose values are the
+       * corresponding parameter values.
+       * 
+ * + * .google.protobuf.Struct params = 2; + */ + public boolean hasParams() { + return paramsBuilder_ != null || params_ != null; + } + /** + * + * + *
+       * The DML string can contain parameter placeholders. A parameter
+       * placeholder consists of `'@'` followed by the parameter
+       * name. Parameter names consist of any combination of letters,
+       * numbers, and underscores.
+       * 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 an SQL statement with unbound parameters.
+       * Parameter values are specified using `params`, which is a JSON
+       * object whose keys are parameter names, and whose values are the
+       * corresponding parameter values.
+       * 
+ * + * .google.protobuf.Struct params = 2; + */ + public com.google.protobuf.Struct getParams() { + if (paramsBuilder_ == null) { + return params_ == null ? com.google.protobuf.Struct.getDefaultInstance() : params_; + } else { + return paramsBuilder_.getMessage(); + } + } + /** + * + * + *
+       * The DML string can contain parameter placeholders. A parameter
+       * placeholder consists of `'@'` followed by the parameter
+       * name. Parameter names consist of any combination of letters,
+       * numbers, and underscores.
+       * 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 an SQL statement with unbound parameters.
+       * Parameter values are specified using `params`, which is a JSON
+       * object whose keys are parameter names, and whose values are the
+       * corresponding parameter values.
+       * 
+ * + * .google.protobuf.Struct params = 2; + */ + public Builder setParams(com.google.protobuf.Struct value) { + if (paramsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + params_ = value; + onChanged(); + } else { + paramsBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+       * The DML string can contain parameter placeholders. A parameter
+       * placeholder consists of `'@'` followed by the parameter
+       * name. Parameter names consist of any combination of letters,
+       * numbers, and underscores.
+       * 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 an SQL statement with unbound parameters.
+       * Parameter values are specified using `params`, which is a JSON
+       * object whose keys are parameter names, and whose values are the
+       * corresponding parameter values.
+       * 
+ * + * .google.protobuf.Struct params = 2; + */ + public Builder setParams(com.google.protobuf.Struct.Builder builderForValue) { + if (paramsBuilder_ == null) { + params_ = builderForValue.build(); + onChanged(); + } else { + paramsBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+       * The DML string can contain parameter placeholders. A parameter
+       * placeholder consists of `'@'` followed by the parameter
+       * name. Parameter names consist of any combination of letters,
+       * numbers, and underscores.
+       * 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 an SQL statement with unbound parameters.
+       * Parameter values are specified using `params`, which is a JSON
+       * object whose keys are parameter names, and whose values are the
+       * corresponding parameter values.
+       * 
+ * + * .google.protobuf.Struct params = 2; + */ + public Builder mergeParams(com.google.protobuf.Struct value) { + if (paramsBuilder_ == null) { + if (params_ != null) { + params_ = + com.google.protobuf.Struct.newBuilder(params_).mergeFrom(value).buildPartial(); + } else { + params_ = value; + } + onChanged(); + } else { + paramsBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+       * The DML string can contain parameter placeholders. A parameter
+       * placeholder consists of `'@'` followed by the parameter
+       * name. Parameter names consist of any combination of letters,
+       * numbers, and underscores.
+       * 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 an SQL statement with unbound parameters.
+       * Parameter values are specified using `params`, which is a JSON
+       * object whose keys are parameter names, and whose values are the
+       * corresponding parameter values.
+       * 
+ * + * .google.protobuf.Struct params = 2; + */ + public Builder clearParams() { + if (paramsBuilder_ == null) { + params_ = null; + onChanged(); + } else { + params_ = null; + paramsBuilder_ = null; + } + + return this; + } + /** + * + * + *
+       * The DML string can contain parameter placeholders. A parameter
+       * placeholder consists of `'@'` followed by the parameter
+       * name. Parameter names consist of any combination of letters,
+       * numbers, and underscores.
+       * 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 an SQL statement with unbound parameters.
+       * Parameter values are specified using `params`, which is a JSON
+       * object whose keys are parameter names, and whose values are the
+       * corresponding parameter values.
+       * 
+ * + * .google.protobuf.Struct params = 2; + */ + public com.google.protobuf.Struct.Builder getParamsBuilder() { + + onChanged(); + return getParamsFieldBuilder().getBuilder(); + } + /** + * + * + *
+       * The DML string can contain parameter placeholders. A parameter
+       * placeholder consists of `'@'` followed by the parameter
+       * name. Parameter names consist of any combination of letters,
+       * numbers, and underscores.
+       * 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 an SQL statement with unbound parameters.
+       * Parameter values are specified using `params`, which is a JSON
+       * object whose keys are parameter names, and whose values are the
+       * corresponding parameter values.
+       * 
+ * + * .google.protobuf.Struct params = 2; + */ + public com.google.protobuf.StructOrBuilder getParamsOrBuilder() { + if (paramsBuilder_ != null) { + return paramsBuilder_.getMessageOrBuilder(); + } else { + return params_ == null ? com.google.protobuf.Struct.getDefaultInstance() : params_; + } + } + /** + * + * + *
+       * The DML string can contain parameter placeholders. A parameter
+       * placeholder consists of `'@'` followed by the parameter
+       * name. Parameter names consist of any combination of letters,
+       * numbers, and underscores.
+       * 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 an SQL statement with unbound parameters.
+       * Parameter values are specified using `params`, which is a JSON
+       * object whose keys are parameter names, and whose values are the
+       * corresponding parameter values.
+       * 
+ * + * .google.protobuf.Struct params = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Struct, + com.google.protobuf.Struct.Builder, + com.google.protobuf.StructOrBuilder> + getParamsFieldBuilder() { + if (paramsBuilder_ == null) { + paramsBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Struct, + com.google.protobuf.Struct.Builder, + com.google.protobuf.StructOrBuilder>( + getParams(), getParentForChildren(), isClean()); + params_ = null; + } + return paramsBuilder_; + } + + private com.google.protobuf.MapField + paramTypes_; + + private com.google.protobuf.MapField + internalGetParamTypes() { + if (paramTypes_ == null) { + return com.google.protobuf.MapField.emptyMapField( + ParamTypesDefaultEntryHolder.defaultEntry); + } + return paramTypes_; + } + + private com.google.protobuf.MapField + internalGetMutableParamTypes() { + onChanged(); + ; + if (paramTypes_ == null) { + paramTypes_ = + com.google.protobuf.MapField.newMapField(ParamTypesDefaultEntryHolder.defaultEntry); + } + if (!paramTypes_.isMutable()) { + paramTypes_ = paramTypes_.copy(); + } + return paramTypes_; + } + + public int getParamTypesCount() { + return internalGetParamTypes().getMap().size(); + } + /** + * + * + *
+       * 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][google.spanner.v1.ExecuteBatchDmlRequest.Statement.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][google.spanner.v1.Type] for more information
+       * about SQL types.
+       * 
+ * + * map<string, .google.spanner.v1.Type> param_types = 3; + */ + public boolean containsParamTypes(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + return internalGetParamTypes().getMap().containsKey(key); + } + /** Use {@link #getParamTypesMap()} instead. */ + @java.lang.Deprecated + public java.util.Map getParamTypes() { + return getParamTypesMap(); + } + /** + * + * + *
+       * 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][google.spanner.v1.ExecuteBatchDmlRequest.Statement.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][google.spanner.v1.Type] for more information
+       * about SQL types.
+       * 
+ * + * map<string, .google.spanner.v1.Type> param_types = 3; + */ + public java.util.Map getParamTypesMap() { + return internalGetParamTypes().getMap(); + } + /** + * + * + *
+       * 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][google.spanner.v1.ExecuteBatchDmlRequest.Statement.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][google.spanner.v1.Type] for more information
+       * about SQL types.
+       * 
+ * + * map<string, .google.spanner.v1.Type> param_types = 3; + */ + public com.google.spanner.v1.Type getParamTypesOrDefault( + java.lang.String key, com.google.spanner.v1.Type defaultValue) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map map = + internalGetParamTypes().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+       * 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][google.spanner.v1.ExecuteBatchDmlRequest.Statement.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][google.spanner.v1.Type] for more information
+       * about SQL types.
+       * 
+ * + * map<string, .google.spanner.v1.Type> param_types = 3; + */ + public com.google.spanner.v1.Type getParamTypesOrThrow(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map map = + internalGetParamTypes().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public Builder clearParamTypes() { + internalGetMutableParamTypes().getMutableMap().clear(); + 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][google.spanner.v1.ExecuteBatchDmlRequest.Statement.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][google.spanner.v1.Type] for more information
+       * about SQL types.
+       * 
+ * + * map<string, .google.spanner.v1.Type> param_types = 3; + */ + public Builder removeParamTypes(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + internalGetMutableParamTypes().getMutableMap().remove(key); + return this; + } + /** Use alternate mutation accessors instead. */ + @java.lang.Deprecated + public java.util.Map getMutableParamTypes() { + return internalGetMutableParamTypes().getMutableMap(); + } + /** + * + * + *
+       * 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][google.spanner.v1.ExecuteBatchDmlRequest.Statement.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][google.spanner.v1.Type] for more information
+       * about SQL types.
+       * 
+ * + * map<string, .google.spanner.v1.Type> param_types = 3; + */ + public Builder putParamTypes(java.lang.String key, com.google.spanner.v1.Type value) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + if (value == null) { + throw new java.lang.NullPointerException(); + } + internalGetMutableParamTypes().getMutableMap().put(key, value); + 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][google.spanner.v1.ExecuteBatchDmlRequest.Statement.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][google.spanner.v1.Type] for more information
+       * about SQL types.
+       * 
+ * + * map<string, .google.spanner.v1.Type> param_types = 3; + */ + public Builder putAllParamTypes( + java.util.Map values) { + internalGetMutableParamTypes().getMutableMap().putAll(values); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFieldsProto3(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.spanner.v1.ExecuteBatchDmlRequest.Statement) + } + + // @@protoc_insertion_point(class_scope:google.spanner.v1.ExecuteBatchDmlRequest.Statement) + private static final com.google.spanner.v1.ExecuteBatchDmlRequest.Statement DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.spanner.v1.ExecuteBatchDmlRequest.Statement(); + } + + public static com.google.spanner.v1.ExecuteBatchDmlRequest.Statement getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Statement parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Statement(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.spanner.v1.ExecuteBatchDmlRequest.Statement getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + private int bitField0_; + public static final int SESSION_FIELD_NUMBER = 1; + private volatile java.lang.Object session_; + /** + * + * + *
+   * Required. The session in which the DML statements should be performed.
+   * 
+ * + * string session = 1; + */ + public java.lang.String getSession() { + java.lang.Object ref = session_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + session_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The session in which the DML statements should be performed.
+   * 
+ * + * string session = 1; + */ + public com.google.protobuf.ByteString getSessionBytes() { + java.lang.Object ref = session_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + session_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int TRANSACTION_FIELD_NUMBER = 2; + private com.google.spanner.v1.TransactionSelector transaction_; + /** + * + * + *
+   * The transaction to use. A ReadWrite transaction is required. Single-use
+   * transactions are not supported (to avoid replay).  The caller must either
+   * supply an existing transaction ID or begin a new transaction.
+   * 
+ * + * .google.spanner.v1.TransactionSelector transaction = 2; + */ + public boolean hasTransaction() { + return transaction_ != null; + } + /** + * + * + *
+   * The transaction to use. A ReadWrite transaction is required. Single-use
+   * transactions are not supported (to avoid replay).  The caller must either
+   * supply an existing transaction ID or begin a new transaction.
+   * 
+ * + * .google.spanner.v1.TransactionSelector transaction = 2; + */ + public com.google.spanner.v1.TransactionSelector getTransaction() { + return transaction_ == null + ? com.google.spanner.v1.TransactionSelector.getDefaultInstance() + : transaction_; + } + /** + * + * + *
+   * The transaction to use. A ReadWrite transaction is required. Single-use
+   * transactions are not supported (to avoid replay).  The caller must either
+   * supply an existing transaction ID or begin a new transaction.
+   * 
+ * + * .google.spanner.v1.TransactionSelector transaction = 2; + */ + public com.google.spanner.v1.TransactionSelectorOrBuilder getTransactionOrBuilder() { + return getTransaction(); + } + + public static final int STATEMENTS_FIELD_NUMBER = 3; + private java.util.List statements_; + /** + * + * + *
+   * The list of statements to execute in this batch. Statements are executed
+   * serially, such that the effects of statement i are visible to statement
+   * i+1. Each statement must be a DML statement. Execution will stop at the
+   * first failed statement; the remaining statements will not run.
+   * REQUIRES: statements_size() > 0.
+   * 
+ * + * repeated .google.spanner.v1.ExecuteBatchDmlRequest.Statement statements = 3; + */ + public java.util.List + getStatementsList() { + return statements_; + } + /** + * + * + *
+   * The list of statements to execute in this batch. Statements are executed
+   * serially, such that the effects of statement i are visible to statement
+   * i+1. Each statement must be a DML statement. Execution will stop at the
+   * first failed statement; the remaining statements will not run.
+   * REQUIRES: statements_size() > 0.
+   * 
+ * + * repeated .google.spanner.v1.ExecuteBatchDmlRequest.Statement statements = 3; + */ + public java.util.List + getStatementsOrBuilderList() { + return statements_; + } + /** + * + * + *
+   * The list of statements to execute in this batch. Statements are executed
+   * serially, such that the effects of statement i are visible to statement
+   * i+1. Each statement must be a DML statement. Execution will stop at the
+   * first failed statement; the remaining statements will not run.
+   * REQUIRES: statements_size() > 0.
+   * 
+ * + * repeated .google.spanner.v1.ExecuteBatchDmlRequest.Statement statements = 3; + */ + public int getStatementsCount() { + return statements_.size(); + } + /** + * + * + *
+   * The list of statements to execute in this batch. Statements are executed
+   * serially, such that the effects of statement i are visible to statement
+   * i+1. Each statement must be a DML statement. Execution will stop at the
+   * first failed statement; the remaining statements will not run.
+   * REQUIRES: statements_size() > 0.
+   * 
+ * + * repeated .google.spanner.v1.ExecuteBatchDmlRequest.Statement statements = 3; + */ + public com.google.spanner.v1.ExecuteBatchDmlRequest.Statement getStatements(int index) { + return statements_.get(index); + } + /** + * + * + *
+   * The list of statements to execute in this batch. Statements are executed
+   * serially, such that the effects of statement i are visible to statement
+   * i+1. Each statement must be a DML statement. Execution will stop at the
+   * first failed statement; the remaining statements will not run.
+   * REQUIRES: statements_size() > 0.
+   * 
+ * + * repeated .google.spanner.v1.ExecuteBatchDmlRequest.Statement statements = 3; + */ + public com.google.spanner.v1.ExecuteBatchDmlRequest.StatementOrBuilder getStatementsOrBuilder( + int index) { + return statements_.get(index); + } + + public static final int SEQNO_FIELD_NUMBER = 4; + private long seqno_; + /** + * + * + *
+   * A per-transaction sequence number used to identify this request. This is
+   * used in the same space as the seqno in
+   * [ExecuteSqlRequest][Spanner.ExecuteSqlRequest]. See more details
+   * in [ExecuteSqlRequest][Spanner.ExecuteSqlRequest].
+   * 
+ * + * int64 seqno = 4; + */ + public long getSeqno() { + return seqno_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!getSessionBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, session_); + } + if (transaction_ != null) { + output.writeMessage(2, getTransaction()); + } + for (int i = 0; i < statements_.size(); i++) { + output.writeMessage(3, statements_.get(i)); + } + if (seqno_ != 0L) { + output.writeInt64(4, seqno_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getSessionBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, session_); + } + if (transaction_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getTransaction()); + } + for (int i = 0; i < statements_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, statements_.get(i)); + } + if (seqno_ != 0L) { + size += com.google.protobuf.CodedOutputStream.computeInt64Size(4, seqno_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.spanner.v1.ExecuteBatchDmlRequest)) { + return super.equals(obj); + } + com.google.spanner.v1.ExecuteBatchDmlRequest other = + (com.google.spanner.v1.ExecuteBatchDmlRequest) obj; + + boolean result = true; + result = result && getSession().equals(other.getSession()); + result = result && (hasTransaction() == other.hasTransaction()); + if (hasTransaction()) { + result = result && getTransaction().equals(other.getTransaction()); + } + result = result && getStatementsList().equals(other.getStatementsList()); + result = result && (getSeqno() == other.getSeqno()); + result = result && unknownFields.equals(other.unknownFields); + return result; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + SESSION_FIELD_NUMBER; + hash = (53 * hash) + getSession().hashCode(); + if (hasTransaction()) { + hash = (37 * hash) + TRANSACTION_FIELD_NUMBER; + hash = (53 * hash) + getTransaction().hashCode(); + } + if (getStatementsCount() > 0) { + hash = (37 * hash) + STATEMENTS_FIELD_NUMBER; + hash = (53 * hash) + getStatementsList().hashCode(); + } + hash = (37 * hash) + SEQNO_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong(getSeqno()); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.spanner.v1.ExecuteBatchDmlRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.v1.ExecuteBatchDmlRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.v1.ExecuteBatchDmlRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.v1.ExecuteBatchDmlRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.v1.ExecuteBatchDmlRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.v1.ExecuteBatchDmlRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.v1.ExecuteBatchDmlRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.spanner.v1.ExecuteBatchDmlRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.spanner.v1.ExecuteBatchDmlRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.spanner.v1.ExecuteBatchDmlRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.spanner.v1.ExecuteBatchDmlRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.spanner.v1.ExecuteBatchDmlRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.spanner.v1.ExecuteBatchDmlRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * The request for [ExecuteBatchDml][google.spanner.v1.Spanner.ExecuteBatchDml]
+   * 
+ * + * Protobuf type {@code google.spanner.v1.ExecuteBatchDmlRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.spanner.v1.ExecuteBatchDmlRequest) + com.google.spanner.v1.ExecuteBatchDmlRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.spanner.v1.SpannerProto + .internal_static_google_spanner_v1_ExecuteBatchDmlRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.spanner.v1.SpannerProto + .internal_static_google_spanner_v1_ExecuteBatchDmlRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.spanner.v1.ExecuteBatchDmlRequest.class, + com.google.spanner.v1.ExecuteBatchDmlRequest.Builder.class); + } + + // Construct using com.google.spanner.v1.ExecuteBatchDmlRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getStatementsFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + session_ = ""; + + if (transactionBuilder_ == null) { + transaction_ = null; + } else { + transaction_ = null; + transactionBuilder_ = null; + } + if (statementsBuilder_ == null) { + statements_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000004); + } else { + statementsBuilder_.clear(); + } + seqno_ = 0L; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.spanner.v1.SpannerProto + .internal_static_google_spanner_v1_ExecuteBatchDmlRequest_descriptor; + } + + @java.lang.Override + public com.google.spanner.v1.ExecuteBatchDmlRequest getDefaultInstanceForType() { + return com.google.spanner.v1.ExecuteBatchDmlRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.spanner.v1.ExecuteBatchDmlRequest build() { + com.google.spanner.v1.ExecuteBatchDmlRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.spanner.v1.ExecuteBatchDmlRequest buildPartial() { + com.google.spanner.v1.ExecuteBatchDmlRequest result = + new com.google.spanner.v1.ExecuteBatchDmlRequest(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + result.session_ = session_; + if (transactionBuilder_ == null) { + result.transaction_ = transaction_; + } else { + result.transaction_ = transactionBuilder_.build(); + } + if (statementsBuilder_ == null) { + if (((bitField0_ & 0x00000004) == 0x00000004)) { + statements_ = java.util.Collections.unmodifiableList(statements_); + bitField0_ = (bitField0_ & ~0x00000004); + } + result.statements_ = statements_; + } else { + result.statements_ = statementsBuilder_.build(); + } + result.seqno_ = seqno_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return (Builder) super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return (Builder) super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.spanner.v1.ExecuteBatchDmlRequest) { + return mergeFrom((com.google.spanner.v1.ExecuteBatchDmlRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.spanner.v1.ExecuteBatchDmlRequest other) { + if (other == com.google.spanner.v1.ExecuteBatchDmlRequest.getDefaultInstance()) return this; + if (!other.getSession().isEmpty()) { + session_ = other.session_; + onChanged(); + } + if (other.hasTransaction()) { + mergeTransaction(other.getTransaction()); + } + if (statementsBuilder_ == null) { + if (!other.statements_.isEmpty()) { + if (statements_.isEmpty()) { + statements_ = other.statements_; + bitField0_ = (bitField0_ & ~0x00000004); + } else { + ensureStatementsIsMutable(); + statements_.addAll(other.statements_); + } + onChanged(); + } + } else { + if (!other.statements_.isEmpty()) { + if (statementsBuilder_.isEmpty()) { + statementsBuilder_.dispose(); + statementsBuilder_ = null; + statements_ = other.statements_; + bitField0_ = (bitField0_ & ~0x00000004); + statementsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getStatementsFieldBuilder() + : null; + } else { + statementsBuilder_.addAllMessages(other.statements_); + } + } + } + if (other.getSeqno() != 0L) { + setSeqno(other.getSeqno()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.spanner.v1.ExecuteBatchDmlRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.spanner.v1.ExecuteBatchDmlRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.lang.Object session_ = ""; + /** + * + * + *
+     * Required. The session in which the DML statements should be performed.
+     * 
+ * + * string session = 1; + */ + public java.lang.String getSession() { + java.lang.Object ref = session_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + session_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The session in which the DML statements should be performed.
+     * 
+ * + * string session = 1; + */ + public com.google.protobuf.ByteString getSessionBytes() { + java.lang.Object ref = session_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + session_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The session in which the DML statements should be performed.
+     * 
+ * + * string session = 1; + */ + public Builder setSession(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + session_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The session in which the DML statements should be performed.
+     * 
+ * + * string session = 1; + */ + public Builder clearSession() { + + session_ = getDefaultInstance().getSession(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The session in which the DML statements should be performed.
+     * 
+ * + * string session = 1; + */ + public Builder setSessionBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + session_ = value; + onChanged(); + return this; + } + + private com.google.spanner.v1.TransactionSelector transaction_ = null; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.v1.TransactionSelector, + com.google.spanner.v1.TransactionSelector.Builder, + com.google.spanner.v1.TransactionSelectorOrBuilder> + transactionBuilder_; + /** + * + * + *
+     * The transaction to use. A ReadWrite transaction is required. Single-use
+     * transactions are not supported (to avoid replay).  The caller must either
+     * supply an existing transaction ID or begin a new transaction.
+     * 
+ * + * .google.spanner.v1.TransactionSelector transaction = 2; + */ + public boolean hasTransaction() { + return transactionBuilder_ != null || transaction_ != null; + } + /** + * + * + *
+     * The transaction to use. A ReadWrite transaction is required. Single-use
+     * transactions are not supported (to avoid replay).  The caller must either
+     * supply an existing transaction ID or begin a new transaction.
+     * 
+ * + * .google.spanner.v1.TransactionSelector transaction = 2; + */ + public com.google.spanner.v1.TransactionSelector getTransaction() { + if (transactionBuilder_ == null) { + return transaction_ == null + ? com.google.spanner.v1.TransactionSelector.getDefaultInstance() + : transaction_; + } else { + return transactionBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The transaction to use. A ReadWrite transaction is required. Single-use
+     * transactions are not supported (to avoid replay).  The caller must either
+     * supply an existing transaction ID or begin a new transaction.
+     * 
+ * + * .google.spanner.v1.TransactionSelector transaction = 2; + */ + public Builder setTransaction(com.google.spanner.v1.TransactionSelector value) { + if (transactionBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + transaction_ = value; + onChanged(); + } else { + transactionBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * The transaction to use. A ReadWrite transaction is required. Single-use
+     * transactions are not supported (to avoid replay).  The caller must either
+     * supply an existing transaction ID or begin a new transaction.
+     * 
+ * + * .google.spanner.v1.TransactionSelector transaction = 2; + */ + public Builder setTransaction( + com.google.spanner.v1.TransactionSelector.Builder builderForValue) { + if (transactionBuilder_ == null) { + transaction_ = builderForValue.build(); + onChanged(); + } else { + transactionBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * The transaction to use. A ReadWrite transaction is required. Single-use
+     * transactions are not supported (to avoid replay).  The caller must either
+     * supply an existing transaction ID or begin a new transaction.
+     * 
+ * + * .google.spanner.v1.TransactionSelector transaction = 2; + */ + public Builder mergeTransaction(com.google.spanner.v1.TransactionSelector value) { + if (transactionBuilder_ == null) { + if (transaction_ != null) { + transaction_ = + com.google.spanner.v1.TransactionSelector.newBuilder(transaction_) + .mergeFrom(value) + .buildPartial(); + } else { + transaction_ = value; + } + onChanged(); + } else { + transactionBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * The transaction to use. A ReadWrite transaction is required. Single-use
+     * transactions are not supported (to avoid replay).  The caller must either
+     * supply an existing transaction ID or begin a new transaction.
+     * 
+ * + * .google.spanner.v1.TransactionSelector transaction = 2; + */ + public Builder clearTransaction() { + if (transactionBuilder_ == null) { + transaction_ = null; + onChanged(); + } else { + transaction_ = null; + transactionBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * The transaction to use. A ReadWrite transaction is required. Single-use
+     * transactions are not supported (to avoid replay).  The caller must either
+     * supply an existing transaction ID or begin a new transaction.
+     * 
+ * + * .google.spanner.v1.TransactionSelector transaction = 2; + */ + public com.google.spanner.v1.TransactionSelector.Builder getTransactionBuilder() { + + onChanged(); + return getTransactionFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The transaction to use. A ReadWrite transaction is required. Single-use
+     * transactions are not supported (to avoid replay).  The caller must either
+     * supply an existing transaction ID or begin a new transaction.
+     * 
+ * + * .google.spanner.v1.TransactionSelector transaction = 2; + */ + public com.google.spanner.v1.TransactionSelectorOrBuilder getTransactionOrBuilder() { + if (transactionBuilder_ != null) { + return transactionBuilder_.getMessageOrBuilder(); + } else { + return transaction_ == null + ? com.google.spanner.v1.TransactionSelector.getDefaultInstance() + : transaction_; + } + } + /** + * + * + *
+     * The transaction to use. A ReadWrite transaction is required. Single-use
+     * transactions are not supported (to avoid replay).  The caller must either
+     * supply an existing transaction ID or begin a new transaction.
+     * 
+ * + * .google.spanner.v1.TransactionSelector transaction = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.v1.TransactionSelector, + com.google.spanner.v1.TransactionSelector.Builder, + com.google.spanner.v1.TransactionSelectorOrBuilder> + getTransactionFieldBuilder() { + if (transactionBuilder_ == null) { + transactionBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.v1.TransactionSelector, + com.google.spanner.v1.TransactionSelector.Builder, + com.google.spanner.v1.TransactionSelectorOrBuilder>( + getTransaction(), getParentForChildren(), isClean()); + transaction_ = null; + } + return transactionBuilder_; + } + + private java.util.List statements_ = + java.util.Collections.emptyList(); + + private void ensureStatementsIsMutable() { + if (!((bitField0_ & 0x00000004) == 0x00000004)) { + statements_ = + new java.util.ArrayList( + statements_); + bitField0_ |= 0x00000004; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.spanner.v1.ExecuteBatchDmlRequest.Statement, + com.google.spanner.v1.ExecuteBatchDmlRequest.Statement.Builder, + com.google.spanner.v1.ExecuteBatchDmlRequest.StatementOrBuilder> + statementsBuilder_; + + /** + * + * + *
+     * The list of statements to execute in this batch. Statements are executed
+     * serially, such that the effects of statement i are visible to statement
+     * i+1. Each statement must be a DML statement. Execution will stop at the
+     * first failed statement; the remaining statements will not run.
+     * REQUIRES: statements_size() > 0.
+     * 
+ * + * repeated .google.spanner.v1.ExecuteBatchDmlRequest.Statement statements = 3; + */ + public java.util.List + getStatementsList() { + if (statementsBuilder_ == null) { + return java.util.Collections.unmodifiableList(statements_); + } else { + return statementsBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * The list of statements to execute in this batch. Statements are executed
+     * serially, such that the effects of statement i are visible to statement
+     * i+1. Each statement must be a DML statement. Execution will stop at the
+     * first failed statement; the remaining statements will not run.
+     * REQUIRES: statements_size() > 0.
+     * 
+ * + * repeated .google.spanner.v1.ExecuteBatchDmlRequest.Statement statements = 3; + */ + public int getStatementsCount() { + if (statementsBuilder_ == null) { + return statements_.size(); + } else { + return statementsBuilder_.getCount(); + } + } + /** + * + * + *
+     * The list of statements to execute in this batch. Statements are executed
+     * serially, such that the effects of statement i are visible to statement
+     * i+1. Each statement must be a DML statement. Execution will stop at the
+     * first failed statement; the remaining statements will not run.
+     * REQUIRES: statements_size() > 0.
+     * 
+ * + * repeated .google.spanner.v1.ExecuteBatchDmlRequest.Statement statements = 3; + */ + public com.google.spanner.v1.ExecuteBatchDmlRequest.Statement getStatements(int index) { + if (statementsBuilder_ == null) { + return statements_.get(index); + } else { + return statementsBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * The list of statements to execute in this batch. Statements are executed
+     * serially, such that the effects of statement i are visible to statement
+     * i+1. Each statement must be a DML statement. Execution will stop at the
+     * first failed statement; the remaining statements will not run.
+     * REQUIRES: statements_size() > 0.
+     * 
+ * + * repeated .google.spanner.v1.ExecuteBatchDmlRequest.Statement statements = 3; + */ + public Builder setStatements( + int index, com.google.spanner.v1.ExecuteBatchDmlRequest.Statement value) { + if (statementsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureStatementsIsMutable(); + statements_.set(index, value); + onChanged(); + } else { + statementsBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * The list of statements to execute in this batch. Statements are executed
+     * serially, such that the effects of statement i are visible to statement
+     * i+1. Each statement must be a DML statement. Execution will stop at the
+     * first failed statement; the remaining statements will not run.
+     * REQUIRES: statements_size() > 0.
+     * 
+ * + * repeated .google.spanner.v1.ExecuteBatchDmlRequest.Statement statements = 3; + */ + public Builder setStatements( + int index, com.google.spanner.v1.ExecuteBatchDmlRequest.Statement.Builder builderForValue) { + if (statementsBuilder_ == null) { + ensureStatementsIsMutable(); + statements_.set(index, builderForValue.build()); + onChanged(); + } else { + statementsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The list of statements to execute in this batch. Statements are executed
+     * serially, such that the effects of statement i are visible to statement
+     * i+1. Each statement must be a DML statement. Execution will stop at the
+     * first failed statement; the remaining statements will not run.
+     * REQUIRES: statements_size() > 0.
+     * 
+ * + * repeated .google.spanner.v1.ExecuteBatchDmlRequest.Statement statements = 3; + */ + public Builder addStatements(com.google.spanner.v1.ExecuteBatchDmlRequest.Statement value) { + if (statementsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureStatementsIsMutable(); + statements_.add(value); + onChanged(); + } else { + statementsBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * The list of statements to execute in this batch. Statements are executed
+     * serially, such that the effects of statement i are visible to statement
+     * i+1. Each statement must be a DML statement. Execution will stop at the
+     * first failed statement; the remaining statements will not run.
+     * REQUIRES: statements_size() > 0.
+     * 
+ * + * repeated .google.spanner.v1.ExecuteBatchDmlRequest.Statement statements = 3; + */ + public Builder addStatements( + int index, com.google.spanner.v1.ExecuteBatchDmlRequest.Statement value) { + if (statementsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureStatementsIsMutable(); + statements_.add(index, value); + onChanged(); + } else { + statementsBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * The list of statements to execute in this batch. Statements are executed
+     * serially, such that the effects of statement i are visible to statement
+     * i+1. Each statement must be a DML statement. Execution will stop at the
+     * first failed statement; the remaining statements will not run.
+     * REQUIRES: statements_size() > 0.
+     * 
+ * + * repeated .google.spanner.v1.ExecuteBatchDmlRequest.Statement statements = 3; + */ + public Builder addStatements( + com.google.spanner.v1.ExecuteBatchDmlRequest.Statement.Builder builderForValue) { + if (statementsBuilder_ == null) { + ensureStatementsIsMutable(); + statements_.add(builderForValue.build()); + onChanged(); + } else { + statementsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The list of statements to execute in this batch. Statements are executed
+     * serially, such that the effects of statement i are visible to statement
+     * i+1. Each statement must be a DML statement. Execution will stop at the
+     * first failed statement; the remaining statements will not run.
+     * REQUIRES: statements_size() > 0.
+     * 
+ * + * repeated .google.spanner.v1.ExecuteBatchDmlRequest.Statement statements = 3; + */ + public Builder addStatements( + int index, com.google.spanner.v1.ExecuteBatchDmlRequest.Statement.Builder builderForValue) { + if (statementsBuilder_ == null) { + ensureStatementsIsMutable(); + statements_.add(index, builderForValue.build()); + onChanged(); + } else { + statementsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The list of statements to execute in this batch. Statements are executed
+     * serially, such that the effects of statement i are visible to statement
+     * i+1. Each statement must be a DML statement. Execution will stop at the
+     * first failed statement; the remaining statements will not run.
+     * REQUIRES: statements_size() > 0.
+     * 
+ * + * repeated .google.spanner.v1.ExecuteBatchDmlRequest.Statement statements = 3; + */ + public Builder addAllStatements( + java.lang.Iterable + values) { + if (statementsBuilder_ == null) { + ensureStatementsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, statements_); + onChanged(); + } else { + statementsBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * The list of statements to execute in this batch. Statements are executed
+     * serially, such that the effects of statement i are visible to statement
+     * i+1. Each statement must be a DML statement. Execution will stop at the
+     * first failed statement; the remaining statements will not run.
+     * REQUIRES: statements_size() > 0.
+     * 
+ * + * repeated .google.spanner.v1.ExecuteBatchDmlRequest.Statement statements = 3; + */ + public Builder clearStatements() { + if (statementsBuilder_ == null) { + statements_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + } else { + statementsBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * The list of statements to execute in this batch. Statements are executed
+     * serially, such that the effects of statement i are visible to statement
+     * i+1. Each statement must be a DML statement. Execution will stop at the
+     * first failed statement; the remaining statements will not run.
+     * REQUIRES: statements_size() > 0.
+     * 
+ * + * repeated .google.spanner.v1.ExecuteBatchDmlRequest.Statement statements = 3; + */ + public Builder removeStatements(int index) { + if (statementsBuilder_ == null) { + ensureStatementsIsMutable(); + statements_.remove(index); + onChanged(); + } else { + statementsBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * The list of statements to execute in this batch. Statements are executed
+     * serially, such that the effects of statement i are visible to statement
+     * i+1. Each statement must be a DML statement. Execution will stop at the
+     * first failed statement; the remaining statements will not run.
+     * REQUIRES: statements_size() > 0.
+     * 
+ * + * repeated .google.spanner.v1.ExecuteBatchDmlRequest.Statement statements = 3; + */ + public com.google.spanner.v1.ExecuteBatchDmlRequest.Statement.Builder getStatementsBuilder( + int index) { + return getStatementsFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * The list of statements to execute in this batch. Statements are executed
+     * serially, such that the effects of statement i are visible to statement
+     * i+1. Each statement must be a DML statement. Execution will stop at the
+     * first failed statement; the remaining statements will not run.
+     * REQUIRES: statements_size() > 0.
+     * 
+ * + * repeated .google.spanner.v1.ExecuteBatchDmlRequest.Statement statements = 3; + */ + public com.google.spanner.v1.ExecuteBatchDmlRequest.StatementOrBuilder getStatementsOrBuilder( + int index) { + if (statementsBuilder_ == null) { + return statements_.get(index); + } else { + return statementsBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * The list of statements to execute in this batch. Statements are executed
+     * serially, such that the effects of statement i are visible to statement
+     * i+1. Each statement must be a DML statement. Execution will stop at the
+     * first failed statement; the remaining statements will not run.
+     * REQUIRES: statements_size() > 0.
+     * 
+ * + * repeated .google.spanner.v1.ExecuteBatchDmlRequest.Statement statements = 3; + */ + public java.util.List + getStatementsOrBuilderList() { + if (statementsBuilder_ != null) { + return statementsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(statements_); + } + } + /** + * + * + *
+     * The list of statements to execute in this batch. Statements are executed
+     * serially, such that the effects of statement i are visible to statement
+     * i+1. Each statement must be a DML statement. Execution will stop at the
+     * first failed statement; the remaining statements will not run.
+     * REQUIRES: statements_size() > 0.
+     * 
+ * + * repeated .google.spanner.v1.ExecuteBatchDmlRequest.Statement statements = 3; + */ + public com.google.spanner.v1.ExecuteBatchDmlRequest.Statement.Builder addStatementsBuilder() { + return getStatementsFieldBuilder() + .addBuilder(com.google.spanner.v1.ExecuteBatchDmlRequest.Statement.getDefaultInstance()); + } + /** + * + * + *
+     * The list of statements to execute in this batch. Statements are executed
+     * serially, such that the effects of statement i are visible to statement
+     * i+1. Each statement must be a DML statement. Execution will stop at the
+     * first failed statement; the remaining statements will not run.
+     * REQUIRES: statements_size() > 0.
+     * 
+ * + * repeated .google.spanner.v1.ExecuteBatchDmlRequest.Statement statements = 3; + */ + public com.google.spanner.v1.ExecuteBatchDmlRequest.Statement.Builder addStatementsBuilder( + int index) { + return getStatementsFieldBuilder() + .addBuilder( + index, com.google.spanner.v1.ExecuteBatchDmlRequest.Statement.getDefaultInstance()); + } + /** + * + * + *
+     * The list of statements to execute in this batch. Statements are executed
+     * serially, such that the effects of statement i are visible to statement
+     * i+1. Each statement must be a DML statement. Execution will stop at the
+     * first failed statement; the remaining statements will not run.
+     * REQUIRES: statements_size() > 0.
+     * 
+ * + * repeated .google.spanner.v1.ExecuteBatchDmlRequest.Statement statements = 3; + */ + public java.util.List + getStatementsBuilderList() { + return getStatementsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.spanner.v1.ExecuteBatchDmlRequest.Statement, + com.google.spanner.v1.ExecuteBatchDmlRequest.Statement.Builder, + com.google.spanner.v1.ExecuteBatchDmlRequest.StatementOrBuilder> + getStatementsFieldBuilder() { + if (statementsBuilder_ == null) { + statementsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.spanner.v1.ExecuteBatchDmlRequest.Statement, + com.google.spanner.v1.ExecuteBatchDmlRequest.Statement.Builder, + com.google.spanner.v1.ExecuteBatchDmlRequest.StatementOrBuilder>( + statements_, + ((bitField0_ & 0x00000004) == 0x00000004), + getParentForChildren(), + isClean()); + statements_ = null; + } + return statementsBuilder_; + } + + private long seqno_; + /** + * + * + *
+     * A per-transaction sequence number used to identify this request. This is
+     * used in the same space as the seqno in
+     * [ExecuteSqlRequest][Spanner.ExecuteSqlRequest]. See more details
+     * in [ExecuteSqlRequest][Spanner.ExecuteSqlRequest].
+     * 
+ * + * int64 seqno = 4; + */ + public long getSeqno() { + return seqno_; + } + /** + * + * + *
+     * A per-transaction sequence number used to identify this request. This is
+     * used in the same space as the seqno in
+     * [ExecuteSqlRequest][Spanner.ExecuteSqlRequest]. See more details
+     * in [ExecuteSqlRequest][Spanner.ExecuteSqlRequest].
+     * 
+ * + * int64 seqno = 4; + */ + public Builder setSeqno(long value) { + + seqno_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * A per-transaction sequence number used to identify this request. This is
+     * used in the same space as the seqno in
+     * [ExecuteSqlRequest][Spanner.ExecuteSqlRequest]. See more details
+     * in [ExecuteSqlRequest][Spanner.ExecuteSqlRequest].
+     * 
+ * + * int64 seqno = 4; + */ + public Builder clearSeqno() { + + seqno_ = 0L; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFieldsProto3(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.spanner.v1.ExecuteBatchDmlRequest) + } + + // @@protoc_insertion_point(class_scope:google.spanner.v1.ExecuteBatchDmlRequest) + private static final com.google.spanner.v1.ExecuteBatchDmlRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.spanner.v1.ExecuteBatchDmlRequest(); + } + + public static com.google.spanner.v1.ExecuteBatchDmlRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ExecuteBatchDmlRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ExecuteBatchDmlRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.spanner.v1.ExecuteBatchDmlRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/google-api-grpc/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ExecuteBatchDmlRequestOrBuilder.java b/google-api-grpc/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ExecuteBatchDmlRequestOrBuilder.java new file mode 100644 index 000000000000..248a0b3f2916 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ExecuteBatchDmlRequestOrBuilder.java @@ -0,0 +1,154 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/spanner/v1/spanner.proto + +package com.google.spanner.v1; + +public interface ExecuteBatchDmlRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.spanner.v1.ExecuteBatchDmlRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The session in which the DML statements should be performed.
+   * 
+ * + * string session = 1; + */ + java.lang.String getSession(); + /** + * + * + *
+   * Required. The session in which the DML statements should be performed.
+   * 
+ * + * string session = 1; + */ + com.google.protobuf.ByteString getSessionBytes(); + + /** + * + * + *
+   * The transaction to use. A ReadWrite transaction is required. Single-use
+   * transactions are not supported (to avoid replay).  The caller must either
+   * supply an existing transaction ID or begin a new transaction.
+   * 
+ * + * .google.spanner.v1.TransactionSelector transaction = 2; + */ + boolean hasTransaction(); + /** + * + * + *
+   * The transaction to use. A ReadWrite transaction is required. Single-use
+   * transactions are not supported (to avoid replay).  The caller must either
+   * supply an existing transaction ID or begin a new transaction.
+   * 
+ * + * .google.spanner.v1.TransactionSelector transaction = 2; + */ + com.google.spanner.v1.TransactionSelector getTransaction(); + /** + * + * + *
+   * The transaction to use. A ReadWrite transaction is required. Single-use
+   * transactions are not supported (to avoid replay).  The caller must either
+   * supply an existing transaction ID or begin a new transaction.
+   * 
+ * + * .google.spanner.v1.TransactionSelector transaction = 2; + */ + com.google.spanner.v1.TransactionSelectorOrBuilder getTransactionOrBuilder(); + + /** + * + * + *
+   * The list of statements to execute in this batch. Statements are executed
+   * serially, such that the effects of statement i are visible to statement
+   * i+1. Each statement must be a DML statement. Execution will stop at the
+   * first failed statement; the remaining statements will not run.
+   * REQUIRES: statements_size() > 0.
+   * 
+ * + * repeated .google.spanner.v1.ExecuteBatchDmlRequest.Statement statements = 3; + */ + java.util.List getStatementsList(); + /** + * + * + *
+   * The list of statements to execute in this batch. Statements are executed
+   * serially, such that the effects of statement i are visible to statement
+   * i+1. Each statement must be a DML statement. Execution will stop at the
+   * first failed statement; the remaining statements will not run.
+   * REQUIRES: statements_size() > 0.
+   * 
+ * + * repeated .google.spanner.v1.ExecuteBatchDmlRequest.Statement statements = 3; + */ + com.google.spanner.v1.ExecuteBatchDmlRequest.Statement getStatements(int index); + /** + * + * + *
+   * The list of statements to execute in this batch. Statements are executed
+   * serially, such that the effects of statement i are visible to statement
+   * i+1. Each statement must be a DML statement. Execution will stop at the
+   * first failed statement; the remaining statements will not run.
+   * REQUIRES: statements_size() > 0.
+   * 
+ * + * repeated .google.spanner.v1.ExecuteBatchDmlRequest.Statement statements = 3; + */ + int getStatementsCount(); + /** + * + * + *
+   * The list of statements to execute in this batch. Statements are executed
+   * serially, such that the effects of statement i are visible to statement
+   * i+1. Each statement must be a DML statement. Execution will stop at the
+   * first failed statement; the remaining statements will not run.
+   * REQUIRES: statements_size() > 0.
+   * 
+ * + * repeated .google.spanner.v1.ExecuteBatchDmlRequest.Statement statements = 3; + */ + java.util.List + getStatementsOrBuilderList(); + /** + * + * + *
+   * The list of statements to execute in this batch. Statements are executed
+   * serially, such that the effects of statement i are visible to statement
+   * i+1. Each statement must be a DML statement. Execution will stop at the
+   * first failed statement; the remaining statements will not run.
+   * REQUIRES: statements_size() > 0.
+   * 
+ * + * repeated .google.spanner.v1.ExecuteBatchDmlRequest.Statement statements = 3; + */ + com.google.spanner.v1.ExecuteBatchDmlRequest.StatementOrBuilder getStatementsOrBuilder(int index); + + /** + * + * + *
+   * A per-transaction sequence number used to identify this request. This is
+   * used in the same space as the seqno in
+   * [ExecuteSqlRequest][Spanner.ExecuteSqlRequest]. See more details
+   * in [ExecuteSqlRequest][Spanner.ExecuteSqlRequest].
+   * 
+ * + * int64 seqno = 4; + */ + long getSeqno(); +} diff --git a/google-api-grpc/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ExecuteBatchDmlResponse.java b/google-api-grpc/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ExecuteBatchDmlResponse.java new file mode 100644 index 000000000000..b639f98a5a1e --- /dev/null +++ b/google-api-grpc/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ExecuteBatchDmlResponse.java @@ -0,0 +1,1333 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/spanner/v1/spanner.proto + +package com.google.spanner.v1; + +/** + * + * + *
+ * The response for [ExecuteBatchDml][google.spanner.v1.Spanner.ExecuteBatchDml]. Contains a list
+ * of [ResultSet][google.spanner.v1.ResultSet], one for each DML statement that has successfully executed.
+ * If a statement fails, the error is returned as part of the response payload.
+ * Clients can determine whether all DML statements have run successfully, or if
+ * a statement failed, using one of the following approaches:
+ *   1. Check if 'status' field is OkStatus.
+ *   2. Check if result_sets_size() equals the number of statements in
+ *      [ExecuteBatchDmlRequest][Spanner.ExecuteBatchDmlRequest].
+ * Example 1: A request with 5 DML statements, all executed successfully.
+ * Result: A response with 5 ResultSets, one for each statement in the same
+ * order, and an OK status.
+ * Example 2: A request with 5 DML statements. The 3rd statement has a syntax
+ * error.
+ * Result: A response with 2 ResultSets, for the first 2 statements that
+ * run successfully, and a syntax error (INVALID_ARGUMENT) status. From
+ * result_set_size() client can determine that the 3rd statement has failed.
+ * 
+ * + * Protobuf type {@code google.spanner.v1.ExecuteBatchDmlResponse} + */ +public final class ExecuteBatchDmlResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.spanner.v1.ExecuteBatchDmlResponse) + ExecuteBatchDmlResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use ExecuteBatchDmlResponse.newBuilder() to construct. + private ExecuteBatchDmlResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ExecuteBatchDmlResponse() { + resultSets_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ExecuteBatchDmlResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) { + resultSets_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + resultSets_.add( + input.readMessage(com.google.spanner.v1.ResultSet.parser(), extensionRegistry)); + break; + } + case 18: + { + com.google.rpc.Status.Builder subBuilder = null; + if (status_ != null) { + subBuilder = status_.toBuilder(); + } + status_ = input.readMessage(com.google.rpc.Status.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(status_); + status_ = subBuilder.buildPartial(); + } + + break; + } + default: + { + if (!parseUnknownFieldProto3(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) { + resultSets_ = java.util.Collections.unmodifiableList(resultSets_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.spanner.v1.SpannerProto + .internal_static_google_spanner_v1_ExecuteBatchDmlResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.spanner.v1.SpannerProto + .internal_static_google_spanner_v1_ExecuteBatchDmlResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.spanner.v1.ExecuteBatchDmlResponse.class, + com.google.spanner.v1.ExecuteBatchDmlResponse.Builder.class); + } + + private int bitField0_; + public static final int RESULT_SETS_FIELD_NUMBER = 1; + private java.util.List resultSets_; + /** + * + * + *
+   * ResultSets, one for each statement in the request that ran successfully, in
+   * the same order as the statements in the request. Each [ResultSet][google.spanner.v1.ResultSet] will
+   * not contain any rows. The [ResultSetStats][google.spanner.v1.ResultSetStats] in each [ResultSet][google.spanner.v1.ResultSet] will
+   * contain the number of rows modified by the statement.
+   * Only the first ResultSet in the response contains a valid
+   * [ResultSetMetadata][google.spanner.v1.ResultSetMetadata].
+   * 
+ * + * repeated .google.spanner.v1.ResultSet result_sets = 1; + */ + public java.util.List getResultSetsList() { + return resultSets_; + } + /** + * + * + *
+   * ResultSets, one for each statement in the request that ran successfully, in
+   * the same order as the statements in the request. Each [ResultSet][google.spanner.v1.ResultSet] will
+   * not contain any rows. The [ResultSetStats][google.spanner.v1.ResultSetStats] in each [ResultSet][google.spanner.v1.ResultSet] will
+   * contain the number of rows modified by the statement.
+   * Only the first ResultSet in the response contains a valid
+   * [ResultSetMetadata][google.spanner.v1.ResultSetMetadata].
+   * 
+ * + * repeated .google.spanner.v1.ResultSet result_sets = 1; + */ + public java.util.List + getResultSetsOrBuilderList() { + return resultSets_; + } + /** + * + * + *
+   * ResultSets, one for each statement in the request that ran successfully, in
+   * the same order as the statements in the request. Each [ResultSet][google.spanner.v1.ResultSet] will
+   * not contain any rows. The [ResultSetStats][google.spanner.v1.ResultSetStats] in each [ResultSet][google.spanner.v1.ResultSet] will
+   * contain the number of rows modified by the statement.
+   * Only the first ResultSet in the response contains a valid
+   * [ResultSetMetadata][google.spanner.v1.ResultSetMetadata].
+   * 
+ * + * repeated .google.spanner.v1.ResultSet result_sets = 1; + */ + public int getResultSetsCount() { + return resultSets_.size(); + } + /** + * + * + *
+   * ResultSets, one for each statement in the request that ran successfully, in
+   * the same order as the statements in the request. Each [ResultSet][google.spanner.v1.ResultSet] will
+   * not contain any rows. The [ResultSetStats][google.spanner.v1.ResultSetStats] in each [ResultSet][google.spanner.v1.ResultSet] will
+   * contain the number of rows modified by the statement.
+   * Only the first ResultSet in the response contains a valid
+   * [ResultSetMetadata][google.spanner.v1.ResultSetMetadata].
+   * 
+ * + * repeated .google.spanner.v1.ResultSet result_sets = 1; + */ + public com.google.spanner.v1.ResultSet getResultSets(int index) { + return resultSets_.get(index); + } + /** + * + * + *
+   * ResultSets, one for each statement in the request that ran successfully, in
+   * the same order as the statements in the request. Each [ResultSet][google.spanner.v1.ResultSet] will
+   * not contain any rows. The [ResultSetStats][google.spanner.v1.ResultSetStats] in each [ResultSet][google.spanner.v1.ResultSet] will
+   * contain the number of rows modified by the statement.
+   * Only the first ResultSet in the response contains a valid
+   * [ResultSetMetadata][google.spanner.v1.ResultSetMetadata].
+   * 
+ * + * repeated .google.spanner.v1.ResultSet result_sets = 1; + */ + public com.google.spanner.v1.ResultSetOrBuilder getResultSetsOrBuilder(int index) { + return resultSets_.get(index); + } + + public static final int STATUS_FIELD_NUMBER = 2; + private com.google.rpc.Status status_; + /** + * + * + *
+   * If all DML statements are executed successfully, status will be OK.
+   * Otherwise, the error status of the first failed statement.
+   * 
+ * + * .google.rpc.Status status = 2; + */ + public boolean hasStatus() { + return status_ != null; + } + /** + * + * + *
+   * If all DML statements are executed successfully, status will be OK.
+   * Otherwise, the error status of the first failed statement.
+   * 
+ * + * .google.rpc.Status status = 2; + */ + public com.google.rpc.Status getStatus() { + return status_ == null ? com.google.rpc.Status.getDefaultInstance() : status_; + } + /** + * + * + *
+   * If all DML statements are executed successfully, status will be OK.
+   * Otherwise, the error status of the first failed statement.
+   * 
+ * + * .google.rpc.Status status = 2; + */ + public com.google.rpc.StatusOrBuilder getStatusOrBuilder() { + return getStatus(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + for (int i = 0; i < resultSets_.size(); i++) { + output.writeMessage(1, resultSets_.get(i)); + } + if (status_ != null) { + output.writeMessage(2, getStatus()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < resultSets_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, resultSets_.get(i)); + } + if (status_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getStatus()); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.spanner.v1.ExecuteBatchDmlResponse)) { + return super.equals(obj); + } + com.google.spanner.v1.ExecuteBatchDmlResponse other = + (com.google.spanner.v1.ExecuteBatchDmlResponse) obj; + + boolean result = true; + result = result && getResultSetsList().equals(other.getResultSetsList()); + result = result && (hasStatus() == other.hasStatus()); + if (hasStatus()) { + result = result && getStatus().equals(other.getStatus()); + } + result = result && unknownFields.equals(other.unknownFields); + return result; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getResultSetsCount() > 0) { + hash = (37 * hash) + RESULT_SETS_FIELD_NUMBER; + hash = (53 * hash) + getResultSetsList().hashCode(); + } + if (hasStatus()) { + hash = (37 * hash) + STATUS_FIELD_NUMBER; + hash = (53 * hash) + getStatus().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.spanner.v1.ExecuteBatchDmlResponse parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.v1.ExecuteBatchDmlResponse parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.v1.ExecuteBatchDmlResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.v1.ExecuteBatchDmlResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.v1.ExecuteBatchDmlResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.v1.ExecuteBatchDmlResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.v1.ExecuteBatchDmlResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.spanner.v1.ExecuteBatchDmlResponse parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.spanner.v1.ExecuteBatchDmlResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.spanner.v1.ExecuteBatchDmlResponse parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.spanner.v1.ExecuteBatchDmlResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.spanner.v1.ExecuteBatchDmlResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.spanner.v1.ExecuteBatchDmlResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * The response for [ExecuteBatchDml][google.spanner.v1.Spanner.ExecuteBatchDml]. Contains a list
+   * of [ResultSet][google.spanner.v1.ResultSet], one for each DML statement that has successfully executed.
+   * If a statement fails, the error is returned as part of the response payload.
+   * Clients can determine whether all DML statements have run successfully, or if
+   * a statement failed, using one of the following approaches:
+   *   1. Check if 'status' field is OkStatus.
+   *   2. Check if result_sets_size() equals the number of statements in
+   *      [ExecuteBatchDmlRequest][Spanner.ExecuteBatchDmlRequest].
+   * Example 1: A request with 5 DML statements, all executed successfully.
+   * Result: A response with 5 ResultSets, one for each statement in the same
+   * order, and an OK status.
+   * Example 2: A request with 5 DML statements. The 3rd statement has a syntax
+   * error.
+   * Result: A response with 2 ResultSets, for the first 2 statements that
+   * run successfully, and a syntax error (INVALID_ARGUMENT) status. From
+   * result_set_size() client can determine that the 3rd statement has failed.
+   * 
+ * + * Protobuf type {@code google.spanner.v1.ExecuteBatchDmlResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.spanner.v1.ExecuteBatchDmlResponse) + com.google.spanner.v1.ExecuteBatchDmlResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.spanner.v1.SpannerProto + .internal_static_google_spanner_v1_ExecuteBatchDmlResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.spanner.v1.SpannerProto + .internal_static_google_spanner_v1_ExecuteBatchDmlResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.spanner.v1.ExecuteBatchDmlResponse.class, + com.google.spanner.v1.ExecuteBatchDmlResponse.Builder.class); + } + + // Construct using com.google.spanner.v1.ExecuteBatchDmlResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getResultSetsFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (resultSetsBuilder_ == null) { + resultSets_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + resultSetsBuilder_.clear(); + } + if (statusBuilder_ == null) { + status_ = null; + } else { + status_ = null; + statusBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.spanner.v1.SpannerProto + .internal_static_google_spanner_v1_ExecuteBatchDmlResponse_descriptor; + } + + @java.lang.Override + public com.google.spanner.v1.ExecuteBatchDmlResponse getDefaultInstanceForType() { + return com.google.spanner.v1.ExecuteBatchDmlResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.spanner.v1.ExecuteBatchDmlResponse build() { + com.google.spanner.v1.ExecuteBatchDmlResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.spanner.v1.ExecuteBatchDmlResponse buildPartial() { + com.google.spanner.v1.ExecuteBatchDmlResponse result = + new com.google.spanner.v1.ExecuteBatchDmlResponse(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (resultSetsBuilder_ == null) { + if (((bitField0_ & 0x00000001) == 0x00000001)) { + resultSets_ = java.util.Collections.unmodifiableList(resultSets_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.resultSets_ = resultSets_; + } else { + result.resultSets_ = resultSetsBuilder_.build(); + } + if (statusBuilder_ == null) { + result.status_ = status_; + } else { + result.status_ = statusBuilder_.build(); + } + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return (Builder) super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return (Builder) super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.spanner.v1.ExecuteBatchDmlResponse) { + return mergeFrom((com.google.spanner.v1.ExecuteBatchDmlResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.spanner.v1.ExecuteBatchDmlResponse other) { + if (other == com.google.spanner.v1.ExecuteBatchDmlResponse.getDefaultInstance()) return this; + if (resultSetsBuilder_ == null) { + if (!other.resultSets_.isEmpty()) { + if (resultSets_.isEmpty()) { + resultSets_ = other.resultSets_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureResultSetsIsMutable(); + resultSets_.addAll(other.resultSets_); + } + onChanged(); + } + } else { + if (!other.resultSets_.isEmpty()) { + if (resultSetsBuilder_.isEmpty()) { + resultSetsBuilder_.dispose(); + resultSetsBuilder_ = null; + resultSets_ = other.resultSets_; + bitField0_ = (bitField0_ & ~0x00000001); + resultSetsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getResultSetsFieldBuilder() + : null; + } else { + resultSetsBuilder_.addAllMessages(other.resultSets_); + } + } + } + if (other.hasStatus()) { + mergeStatus(other.getStatus()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.spanner.v1.ExecuteBatchDmlResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.spanner.v1.ExecuteBatchDmlResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.util.List resultSets_ = + java.util.Collections.emptyList(); + + private void ensureResultSetsIsMutable() { + if (!((bitField0_ & 0x00000001) == 0x00000001)) { + resultSets_ = new java.util.ArrayList(resultSets_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.spanner.v1.ResultSet, + com.google.spanner.v1.ResultSet.Builder, + com.google.spanner.v1.ResultSetOrBuilder> + resultSetsBuilder_; + + /** + * + * + *
+     * ResultSets, one for each statement in the request that ran successfully, in
+     * the same order as the statements in the request. Each [ResultSet][google.spanner.v1.ResultSet] will
+     * not contain any rows. The [ResultSetStats][google.spanner.v1.ResultSetStats] in each [ResultSet][google.spanner.v1.ResultSet] will
+     * contain the number of rows modified by the statement.
+     * Only the first ResultSet in the response contains a valid
+     * [ResultSetMetadata][google.spanner.v1.ResultSetMetadata].
+     * 
+ * + * repeated .google.spanner.v1.ResultSet result_sets = 1; + */ + public java.util.List getResultSetsList() { + if (resultSetsBuilder_ == null) { + return java.util.Collections.unmodifiableList(resultSets_); + } else { + return resultSetsBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * ResultSets, one for each statement in the request that ran successfully, in
+     * the same order as the statements in the request. Each [ResultSet][google.spanner.v1.ResultSet] will
+     * not contain any rows. The [ResultSetStats][google.spanner.v1.ResultSetStats] in each [ResultSet][google.spanner.v1.ResultSet] will
+     * contain the number of rows modified by the statement.
+     * Only the first ResultSet in the response contains a valid
+     * [ResultSetMetadata][google.spanner.v1.ResultSetMetadata].
+     * 
+ * + * repeated .google.spanner.v1.ResultSet result_sets = 1; + */ + public int getResultSetsCount() { + if (resultSetsBuilder_ == null) { + return resultSets_.size(); + } else { + return resultSetsBuilder_.getCount(); + } + } + /** + * + * + *
+     * ResultSets, one for each statement in the request that ran successfully, in
+     * the same order as the statements in the request. Each [ResultSet][google.spanner.v1.ResultSet] will
+     * not contain any rows. The [ResultSetStats][google.spanner.v1.ResultSetStats] in each [ResultSet][google.spanner.v1.ResultSet] will
+     * contain the number of rows modified by the statement.
+     * Only the first ResultSet in the response contains a valid
+     * [ResultSetMetadata][google.spanner.v1.ResultSetMetadata].
+     * 
+ * + * repeated .google.spanner.v1.ResultSet result_sets = 1; + */ + public com.google.spanner.v1.ResultSet getResultSets(int index) { + if (resultSetsBuilder_ == null) { + return resultSets_.get(index); + } else { + return resultSetsBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * ResultSets, one for each statement in the request that ran successfully, in
+     * the same order as the statements in the request. Each [ResultSet][google.spanner.v1.ResultSet] will
+     * not contain any rows. The [ResultSetStats][google.spanner.v1.ResultSetStats] in each [ResultSet][google.spanner.v1.ResultSet] will
+     * contain the number of rows modified by the statement.
+     * Only the first ResultSet in the response contains a valid
+     * [ResultSetMetadata][google.spanner.v1.ResultSetMetadata].
+     * 
+ * + * repeated .google.spanner.v1.ResultSet result_sets = 1; + */ + public Builder setResultSets(int index, com.google.spanner.v1.ResultSet value) { + if (resultSetsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureResultSetsIsMutable(); + resultSets_.set(index, value); + onChanged(); + } else { + resultSetsBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * ResultSets, one for each statement in the request that ran successfully, in
+     * the same order as the statements in the request. Each [ResultSet][google.spanner.v1.ResultSet] will
+     * not contain any rows. The [ResultSetStats][google.spanner.v1.ResultSetStats] in each [ResultSet][google.spanner.v1.ResultSet] will
+     * contain the number of rows modified by the statement.
+     * Only the first ResultSet in the response contains a valid
+     * [ResultSetMetadata][google.spanner.v1.ResultSetMetadata].
+     * 
+ * + * repeated .google.spanner.v1.ResultSet result_sets = 1; + */ + public Builder setResultSets( + int index, com.google.spanner.v1.ResultSet.Builder builderForValue) { + if (resultSetsBuilder_ == null) { + ensureResultSetsIsMutable(); + resultSets_.set(index, builderForValue.build()); + onChanged(); + } else { + resultSetsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * ResultSets, one for each statement in the request that ran successfully, in
+     * the same order as the statements in the request. Each [ResultSet][google.spanner.v1.ResultSet] will
+     * not contain any rows. The [ResultSetStats][google.spanner.v1.ResultSetStats] in each [ResultSet][google.spanner.v1.ResultSet] will
+     * contain the number of rows modified by the statement.
+     * Only the first ResultSet in the response contains a valid
+     * [ResultSetMetadata][google.spanner.v1.ResultSetMetadata].
+     * 
+ * + * repeated .google.spanner.v1.ResultSet result_sets = 1; + */ + public Builder addResultSets(com.google.spanner.v1.ResultSet value) { + if (resultSetsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureResultSetsIsMutable(); + resultSets_.add(value); + onChanged(); + } else { + resultSetsBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * ResultSets, one for each statement in the request that ran successfully, in
+     * the same order as the statements in the request. Each [ResultSet][google.spanner.v1.ResultSet] will
+     * not contain any rows. The [ResultSetStats][google.spanner.v1.ResultSetStats] in each [ResultSet][google.spanner.v1.ResultSet] will
+     * contain the number of rows modified by the statement.
+     * Only the first ResultSet in the response contains a valid
+     * [ResultSetMetadata][google.spanner.v1.ResultSetMetadata].
+     * 
+ * + * repeated .google.spanner.v1.ResultSet result_sets = 1; + */ + public Builder addResultSets(int index, com.google.spanner.v1.ResultSet value) { + if (resultSetsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureResultSetsIsMutable(); + resultSets_.add(index, value); + onChanged(); + } else { + resultSetsBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * ResultSets, one for each statement in the request that ran successfully, in
+     * the same order as the statements in the request. Each [ResultSet][google.spanner.v1.ResultSet] will
+     * not contain any rows. The [ResultSetStats][google.spanner.v1.ResultSetStats] in each [ResultSet][google.spanner.v1.ResultSet] will
+     * contain the number of rows modified by the statement.
+     * Only the first ResultSet in the response contains a valid
+     * [ResultSetMetadata][google.spanner.v1.ResultSetMetadata].
+     * 
+ * + * repeated .google.spanner.v1.ResultSet result_sets = 1; + */ + public Builder addResultSets(com.google.spanner.v1.ResultSet.Builder builderForValue) { + if (resultSetsBuilder_ == null) { + ensureResultSetsIsMutable(); + resultSets_.add(builderForValue.build()); + onChanged(); + } else { + resultSetsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * ResultSets, one for each statement in the request that ran successfully, in
+     * the same order as the statements in the request. Each [ResultSet][google.spanner.v1.ResultSet] will
+     * not contain any rows. The [ResultSetStats][google.spanner.v1.ResultSetStats] in each [ResultSet][google.spanner.v1.ResultSet] will
+     * contain the number of rows modified by the statement.
+     * Only the first ResultSet in the response contains a valid
+     * [ResultSetMetadata][google.spanner.v1.ResultSetMetadata].
+     * 
+ * + * repeated .google.spanner.v1.ResultSet result_sets = 1; + */ + public Builder addResultSets( + int index, com.google.spanner.v1.ResultSet.Builder builderForValue) { + if (resultSetsBuilder_ == null) { + ensureResultSetsIsMutable(); + resultSets_.add(index, builderForValue.build()); + onChanged(); + } else { + resultSetsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * ResultSets, one for each statement in the request that ran successfully, in
+     * the same order as the statements in the request. Each [ResultSet][google.spanner.v1.ResultSet] will
+     * not contain any rows. The [ResultSetStats][google.spanner.v1.ResultSetStats] in each [ResultSet][google.spanner.v1.ResultSet] will
+     * contain the number of rows modified by the statement.
+     * Only the first ResultSet in the response contains a valid
+     * [ResultSetMetadata][google.spanner.v1.ResultSetMetadata].
+     * 
+ * + * repeated .google.spanner.v1.ResultSet result_sets = 1; + */ + public Builder addAllResultSets( + java.lang.Iterable values) { + if (resultSetsBuilder_ == null) { + ensureResultSetsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, resultSets_); + onChanged(); + } else { + resultSetsBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * ResultSets, one for each statement in the request that ran successfully, in
+     * the same order as the statements in the request. Each [ResultSet][google.spanner.v1.ResultSet] will
+     * not contain any rows. The [ResultSetStats][google.spanner.v1.ResultSetStats] in each [ResultSet][google.spanner.v1.ResultSet] will
+     * contain the number of rows modified by the statement.
+     * Only the first ResultSet in the response contains a valid
+     * [ResultSetMetadata][google.spanner.v1.ResultSetMetadata].
+     * 
+ * + * repeated .google.spanner.v1.ResultSet result_sets = 1; + */ + public Builder clearResultSets() { + if (resultSetsBuilder_ == null) { + resultSets_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + resultSetsBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * ResultSets, one for each statement in the request that ran successfully, in
+     * the same order as the statements in the request. Each [ResultSet][google.spanner.v1.ResultSet] will
+     * not contain any rows. The [ResultSetStats][google.spanner.v1.ResultSetStats] in each [ResultSet][google.spanner.v1.ResultSet] will
+     * contain the number of rows modified by the statement.
+     * Only the first ResultSet in the response contains a valid
+     * [ResultSetMetadata][google.spanner.v1.ResultSetMetadata].
+     * 
+ * + * repeated .google.spanner.v1.ResultSet result_sets = 1; + */ + public Builder removeResultSets(int index) { + if (resultSetsBuilder_ == null) { + ensureResultSetsIsMutable(); + resultSets_.remove(index); + onChanged(); + } else { + resultSetsBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * ResultSets, one for each statement in the request that ran successfully, in
+     * the same order as the statements in the request. Each [ResultSet][google.spanner.v1.ResultSet] will
+     * not contain any rows. The [ResultSetStats][google.spanner.v1.ResultSetStats] in each [ResultSet][google.spanner.v1.ResultSet] will
+     * contain the number of rows modified by the statement.
+     * Only the first ResultSet in the response contains a valid
+     * [ResultSetMetadata][google.spanner.v1.ResultSetMetadata].
+     * 
+ * + * repeated .google.spanner.v1.ResultSet result_sets = 1; + */ + public com.google.spanner.v1.ResultSet.Builder getResultSetsBuilder(int index) { + return getResultSetsFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * ResultSets, one for each statement in the request that ran successfully, in
+     * the same order as the statements in the request. Each [ResultSet][google.spanner.v1.ResultSet] will
+     * not contain any rows. The [ResultSetStats][google.spanner.v1.ResultSetStats] in each [ResultSet][google.spanner.v1.ResultSet] will
+     * contain the number of rows modified by the statement.
+     * Only the first ResultSet in the response contains a valid
+     * [ResultSetMetadata][google.spanner.v1.ResultSetMetadata].
+     * 
+ * + * repeated .google.spanner.v1.ResultSet result_sets = 1; + */ + public com.google.spanner.v1.ResultSetOrBuilder getResultSetsOrBuilder(int index) { + if (resultSetsBuilder_ == null) { + return resultSets_.get(index); + } else { + return resultSetsBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * ResultSets, one for each statement in the request that ran successfully, in
+     * the same order as the statements in the request. Each [ResultSet][google.spanner.v1.ResultSet] will
+     * not contain any rows. The [ResultSetStats][google.spanner.v1.ResultSetStats] in each [ResultSet][google.spanner.v1.ResultSet] will
+     * contain the number of rows modified by the statement.
+     * Only the first ResultSet in the response contains a valid
+     * [ResultSetMetadata][google.spanner.v1.ResultSetMetadata].
+     * 
+ * + * repeated .google.spanner.v1.ResultSet result_sets = 1; + */ + public java.util.List + getResultSetsOrBuilderList() { + if (resultSetsBuilder_ != null) { + return resultSetsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(resultSets_); + } + } + /** + * + * + *
+     * ResultSets, one for each statement in the request that ran successfully, in
+     * the same order as the statements in the request. Each [ResultSet][google.spanner.v1.ResultSet] will
+     * not contain any rows. The [ResultSetStats][google.spanner.v1.ResultSetStats] in each [ResultSet][google.spanner.v1.ResultSet] will
+     * contain the number of rows modified by the statement.
+     * Only the first ResultSet in the response contains a valid
+     * [ResultSetMetadata][google.spanner.v1.ResultSetMetadata].
+     * 
+ * + * repeated .google.spanner.v1.ResultSet result_sets = 1; + */ + public com.google.spanner.v1.ResultSet.Builder addResultSetsBuilder() { + return getResultSetsFieldBuilder() + .addBuilder(com.google.spanner.v1.ResultSet.getDefaultInstance()); + } + /** + * + * + *
+     * ResultSets, one for each statement in the request that ran successfully, in
+     * the same order as the statements in the request. Each [ResultSet][google.spanner.v1.ResultSet] will
+     * not contain any rows. The [ResultSetStats][google.spanner.v1.ResultSetStats] in each [ResultSet][google.spanner.v1.ResultSet] will
+     * contain the number of rows modified by the statement.
+     * Only the first ResultSet in the response contains a valid
+     * [ResultSetMetadata][google.spanner.v1.ResultSetMetadata].
+     * 
+ * + * repeated .google.spanner.v1.ResultSet result_sets = 1; + */ + public com.google.spanner.v1.ResultSet.Builder addResultSetsBuilder(int index) { + return getResultSetsFieldBuilder() + .addBuilder(index, com.google.spanner.v1.ResultSet.getDefaultInstance()); + } + /** + * + * + *
+     * ResultSets, one for each statement in the request that ran successfully, in
+     * the same order as the statements in the request. Each [ResultSet][google.spanner.v1.ResultSet] will
+     * not contain any rows. The [ResultSetStats][google.spanner.v1.ResultSetStats] in each [ResultSet][google.spanner.v1.ResultSet] will
+     * contain the number of rows modified by the statement.
+     * Only the first ResultSet in the response contains a valid
+     * [ResultSetMetadata][google.spanner.v1.ResultSetMetadata].
+     * 
+ * + * repeated .google.spanner.v1.ResultSet result_sets = 1; + */ + public java.util.List getResultSetsBuilderList() { + return getResultSetsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.spanner.v1.ResultSet, + com.google.spanner.v1.ResultSet.Builder, + com.google.spanner.v1.ResultSetOrBuilder> + getResultSetsFieldBuilder() { + if (resultSetsBuilder_ == null) { + resultSetsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.spanner.v1.ResultSet, + com.google.spanner.v1.ResultSet.Builder, + com.google.spanner.v1.ResultSetOrBuilder>( + resultSets_, + ((bitField0_ & 0x00000001) == 0x00000001), + getParentForChildren(), + isClean()); + resultSets_ = null; + } + return resultSetsBuilder_; + } + + private com.google.rpc.Status status_ = null; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.rpc.Status, com.google.rpc.Status.Builder, com.google.rpc.StatusOrBuilder> + statusBuilder_; + /** + * + * + *
+     * If all DML statements are executed successfully, status will be OK.
+     * Otherwise, the error status of the first failed statement.
+     * 
+ * + * .google.rpc.Status status = 2; + */ + public boolean hasStatus() { + return statusBuilder_ != null || status_ != null; + } + /** + * + * + *
+     * If all DML statements are executed successfully, status will be OK.
+     * Otherwise, the error status of the first failed statement.
+     * 
+ * + * .google.rpc.Status status = 2; + */ + public com.google.rpc.Status getStatus() { + if (statusBuilder_ == null) { + return status_ == null ? com.google.rpc.Status.getDefaultInstance() : status_; + } else { + return statusBuilder_.getMessage(); + } + } + /** + * + * + *
+     * If all DML statements are executed successfully, status will be OK.
+     * Otherwise, the error status of the first failed statement.
+     * 
+ * + * .google.rpc.Status status = 2; + */ + public Builder setStatus(com.google.rpc.Status value) { + if (statusBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + status_ = value; + onChanged(); + } else { + statusBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * If all DML statements are executed successfully, status will be OK.
+     * Otherwise, the error status of the first failed statement.
+     * 
+ * + * .google.rpc.Status status = 2; + */ + public Builder setStatus(com.google.rpc.Status.Builder builderForValue) { + if (statusBuilder_ == null) { + status_ = builderForValue.build(); + onChanged(); + } else { + statusBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * If all DML statements are executed successfully, status will be OK.
+     * Otherwise, the error status of the first failed statement.
+     * 
+ * + * .google.rpc.Status status = 2; + */ + public Builder mergeStatus(com.google.rpc.Status value) { + if (statusBuilder_ == null) { + if (status_ != null) { + status_ = com.google.rpc.Status.newBuilder(status_).mergeFrom(value).buildPartial(); + } else { + status_ = value; + } + onChanged(); + } else { + statusBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * If all DML statements are executed successfully, status will be OK.
+     * Otherwise, the error status of the first failed statement.
+     * 
+ * + * .google.rpc.Status status = 2; + */ + public Builder clearStatus() { + if (statusBuilder_ == null) { + status_ = null; + onChanged(); + } else { + status_ = null; + statusBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * If all DML statements are executed successfully, status will be OK.
+     * Otherwise, the error status of the first failed statement.
+     * 
+ * + * .google.rpc.Status status = 2; + */ + public com.google.rpc.Status.Builder getStatusBuilder() { + + onChanged(); + return getStatusFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * If all DML statements are executed successfully, status will be OK.
+     * Otherwise, the error status of the first failed statement.
+     * 
+ * + * .google.rpc.Status status = 2; + */ + public com.google.rpc.StatusOrBuilder getStatusOrBuilder() { + if (statusBuilder_ != null) { + return statusBuilder_.getMessageOrBuilder(); + } else { + return status_ == null ? com.google.rpc.Status.getDefaultInstance() : status_; + } + } + /** + * + * + *
+     * If all DML statements are executed successfully, status will be OK.
+     * Otherwise, the error status of the first failed statement.
+     * 
+ * + * .google.rpc.Status status = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.rpc.Status, com.google.rpc.Status.Builder, com.google.rpc.StatusOrBuilder> + getStatusFieldBuilder() { + if (statusBuilder_ == null) { + statusBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.rpc.Status, + com.google.rpc.Status.Builder, + com.google.rpc.StatusOrBuilder>(getStatus(), getParentForChildren(), isClean()); + status_ = null; + } + return statusBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFieldsProto3(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.spanner.v1.ExecuteBatchDmlResponse) + } + + // @@protoc_insertion_point(class_scope:google.spanner.v1.ExecuteBatchDmlResponse) + private static final com.google.spanner.v1.ExecuteBatchDmlResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.spanner.v1.ExecuteBatchDmlResponse(); + } + + public static com.google.spanner.v1.ExecuteBatchDmlResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ExecuteBatchDmlResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ExecuteBatchDmlResponse(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.spanner.v1.ExecuteBatchDmlResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/google-api-grpc/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ExecuteBatchDmlResponseOrBuilder.java b/google-api-grpc/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ExecuteBatchDmlResponseOrBuilder.java new file mode 100644 index 000000000000..70ee20ca9fa5 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ExecuteBatchDmlResponseOrBuilder.java @@ -0,0 +1,120 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/spanner/v1/spanner.proto + +package com.google.spanner.v1; + +public interface ExecuteBatchDmlResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.spanner.v1.ExecuteBatchDmlResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * ResultSets, one for each statement in the request that ran successfully, in
+   * the same order as the statements in the request. Each [ResultSet][google.spanner.v1.ResultSet] will
+   * not contain any rows. The [ResultSetStats][google.spanner.v1.ResultSetStats] in each [ResultSet][google.spanner.v1.ResultSet] will
+   * contain the number of rows modified by the statement.
+   * Only the first ResultSet in the response contains a valid
+   * [ResultSetMetadata][google.spanner.v1.ResultSetMetadata].
+   * 
+ * + * repeated .google.spanner.v1.ResultSet result_sets = 1; + */ + java.util.List getResultSetsList(); + /** + * + * + *
+   * ResultSets, one for each statement in the request that ran successfully, in
+   * the same order as the statements in the request. Each [ResultSet][google.spanner.v1.ResultSet] will
+   * not contain any rows. The [ResultSetStats][google.spanner.v1.ResultSetStats] in each [ResultSet][google.spanner.v1.ResultSet] will
+   * contain the number of rows modified by the statement.
+   * Only the first ResultSet in the response contains a valid
+   * [ResultSetMetadata][google.spanner.v1.ResultSetMetadata].
+   * 
+ * + * repeated .google.spanner.v1.ResultSet result_sets = 1; + */ + com.google.spanner.v1.ResultSet getResultSets(int index); + /** + * + * + *
+   * ResultSets, one for each statement in the request that ran successfully, in
+   * the same order as the statements in the request. Each [ResultSet][google.spanner.v1.ResultSet] will
+   * not contain any rows. The [ResultSetStats][google.spanner.v1.ResultSetStats] in each [ResultSet][google.spanner.v1.ResultSet] will
+   * contain the number of rows modified by the statement.
+   * Only the first ResultSet in the response contains a valid
+   * [ResultSetMetadata][google.spanner.v1.ResultSetMetadata].
+   * 
+ * + * repeated .google.spanner.v1.ResultSet result_sets = 1; + */ + int getResultSetsCount(); + /** + * + * + *
+   * ResultSets, one for each statement in the request that ran successfully, in
+   * the same order as the statements in the request. Each [ResultSet][google.spanner.v1.ResultSet] will
+   * not contain any rows. The [ResultSetStats][google.spanner.v1.ResultSetStats] in each [ResultSet][google.spanner.v1.ResultSet] will
+   * contain the number of rows modified by the statement.
+   * Only the first ResultSet in the response contains a valid
+   * [ResultSetMetadata][google.spanner.v1.ResultSetMetadata].
+   * 
+ * + * repeated .google.spanner.v1.ResultSet result_sets = 1; + */ + java.util.List getResultSetsOrBuilderList(); + /** + * + * + *
+   * ResultSets, one for each statement in the request that ran successfully, in
+   * the same order as the statements in the request. Each [ResultSet][google.spanner.v1.ResultSet] will
+   * not contain any rows. The [ResultSetStats][google.spanner.v1.ResultSetStats] in each [ResultSet][google.spanner.v1.ResultSet] will
+   * contain the number of rows modified by the statement.
+   * Only the first ResultSet in the response contains a valid
+   * [ResultSetMetadata][google.spanner.v1.ResultSetMetadata].
+   * 
+ * + * repeated .google.spanner.v1.ResultSet result_sets = 1; + */ + com.google.spanner.v1.ResultSetOrBuilder getResultSetsOrBuilder(int index); + + /** + * + * + *
+   * If all DML statements are executed successfully, status will be OK.
+   * Otherwise, the error status of the first failed statement.
+   * 
+ * + * .google.rpc.Status status = 2; + */ + boolean hasStatus(); + /** + * + * + *
+   * If all DML statements are executed successfully, status will be OK.
+   * Otherwise, the error status of the first failed statement.
+   * 
+ * + * .google.rpc.Status status = 2; + */ + com.google.rpc.Status getStatus(); + /** + * + * + *
+   * If all DML statements are executed successfully, status will be OK.
+   * Otherwise, the error status of the first failed statement.
+   * 
+ * + * .google.rpc.Status status = 2; + */ + com.google.rpc.StatusOrBuilder getStatusOrBuilder(); +} diff --git a/google-api-grpc/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/SpannerProto.java b/google-api-grpc/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/SpannerProto.java index 36e6dd6a9095..b20abf2efdf4 100644 --- a/google-api-grpc/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/SpannerProto.java +++ b/google-api-grpc/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/SpannerProto.java @@ -48,6 +48,22 @@ public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry r internal_static_google_spanner_v1_ExecuteSqlRequest_ParamTypesEntry_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_google_spanner_v1_ExecuteSqlRequest_ParamTypesEntry_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_spanner_v1_ExecuteBatchDmlRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_spanner_v1_ExecuteBatchDmlRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_spanner_v1_ExecuteBatchDmlRequest_Statement_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_spanner_v1_ExecuteBatchDmlRequest_Statement_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_spanner_v1_ExecuteBatchDmlRequest_Statement_ParamTypesEntry_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_spanner_v1_ExecuteBatchDmlRequest_Statement_ParamTypesEntry_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_spanner_v1_ExecuteBatchDmlResponse_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_spanner_v1_ExecuteBatchDmlResponse_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_spanner_v1_PartitionOptions_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable @@ -105,135 +121,154 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "e.spanner.v1\032\034google/api/annotations.pro" + "to\032\033google/protobuf/empty.proto\032\034google/" + "protobuf/struct.proto\032\037google/protobuf/t" - + "imestamp.proto\032\034google/spanner/v1/keys.p" - + "roto\032 google/spanner/v1/mutation.proto\032\"" - + "google/spanner/v1/result_set.proto\032#goog" - + "le/spanner/v1/transaction.proto\032\034google/" - + "spanner/v1/type.proto\"U\n\024CreateSessionRe" - + "quest\022\020\n\010database\030\001 \001(\t\022+\n\007session\030\002 \001(\013" - + "2\032.google.spanner.v1.Session\"\356\001\n\007Session" - + "\022\014\n\004name\030\001 \001(\t\0226\n\006labels\030\002 \003(\0132&.google." - + "spanner.v1.Session.LabelsEntry\022/\n\013create" - + "_time\030\003 \001(\0132\032.google.protobuf.Timestamp\022" - + "=\n\031approximate_last_use_time\030\004 \001(\0132\032.goo" - + "gle.protobuf.Timestamp\032-\n\013LabelsEntry\022\013\n" - + "\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:\0028\001\"!\n\021GetSess" - + "ionRequest\022\014\n\004name\030\001 \001(\t\"^\n\023ListSessions" - + "Request\022\020\n\010database\030\001 \001(\t\022\021\n\tpage_size\030\002" - + " \001(\005\022\022\n\npage_token\030\003 \001(\t\022\016\n\006filter\030\004 \001(\t" - + "\"]\n\024ListSessionsResponse\022,\n\010sessions\030\001 \003" - + "(\0132\032.google.spanner.v1.Session\022\027\n\017next_p" - + "age_token\030\002 \001(\t\"$\n\024DeleteSessionRequest\022" - + "\014\n\004name\030\001 \001(\t\"\340\003\n\021ExecuteSqlRequest\022\017\n\007s" - + "ession\030\001 \001(\t\022;\n\013transaction\030\002 \001(\0132&.goog" - + "le.spanner.v1.TransactionSelector\022\013\n\003sql" - + "\030\003 \001(\t\022\'\n\006params\030\004 \001(\0132\027.google.protobuf" - + ".Struct\022I\n\013param_types\030\005 \003(\01324.google.sp" - + "anner.v1.ExecuteSqlRequest.ParamTypesEnt" - + "ry\022\024\n\014resume_token\030\006 \001(\014\022B\n\nquery_mode\030\007" - + " \001(\0162..google.spanner.v1.ExecuteSqlReque" - + "st.QueryMode\022\027\n\017partition_token\030\010 \001(\014\022\r\n" - + "\005seqno\030\t \001(\003\032J\n\017ParamTypesEntry\022\013\n\003key\030\001" - + " \001(\t\022&\n\005value\030\002 \001(\0132\027.google.spanner.v1." - + "Type:\0028\001\".\n\tQueryMode\022\n\n\006NORMAL\020\000\022\010\n\004PLA" - + "N\020\001\022\013\n\007PROFILE\020\002\"H\n\020PartitionOptions\022\034\n\024" - + "partition_size_bytes\030\001 \001(\003\022\026\n\016max_partit" - + "ions\030\002 \001(\003\"\366\002\n\025PartitionQueryRequest\022\017\n\007" - + "session\030\001 \001(\t\022;\n\013transaction\030\002 \001(\0132&.goo" - + "gle.spanner.v1.TransactionSelector\022\013\n\003sq" - + "l\030\003 \001(\t\022\'\n\006params\030\004 \001(\0132\027.google.protobu" - + "f.Struct\022M\n\013param_types\030\005 \003(\01328.google.s" - + "panner.v1.PartitionQueryRequest.ParamTyp" - + "esEntry\022>\n\021partition_options\030\006 \001(\0132#.goo" - + "gle.spanner.v1.PartitionOptions\032J\n\017Param" - + "TypesEntry\022\013\n\003key\030\001 \001(\t\022&\n\005value\030\002 \001(\0132\027" - + ".google.spanner.v1.Type:\0028\001\"\377\001\n\024Partitio" - + "nReadRequest\022\017\n\007session\030\001 \001(\t\022;\n\013transac" - + "tion\030\002 \001(\0132&.google.spanner.v1.Transacti" - + "onSelector\022\r\n\005table\030\003 \001(\t\022\r\n\005index\030\004 \001(\t" - + "\022\017\n\007columns\030\005 \003(\t\022*\n\007key_set\030\006 \001(\0132\031.goo" - + "gle.spanner.v1.KeySet\022>\n\021partition_optio" - + "ns\030\t \001(\0132#.google.spanner.v1.PartitionOp" - + "tions\"$\n\tPartition\022\027\n\017partition_token\030\001 " - + "\001(\014\"z\n\021PartitionResponse\0220\n\npartitions\030\001" - + " \003(\0132\034.google.spanner.v1.Partition\0223\n\013tr" - + "ansaction\030\002 \001(\0132\036.google.spanner.v1.Tran" - + "saction\"\364\001\n\013ReadRequest\022\017\n\007session\030\001 \001(\t" - + "\022;\n\013transaction\030\002 \001(\0132&.google.spanner.v" - + "1.TransactionSelector\022\r\n\005table\030\003 \001(\t\022\r\n\005" - + "index\030\004 \001(\t\022\017\n\007columns\030\005 \003(\t\022*\n\007key_set\030" - + "\006 \001(\0132\031.google.spanner.v1.KeySet\022\r\n\005limi" - + "t\030\010 \001(\003\022\024\n\014resume_token\030\t \001(\014\022\027\n\017partiti" - + "on_token\030\n \001(\014\"b\n\027BeginTransactionReques" - + "t\022\017\n\007session\030\001 \001(\t\0226\n\007options\030\002 \001(\0132%.go" - + "ogle.spanner.v1.TransactionOptions\"\302\001\n\rC" - + "ommitRequest\022\017\n\007session\030\001 \001(\t\022\030\n\016transac" - + "tion_id\030\002 \001(\014H\000\022G\n\026single_use_transactio" - + "n\030\003 \001(\0132%.google.spanner.v1.TransactionO" - + "ptionsH\000\022.\n\tmutations\030\004 \003(\0132\033.google.spa" - + "nner.v1.MutationB\r\n\013transaction\"F\n\016Commi" - + "tResponse\0224\n\020commit_timestamp\030\001 \001(\0132\032.go" - + "ogle.protobuf.Timestamp\":\n\017RollbackReque" - + "st\022\017\n\007session\030\001 \001(\t\022\026\n\016transaction_id\030\002 " - + "\001(\0142\203\021\n\007Spanner\022\233\001\n\rCreateSession\022\'.goog" - + "le.spanner.v1.CreateSessionRequest\032\032.goo" - + "gle.spanner.v1.Session\"E\202\323\344\223\002?\":/v1/{dat" - + "abase=projects/*/instances/*/databases/*" - + "}/sessions:\001*\022\220\001\n\nGetSession\022$.google.sp" - + "anner.v1.GetSessionRequest\032\032.google.span" - + "ner.v1.Session\"@\202\323\344\223\002:\0228/v1/{name=projec" - + "ts/*/instances/*/databases/*/sessions/*}" - + "\022\243\001\n\014ListSessions\022&.google.spanner.v1.Li" - + "stSessionsRequest\032\'.google.spanner.v1.Li" - + "stSessionsResponse\"B\202\323\344\223\002<\022:/v1/{databas" - + "e=projects/*/instances/*/databases/*}/se" - + "ssions\022\222\001\n\rDeleteSession\022\'.google.spanne" - + "r.v1.DeleteSessionRequest\032\026.google.proto" - + "buf.Empty\"@\202\323\344\223\002:*8/v1/{name=projects/*/" - + "instances/*/databases/*/sessions/*}\022\243\001\n\n" - + "ExecuteSql\022$.google.spanner.v1.ExecuteSq" - + "lRequest\032\034.google.spanner.v1.ResultSet\"Q" - + "\202\323\344\223\002K\"F/v1/{session=projects/*/instance" - + "s/*/databases/*/sessions/*}:executeSql:\001" - + "*\022\276\001\n\023ExecuteStreamingSql\022$.google.spann" - + "er.v1.ExecuteSqlRequest\032#.google.spanner" - + ".v1.PartialResultSet\"Z\202\323\344\223\002T\"O/v1/{sessi" - + "on=projects/*/instances/*/databases/*/se" - + "ssions/*}:executeStreamingSql:\001*0\001\022\221\001\n\004R" - + "ead\022\036.google.spanner.v1.ReadRequest\032\034.go" - + "ogle.spanner.v1.ResultSet\"K\202\323\344\223\002E\"@/v1/{" - + "session=projects/*/instances/*/databases" - + "/*/sessions/*}:read:\001*\022\254\001\n\rStreamingRead" - + "\022\036.google.spanner.v1.ReadRequest\032#.googl" - + "e.spanner.v1.PartialResultSet\"T\202\323\344\223\002N\"I/" - + "v1/{session=projects/*/instances/*/datab" - + "ases/*/sessions/*}:streamingRead:\001*0\001\022\267\001" - + "\n\020BeginTransaction\022*.google.spanner.v1.B" - + "eginTransactionRequest\032\036.google.spanner." - + "v1.Transaction\"W\202\323\344\223\002Q\"L/v1/{session=pro" - + "jects/*/instances/*/databases/*/sessions" - + "/*}:beginTransaction:\001*\022\234\001\n\006Commit\022 .goo" - + "gle.spanner.v1.CommitRequest\032!.google.sp" - + "anner.v1.CommitResponse\"M\202\323\344\223\002G\"B/v1/{se" - + "ssion=projects/*/instances/*/databases/*" - + "/sessions/*}:commit:\001*\022\227\001\n\010Rollback\022\".go" - + "ogle.spanner.v1.RollbackRequest\032\026.google" - + ".protobuf.Empty\"O\202\323\344\223\002I\"D/v1/{session=pr" + + "imestamp.proto\032\027google/rpc/status.proto\032" + + "\034google/spanner/v1/keys.proto\032 google/sp" + + "anner/v1/mutation.proto\032\"google/spanner/" + + "v1/result_set.proto\032#google/spanner/v1/t" + + "ransaction.proto\032\034google/spanner/v1/type" + + ".proto\"U\n\024CreateSessionRequest\022\020\n\010databa" + + "se\030\001 \001(\t\022+\n\007session\030\002 \001(\0132\032.google.spann" + + "er.v1.Session\"\356\001\n\007Session\022\014\n\004name\030\001 \001(\t\022" + + "6\n\006labels\030\002 \003(\0132&.google.spanner.v1.Sess" + + "ion.LabelsEntry\022/\n\013create_time\030\003 \001(\0132\032.g" + + "oogle.protobuf.Timestamp\022=\n\031approximate_" + + "last_use_time\030\004 \001(\0132\032.google.protobuf.Ti" + + "mestamp\032-\n\013LabelsEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005v" + + "alue\030\002 \001(\t:\0028\001\"!\n\021GetSessionRequest\022\014\n\004n" + + "ame\030\001 \001(\t\"^\n\023ListSessionsRequest\022\020\n\010data" + + "base\030\001 \001(\t\022\021\n\tpage_size\030\002 \001(\005\022\022\n\npage_to" + + "ken\030\003 \001(\t\022\016\n\006filter\030\004 \001(\t\"]\n\024ListSession" + + "sResponse\022,\n\010sessions\030\001 \003(\0132\032.google.spa" + + "nner.v1.Session\022\027\n\017next_page_token\030\002 \001(\t" + + "\"$\n\024DeleteSessionRequest\022\014\n\004name\030\001 \001(\t\"\340" + + "\003\n\021ExecuteSqlRequest\022\017\n\007session\030\001 \001(\t\022;\n" + + "\013transaction\030\002 \001(\0132&.google.spanner.v1.T" + + "ransactionSelector\022\013\n\003sql\030\003 \001(\t\022\'\n\006param" + + "s\030\004 \001(\0132\027.google.protobuf.Struct\022I\n\013para" + + "m_types\030\005 \003(\01324.google.spanner.v1.Execut" + + "eSqlRequest.ParamTypesEntry\022\024\n\014resume_to" + + "ken\030\006 \001(\014\022B\n\nquery_mode\030\007 \001(\0162..google.s" + + "panner.v1.ExecuteSqlRequest.QueryMode\022\027\n" + + "\017partition_token\030\010 \001(\014\022\r\n\005seqno\030\t \001(\003\032J\n" + + "\017ParamTypesEntry\022\013\n\003key\030\001 \001(\t\022&\n\005value\030\002" + + " \001(\0132\027.google.spanner.v1.Type:\0028\001\".\n\tQue" + + "ryMode\022\n\n\006NORMAL\020\000\022\010\n\004PLAN\020\001\022\013\n\007PROFILE\020" + + "\002\"\250\003\n\026ExecuteBatchDmlRequest\022\017\n\007session\030" + + "\001 \001(\t\022;\n\013transaction\030\002 \001(\0132&.google.span" + + "ner.v1.TransactionSelector\022G\n\nstatements" + + "\030\003 \003(\01323.google.spanner.v1.ExecuteBatchD" + + "mlRequest.Statement\022\r\n\005seqno\030\004 \001(\003\032\347\001\n\tS" + + "tatement\022\013\n\003sql\030\001 \001(\t\022\'\n\006params\030\002 \001(\0132\027." + + "google.protobuf.Struct\022X\n\013param_types\030\003 " + + "\003(\0132C.google.spanner.v1.ExecuteBatchDmlR" + + "equest.Statement.ParamTypesEntry\032J\n\017Para" + + "mTypesEntry\022\013\n\003key\030\001 \001(\t\022&\n\005value\030\002 \001(\0132" + + "\027.google.spanner.v1.Type:\0028\001\"p\n\027ExecuteB" + + "atchDmlResponse\0221\n\013result_sets\030\001 \003(\0132\034.g" + + "oogle.spanner.v1.ResultSet\022\"\n\006status\030\002 \001" + + "(\0132\022.google.rpc.Status\"H\n\020PartitionOptio" + + "ns\022\034\n\024partition_size_bytes\030\001 \001(\003\022\026\n\016max_" + + "partitions\030\002 \001(\003\"\366\002\n\025PartitionQueryReque" + + "st\022\017\n\007session\030\001 \001(\t\022;\n\013transaction\030\002 \001(\013" + + "2&.google.spanner.v1.TransactionSelector" + + "\022\013\n\003sql\030\003 \001(\t\022\'\n\006params\030\004 \001(\0132\027.google.p" + + "rotobuf.Struct\022M\n\013param_types\030\005 \003(\01328.go" + + "ogle.spanner.v1.PartitionQueryRequest.Pa" + + "ramTypesEntry\022>\n\021partition_options\030\006 \001(\013" + + "2#.google.spanner.v1.PartitionOptions\032J\n" + + "\017ParamTypesEntry\022\013\n\003key\030\001 \001(\t\022&\n\005value\030\002" + + " \001(\0132\027.google.spanner.v1.Type:\0028\001\"\377\001\n\024Pa" + + "rtitionReadRequest\022\017\n\007session\030\001 \001(\t\022;\n\013t" + + "ransaction\030\002 \001(\0132&.google.spanner.v1.Tra" + + "nsactionSelector\022\r\n\005table\030\003 \001(\t\022\r\n\005index" + + "\030\004 \001(\t\022\017\n\007columns\030\005 \003(\t\022*\n\007key_set\030\006 \001(\013" + + "2\031.google.spanner.v1.KeySet\022>\n\021partition" + + "_options\030\t \001(\0132#.google.spanner.v1.Parti" + + "tionOptions\"$\n\tPartition\022\027\n\017partition_to" + + "ken\030\001 \001(\014\"z\n\021PartitionResponse\0220\n\npartit" + + "ions\030\001 \003(\0132\034.google.spanner.v1.Partition" + + "\0223\n\013transaction\030\002 \001(\0132\036.google.spanner.v" + + "1.Transaction\"\364\001\n\013ReadRequest\022\017\n\007session" + + "\030\001 \001(\t\022;\n\013transaction\030\002 \001(\0132&.google.spa" + + "nner.v1.TransactionSelector\022\r\n\005table\030\003 \001" + + "(\t\022\r\n\005index\030\004 \001(\t\022\017\n\007columns\030\005 \003(\t\022*\n\007ke" + + "y_set\030\006 \001(\0132\031.google.spanner.v1.KeySet\022\r" + + "\n\005limit\030\010 \001(\003\022\024\n\014resume_token\030\t \001(\014\022\027\n\017p" + + "artition_token\030\n \001(\014\"b\n\027BeginTransaction" + + "Request\022\017\n\007session\030\001 \001(\t\0226\n\007options\030\002 \001(" + + "\0132%.google.spanner.v1.TransactionOptions" + + "\"\302\001\n\rCommitRequest\022\017\n\007session\030\001 \001(\t\022\030\n\016t" + + "ransaction_id\030\002 \001(\014H\000\022G\n\026single_use_tran" + + "saction\030\003 \001(\0132%.google.spanner.v1.Transa" + + "ctionOptionsH\000\022.\n\tmutations\030\004 \003(\0132\033.goog" + + "le.spanner.v1.MutationB\r\n\013transaction\"F\n" + + "\016CommitResponse\0224\n\020commit_timestamp\030\001 \001(" + + "\0132\032.google.protobuf.Timestamp\":\n\017Rollbac" + + "kRequest\022\017\n\007session\030\001 \001(\t\022\026\n\016transaction" + + "_id\030\002 \001(\0142\306\022\n\007Spanner\022\233\001\n\rCreateSession\022" + + "\'.google.spanner.v1.CreateSessionRequest" + + "\032\032.google.spanner.v1.Session\"E\202\323\344\223\002?\":/v" + + "1/{database=projects/*/instances/*/datab" + + "ases/*}/sessions:\001*\022\220\001\n\nGetSession\022$.goo" + + "gle.spanner.v1.GetSessionRequest\032\032.googl" + + "e.spanner.v1.Session\"@\202\323\344\223\002:\0228/v1/{name=" + + "projects/*/instances/*/databases/*/sessi" + + "ons/*}\022\243\001\n\014ListSessions\022&.google.spanner" + + ".v1.ListSessionsRequest\032\'.google.spanner" + + ".v1.ListSessionsResponse\"B\202\323\344\223\002<\022:/v1/{d" + + "atabase=projects/*/instances/*/databases" + + "/*}/sessions\022\222\001\n\rDeleteSession\022\'.google." + + "spanner.v1.DeleteSessionRequest\032\026.google" + + ".protobuf.Empty\"@\202\323\344\223\002:*8/v1/{name=proje" + + "cts/*/instances/*/databases/*/sessions/*" + + "}\022\243\001\n\nExecuteSql\022$.google.spanner.v1.Exe" + + "cuteSqlRequest\032\034.google.spanner.v1.Resul" + + "tSet\"Q\202\323\344\223\002K\"F/v1/{session=projects/*/in" + + "stances/*/databases/*/sessions/*}:execut" + + "eSql:\001*\022\276\001\n\023ExecuteStreamingSql\022$.google" + + ".spanner.v1.ExecuteSqlRequest\032#.google.s" + + "panner.v1.PartialResultSet\"Z\202\323\344\223\002T\"O/v1/" + + "{session=projects/*/instances/*/database" + + "s/*/sessions/*}:executeStreamingSql:\001*0\001" + + "\022\300\001\n\017ExecuteBatchDml\022).google.spanner.v1" + + ".ExecuteBatchDmlRequest\032*.google.spanner" + + ".v1.ExecuteBatchDmlResponse\"V\202\323\344\223\002P\"K/v1" + + "/{session=projects/*/instances/*/databas" + + "es/*/sessions/*}:executeBatchDml:\001*\022\221\001\n\004" + + "Read\022\036.google.spanner.v1.ReadRequest\032\034.g" + + "oogle.spanner.v1.ResultSet\"K\202\323\344\223\002E\"@/v1/" + + "{session=projects/*/instances/*/database" + + "s/*/sessions/*}:read:\001*\022\254\001\n\rStreamingRea" + + "d\022\036.google.spanner.v1.ReadRequest\032#.goog" + + "le.spanner.v1.PartialResultSet\"T\202\323\344\223\002N\"I" + + "/v1/{session=projects/*/instances/*/data" + + "bases/*/sessions/*}:streamingRead:\001*0\001\022\267" + + "\001\n\020BeginTransaction\022*.google.spanner.v1." + + "BeginTransactionRequest\032\036.google.spanner" + + ".v1.Transaction\"W\202\323\344\223\002Q\"L/v1/{session=pr" + "ojects/*/instances/*/databases/*/session" - + "s/*}:rollback:\001*\022\267\001\n\016PartitionQuery\022(.go" - + "ogle.spanner.v1.PartitionQueryRequest\032$." - + "google.spanner.v1.PartitionResponse\"U\202\323\344" - + "\223\002O\"J/v1/{session=projects/*/instances/*" - + "/databases/*/sessions/*}:partitionQuery:" - + "\001*\022\264\001\n\rPartitionRead\022\'.google.spanner.v1" - + ".PartitionReadRequest\032$.google.spanner.v" - + "1.PartitionResponse\"T\202\323\344\223\002N\"I/v1/{sessio" - + "n=projects/*/instances/*/databases/*/ses" - + "sions/*}:partitionRead:\001*B\225\001\n\025com.google" - + ".spanner.v1B\014SpannerProtoP\001Z8google.gola" - + "ng.org/genproto/googleapis/spanner/v1;sp" - + "anner\252\002\027Google.Cloud.Spanner.V1\312\002\027Google" - + "\\Cloud\\Spanner\\V1b\006proto3" + + "s/*}:beginTransaction:\001*\022\234\001\n\006Commit\022 .go" + + "ogle.spanner.v1.CommitRequest\032!.google.s" + + "panner.v1.CommitResponse\"M\202\323\344\223\002G\"B/v1/{s" + + "ession=projects/*/instances/*/databases/" + + "*/sessions/*}:commit:\001*\022\227\001\n\010Rollback\022\".g" + + "oogle.spanner.v1.RollbackRequest\032\026.googl" + + "e.protobuf.Empty\"O\202\323\344\223\002I\"D/v1/{session=p" + + "rojects/*/instances/*/databases/*/sessio" + + "ns/*}:rollback:\001*\022\267\001\n\016PartitionQuery\022(.g" + + "oogle.spanner.v1.PartitionQueryRequest\032$" + + ".google.spanner.v1.PartitionResponse\"U\202\323" + + "\344\223\002O\"J/v1/{session=projects/*/instances/" + + "*/databases/*/sessions/*}:partitionQuery" + + ":\001*\022\264\001\n\rPartitionRead\022\'.google.spanner.v" + + "1.PartitionReadRequest\032$.google.spanner." + + "v1.PartitionResponse\"T\202\323\344\223\002N\"I/v1/{sessi" + + "on=projects/*/instances/*/databases/*/se" + + "ssions/*}:partitionRead:\001*B\225\001\n\025com.googl" + + "e.spanner.v1B\014SpannerProtoP\001Z8google.gol" + + "ang.org/genproto/googleapis/spanner/v1;s" + + "panner\252\002\027Google.Cloud.Spanner.V1\312\002\027Googl" + + "e\\Cloud\\Spanner\\V1b\006proto3" }; com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { @@ -250,6 +285,7 @@ public com.google.protobuf.ExtensionRegistry assignDescriptors( com.google.protobuf.EmptyProto.getDescriptor(), com.google.protobuf.StructProto.getDescriptor(), com.google.protobuf.TimestampProto.getDescriptor(), + com.google.rpc.StatusProto.getDescriptor(), com.google.spanner.v1.KeysProto.getDescriptor(), com.google.spanner.v1.MutationProto.getDescriptor(), com.google.spanner.v1.ResultSetProto.getDescriptor(), @@ -336,8 +372,42 @@ public com.google.protobuf.ExtensionRegistry assignDescriptors( new java.lang.String[] { "Key", "Value", }); - internal_static_google_spanner_v1_PartitionOptions_descriptor = + internal_static_google_spanner_v1_ExecuteBatchDmlRequest_descriptor = getDescriptor().getMessageTypes().get(7); + internal_static_google_spanner_v1_ExecuteBatchDmlRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_spanner_v1_ExecuteBatchDmlRequest_descriptor, + new java.lang.String[] { + "Session", "Transaction", "Statements", "Seqno", + }); + internal_static_google_spanner_v1_ExecuteBatchDmlRequest_Statement_descriptor = + internal_static_google_spanner_v1_ExecuteBatchDmlRequest_descriptor.getNestedTypes().get(0); + internal_static_google_spanner_v1_ExecuteBatchDmlRequest_Statement_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_spanner_v1_ExecuteBatchDmlRequest_Statement_descriptor, + new java.lang.String[] { + "Sql", "Params", "ParamTypes", + }); + internal_static_google_spanner_v1_ExecuteBatchDmlRequest_Statement_ParamTypesEntry_descriptor = + internal_static_google_spanner_v1_ExecuteBatchDmlRequest_Statement_descriptor + .getNestedTypes() + .get(0); + internal_static_google_spanner_v1_ExecuteBatchDmlRequest_Statement_ParamTypesEntry_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_spanner_v1_ExecuteBatchDmlRequest_Statement_ParamTypesEntry_descriptor, + new java.lang.String[] { + "Key", "Value", + }); + internal_static_google_spanner_v1_ExecuteBatchDmlResponse_descriptor = + getDescriptor().getMessageTypes().get(8); + internal_static_google_spanner_v1_ExecuteBatchDmlResponse_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_spanner_v1_ExecuteBatchDmlResponse_descriptor, + new java.lang.String[] { + "ResultSets", "Status", + }); + internal_static_google_spanner_v1_PartitionOptions_descriptor = + getDescriptor().getMessageTypes().get(9); internal_static_google_spanner_v1_PartitionOptions_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_spanner_v1_PartitionOptions_descriptor, @@ -345,7 +415,7 @@ public com.google.protobuf.ExtensionRegistry assignDescriptors( "PartitionSizeBytes", "MaxPartitions", }); internal_static_google_spanner_v1_PartitionQueryRequest_descriptor = - getDescriptor().getMessageTypes().get(8); + getDescriptor().getMessageTypes().get(10); internal_static_google_spanner_v1_PartitionQueryRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_spanner_v1_PartitionQueryRequest_descriptor, @@ -361,7 +431,7 @@ public com.google.protobuf.ExtensionRegistry assignDescriptors( "Key", "Value", }); internal_static_google_spanner_v1_PartitionReadRequest_descriptor = - getDescriptor().getMessageTypes().get(9); + getDescriptor().getMessageTypes().get(11); internal_static_google_spanner_v1_PartitionReadRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_spanner_v1_PartitionReadRequest_descriptor, @@ -369,7 +439,7 @@ public com.google.protobuf.ExtensionRegistry assignDescriptors( "Session", "Transaction", "Table", "Index", "Columns", "KeySet", "PartitionOptions", }); internal_static_google_spanner_v1_Partition_descriptor = - getDescriptor().getMessageTypes().get(10); + getDescriptor().getMessageTypes().get(12); internal_static_google_spanner_v1_Partition_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_spanner_v1_Partition_descriptor, @@ -377,7 +447,7 @@ public com.google.protobuf.ExtensionRegistry assignDescriptors( "PartitionToken", }); internal_static_google_spanner_v1_PartitionResponse_descriptor = - getDescriptor().getMessageTypes().get(11); + getDescriptor().getMessageTypes().get(13); internal_static_google_spanner_v1_PartitionResponse_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_spanner_v1_PartitionResponse_descriptor, @@ -385,7 +455,7 @@ public com.google.protobuf.ExtensionRegistry assignDescriptors( "Partitions", "Transaction", }); internal_static_google_spanner_v1_ReadRequest_descriptor = - getDescriptor().getMessageTypes().get(12); + getDescriptor().getMessageTypes().get(14); internal_static_google_spanner_v1_ReadRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_spanner_v1_ReadRequest_descriptor, @@ -401,7 +471,7 @@ public com.google.protobuf.ExtensionRegistry assignDescriptors( "PartitionToken", }); internal_static_google_spanner_v1_BeginTransactionRequest_descriptor = - getDescriptor().getMessageTypes().get(13); + getDescriptor().getMessageTypes().get(15); internal_static_google_spanner_v1_BeginTransactionRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_spanner_v1_BeginTransactionRequest_descriptor, @@ -409,7 +479,7 @@ public com.google.protobuf.ExtensionRegistry assignDescriptors( "Session", "Options", }); internal_static_google_spanner_v1_CommitRequest_descriptor = - getDescriptor().getMessageTypes().get(14); + getDescriptor().getMessageTypes().get(16); internal_static_google_spanner_v1_CommitRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_spanner_v1_CommitRequest_descriptor, @@ -417,7 +487,7 @@ public com.google.protobuf.ExtensionRegistry assignDescriptors( "Session", "TransactionId", "SingleUseTransaction", "Mutations", "Transaction", }); internal_static_google_spanner_v1_CommitResponse_descriptor = - getDescriptor().getMessageTypes().get(15); + getDescriptor().getMessageTypes().get(17); internal_static_google_spanner_v1_CommitResponse_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_spanner_v1_CommitResponse_descriptor, @@ -425,7 +495,7 @@ public com.google.protobuf.ExtensionRegistry assignDescriptors( "CommitTimestamp", }); internal_static_google_spanner_v1_RollbackRequest_descriptor = - getDescriptor().getMessageTypes().get(16); + getDescriptor().getMessageTypes().get(18); internal_static_google_spanner_v1_RollbackRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_spanner_v1_RollbackRequest_descriptor, @@ -441,6 +511,7 @@ public com.google.protobuf.ExtensionRegistry assignDescriptors( com.google.protobuf.EmptyProto.getDescriptor(); com.google.protobuf.StructProto.getDescriptor(); com.google.protobuf.TimestampProto.getDescriptor(); + com.google.rpc.StatusProto.getDescriptor(); com.google.spanner.v1.KeysProto.getDescriptor(); com.google.spanner.v1.MutationProto.getDescriptor(); com.google.spanner.v1.ResultSetProto.getDescriptor(); diff --git a/google-api-grpc/proto-google-cloud-spanner-v1/src/main/proto/google/spanner/v1/spanner.proto b/google-api-grpc/proto-google-cloud-spanner-v1/src/main/proto/google/spanner/v1/spanner.proto index 7a01fb5e9dc3..b2091c92f7e1 100644 --- a/google-api-grpc/proto-google-cloud-spanner-v1/src/main/proto/google/spanner/v1/spanner.proto +++ b/google-api-grpc/proto-google-cloud-spanner-v1/src/main/proto/google/spanner/v1/spanner.proto @@ -1,4 +1,4 @@ -// Copyright 2018 Google LLC +// Copyright 2018 Google LLC. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -11,6 +11,7 @@ // 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. +// syntax = "proto3"; @@ -20,6 +21,7 @@ import "google/api/annotations.proto"; import "google/protobuf/empty.proto"; import "google/protobuf/struct.proto"; import "google/protobuf/timestamp.proto"; +import "google/rpc/status.proto"; import "google/spanner/v1/keys.proto"; import "google/spanner/v1/mutation.proto"; import "google/spanner/v1/result_set.proto"; @@ -80,7 +82,9 @@ service Spanner { }; } - // Ends a session, releasing server resources associated with it. + // Ends a session, releasing server resources associated with it. This will + // asynchronously trigger cancellation of any operations that are running with + // this session. rpc DeleteSession(DeleteSessionRequest) returns (google.protobuf.Empty) { option (google.api.http) = { delete: "/v1/{name=projects/*/instances/*/databases/*/sessions/*}" @@ -119,6 +123,32 @@ service Spanner { }; } + // Executes a batch of SQL DML statements. This method allows many statements + // to be run with lower latency than submitting them sequentially with + // [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql]. + // + // Statements are executed in order, sequentially. + // [ExecuteBatchDmlResponse][Spanner.ExecuteBatchDmlResponse] will contain a + // [ResultSet][google.spanner.v1.ResultSet] for each DML statement that has successfully executed. If a + // statement fails, its error status will be returned as part of the + // [ExecuteBatchDmlResponse][Spanner.ExecuteBatchDmlResponse]. Execution will + // stop at the first failed statement; the remaining statements will not run. + // + // ExecuteBatchDml is expected to return an OK status with a response even if + // there was an error while processing one of the DML statements. Clients must + // inspect response.status to determine if there were any errors while + // processing the request. + // + // See more details in + // [ExecuteBatchDmlRequest][Spanner.ExecuteBatchDmlRequest] and + // [ExecuteBatchDmlResponse][Spanner.ExecuteBatchDmlResponse]. + rpc ExecuteBatchDml(ExecuteBatchDmlRequest) returns (ExecuteBatchDmlResponse) { + option (google.api.http) = { + post: "/v1/{session=projects/*/instances/*/databases/*/sessions/*}:executeBatchDml" + body: "*" + }; + } + // Reads rows from the database using key lookups and scans, as a // simple key/value style alternative to // [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql]. This method cannot be @@ -421,6 +451,97 @@ message ExecuteSqlRequest { int64 seqno = 9; } +// The request for [ExecuteBatchDml][google.spanner.v1.Spanner.ExecuteBatchDml] +message ExecuteBatchDmlRequest { + // A single DML statement. + message Statement { + // Required. The DML string. + string sql = 1; + + // The DML string can contain parameter placeholders. A parameter + // placeholder consists of `'@'` followed by the parameter + // name. Parameter names consist of any combination of letters, + // numbers, and underscores. + // + // 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 an SQL statement with unbound parameters. + // + // Parameter values are specified using `params`, which is a JSON + // object whose keys are parameter names, and whose values are the + // corresponding parameter values. + google.protobuf.Struct params = 2; + + // 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][google.spanner.v1.ExecuteBatchDmlRequest.Statement.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][google.spanner.v1.Type] for more information + // about SQL types. + map param_types = 3; + } + + // Required. The session in which the DML statements should be performed. + string session = 1; + + // The transaction to use. A ReadWrite transaction is required. Single-use + // transactions are not supported (to avoid replay). The caller must either + // supply an existing transaction ID or begin a new transaction. + TransactionSelector transaction = 2; + + // The list of statements to execute in this batch. Statements are executed + // serially, such that the effects of statement i are visible to statement + // i+1. Each statement must be a DML statement. Execution will stop at the + // first failed statement; the remaining statements will not run. + // + // REQUIRES: statements_size() > 0. + repeated Statement statements = 3; + + // A per-transaction sequence number used to identify this request. This is + // used in the same space as the seqno in + // [ExecuteSqlRequest][Spanner.ExecuteSqlRequest]. See more details + // in [ExecuteSqlRequest][Spanner.ExecuteSqlRequest]. + int64 seqno = 4; +} + +// The response for [ExecuteBatchDml][google.spanner.v1.Spanner.ExecuteBatchDml]. Contains a list +// of [ResultSet][google.spanner.v1.ResultSet], one for each DML statement that has successfully executed. +// If a statement fails, the error is returned as part of the response payload. +// Clients can determine whether all DML statements have run successfully, or if +// a statement failed, using one of the following approaches: +// +// 1. Check if 'status' field is OkStatus. +// 2. Check if result_sets_size() equals the number of statements in +// [ExecuteBatchDmlRequest][Spanner.ExecuteBatchDmlRequest]. +// +// Example 1: A request with 5 DML statements, all executed successfully. +// Result: A response with 5 ResultSets, one for each statement in the same +// order, and an OK status. +// +// Example 2: A request with 5 DML statements. The 3rd statement has a syntax +// error. +// Result: A response with 2 ResultSets, for the first 2 statements that +// run successfully, and a syntax error (INVALID_ARGUMENT) status. From +// result_set_size() client can determine that the 3rd statement has failed. +message ExecuteBatchDmlResponse { + // ResultSets, one for each statement in the request that ran successfully, in + // the same order as the statements in the request. Each [ResultSet][google.spanner.v1.ResultSet] will + // not contain any rows. The [ResultSetStats][google.spanner.v1.ResultSetStats] in each [ResultSet][google.spanner.v1.ResultSet] will + // contain the number of rows modified by the statement. + // + // Only the first ResultSet in the response contains a valid + // [ResultSetMetadata][google.spanner.v1.ResultSetMetadata]. + repeated ResultSet result_sets = 1; + + // If all DML statements are executed successfully, status will be OK. + // Otherwise, the error status of the first failed statement. + google.rpc.Status status = 2; +} + // Options for a PartitionQueryRequest and // PartitionReadRequest. message PartitionOptions { diff --git a/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/DatabaseAdminClient.java b/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/DatabaseAdminClient.java index 1f611ca292ee..2b454965fb85 100644 --- a/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/DatabaseAdminClient.java +++ b/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/DatabaseAdminClient.java @@ -29,6 +29,7 @@ import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.spanner.admin.database.v1.stub.DatabaseAdminStub; import com.google.cloud.spanner.admin.database.v1.stub.DatabaseAdminStubSettings; +import com.google.common.util.concurrent.MoreExecutors; import com.google.iam.v1.GetIamPolicyRequest; import com.google.iam.v1.Policy; import com.google.iam.v1.SetIamPolicyRequest; @@ -1272,7 +1273,8 @@ public static ApiFuture createAsync( public ListDatabasesPagedResponse apply(ListDatabasesPage input) { return new ListDatabasesPagedResponse(input); } - }); + }, + MoreExecutors.directExecutor()); } private ListDatabasesPagedResponse(ListDatabasesPage page) { diff --git a/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/instance/v1/InstanceAdminClient.java b/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/instance/v1/InstanceAdminClient.java index 94bc50a45fcc..52eef3b3cb53 100644 --- a/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/instance/v1/InstanceAdminClient.java +++ b/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/instance/v1/InstanceAdminClient.java @@ -29,6 +29,7 @@ import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.spanner.admin.instance.v1.stub.InstanceAdminStub; import com.google.cloud.spanner.admin.instance.v1.stub.InstanceAdminStubSettings; +import com.google.common.util.concurrent.MoreExecutors; import com.google.iam.v1.GetIamPolicyRequest; import com.google.iam.v1.Policy; import com.google.iam.v1.SetIamPolicyRequest; @@ -1641,7 +1642,8 @@ public static ApiFuture createAsync( public ListInstanceConfigsPagedResponse apply(ListInstanceConfigsPage input) { return new ListInstanceConfigsPagedResponse(input); } - }); + }, + MoreExecutors.directExecutor()); } private ListInstanceConfigsPagedResponse(ListInstanceConfigsPage page) { @@ -1728,7 +1730,8 @@ public static ApiFuture createAsync( public ListInstancesPagedResponse apply(ListInstancesPage input) { return new ListInstancesPagedResponse(input); } - }); + }, + MoreExecutors.directExecutor()); } private ListInstancesPagedResponse(ListInstancesPage page) { diff --git a/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/v1/SpannerClient.java b/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/v1/SpannerClient.java index cf6633182073..7543b54fccdc 100644 --- a/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/v1/SpannerClient.java +++ b/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/v1/SpannerClient.java @@ -28,6 +28,7 @@ import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.spanner.v1.stub.SpannerStub; import com.google.cloud.spanner.v1.stub.SpannerStubSettings; +import com.google.common.util.concurrent.MoreExecutors; import com.google.protobuf.ByteString; import com.google.protobuf.Empty; import com.google.spanner.v1.BeginTransactionRequest; @@ -36,6 +37,8 @@ import com.google.spanner.v1.CreateSessionRequest; import com.google.spanner.v1.DatabaseName; import com.google.spanner.v1.DeleteSessionRequest; +import com.google.spanner.v1.ExecuteBatchDmlRequest; +import com.google.spanner.v1.ExecuteBatchDmlResponse; import com.google.spanner.v1.ExecuteSqlRequest; import com.google.spanner.v1.GetSessionRequest; import com.google.spanner.v1.ListSessionsRequest; @@ -525,7 +528,8 @@ public final UnaryCallable listSessio // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Ends a session, releasing server resources associated with it. + * Ends a session, releasing server resources associated with it. This will asynchronously trigger + * cancellation of any operations that are running with this session. * *

Sample code: * @@ -548,7 +552,8 @@ public final void deleteSession(SessionName name) { // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Ends a session, releasing server resources associated with it. + * Ends a session, releasing server resources associated with it. This will asynchronously trigger + * cancellation of any operations that are running with this session. * *

Sample code: * @@ -570,7 +575,8 @@ public final void deleteSession(String name) { // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Ends a session, releasing server resources associated with it. + * Ends a session, releasing server resources associated with it. This will asynchronously trigger + * cancellation of any operations that are running with this session. * *

Sample code: * @@ -593,7 +599,8 @@ public final void deleteSession(DeleteSessionRequest request) { // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Ends a session, releasing server resources associated with it. + * Ends a session, releasing server resources associated with it. This will asynchronously trigger + * cancellation of any operations that are running with this session. * *

Sample code: * @@ -710,6 +717,96 @@ public final UnaryCallable executeSqlCallable() { return stub.executeStreamingSqlCallable(); } + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Executes a batch of SQL DML statements. This method allows many statements to be run with lower + * latency than submitting them sequentially with + * [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql]. + * + *

Statements are executed in order, sequentially. + * [ExecuteBatchDmlResponse][Spanner.ExecuteBatchDmlResponse] will contain a + * [ResultSet][google.spanner.v1.ResultSet] for each DML statement that has successfully executed. + * If a statement fails, its error status will be returned as part of the + * [ExecuteBatchDmlResponse][Spanner.ExecuteBatchDmlResponse]. Execution will stop at the first + * failed statement; the remaining statements will not run. + * + *

ExecuteBatchDml is expected to return an OK status with a response even if there was an + * error while processing one of the DML statements. Clients must inspect response.status to + * determine if there were any errors while processing the request. + * + *

See more details in [ExecuteBatchDmlRequest][Spanner.ExecuteBatchDmlRequest] and + * [ExecuteBatchDmlResponse][Spanner.ExecuteBatchDmlResponse]. + * + *

Sample code: + * + *


+   * try (SpannerClient spannerClient = SpannerClient.create()) {
+   *   SessionName session = SessionName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]");
+   *   TransactionSelector transaction = TransactionSelector.newBuilder().build();
+   *   List<ExecuteBatchDmlRequest.Statement> statements = new ArrayList<>();
+   *   long seqno = 0L;
+   *   ExecuteBatchDmlRequest request = ExecuteBatchDmlRequest.newBuilder()
+   *     .setSession(session.toString())
+   *     .setTransaction(transaction)
+   *     .addAllStatements(statements)
+   *     .setSeqno(seqno)
+   *     .build();
+   *   ExecuteBatchDmlResponse response = spannerClient.executeBatchDml(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ExecuteBatchDmlResponse executeBatchDml(ExecuteBatchDmlRequest request) { + return executeBatchDmlCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Executes a batch of SQL DML statements. This method allows many statements to be run with lower + * latency than submitting them sequentially with + * [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql]. + * + *

Statements are executed in order, sequentially. + * [ExecuteBatchDmlResponse][Spanner.ExecuteBatchDmlResponse] will contain a + * [ResultSet][google.spanner.v1.ResultSet] for each DML statement that has successfully executed. + * If a statement fails, its error status will be returned as part of the + * [ExecuteBatchDmlResponse][Spanner.ExecuteBatchDmlResponse]. Execution will stop at the first + * failed statement; the remaining statements will not run. + * + *

ExecuteBatchDml is expected to return an OK status with a response even if there was an + * error while processing one of the DML statements. Clients must inspect response.status to + * determine if there were any errors while processing the request. + * + *

See more details in [ExecuteBatchDmlRequest][Spanner.ExecuteBatchDmlRequest] and + * [ExecuteBatchDmlResponse][Spanner.ExecuteBatchDmlResponse]. + * + *

Sample code: + * + *


+   * try (SpannerClient spannerClient = SpannerClient.create()) {
+   *   SessionName session = SessionName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]");
+   *   TransactionSelector transaction = TransactionSelector.newBuilder().build();
+   *   List<ExecuteBatchDmlRequest.Statement> statements = new ArrayList<>();
+   *   long seqno = 0L;
+   *   ExecuteBatchDmlRequest request = ExecuteBatchDmlRequest.newBuilder()
+   *     .setSession(session.toString())
+   *     .setTransaction(transaction)
+   *     .addAllStatements(statements)
+   *     .setSeqno(seqno)
+   *     .build();
+   *   ApiFuture<ExecuteBatchDmlResponse> future = spannerClient.executeBatchDmlCallable().futureCall(request);
+   *   // Do something
+   *   ExecuteBatchDmlResponse response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable + executeBatchDmlCallable() { + return stub.executeBatchDmlCallable(); + } + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Reads rows from the database using key lookups and scans, as a simple key/value style @@ -1475,7 +1572,8 @@ public static ApiFuture createAsync( public ListSessionsPagedResponse apply(ListSessionsPage input) { return new ListSessionsPagedResponse(input); } - }); + }, + MoreExecutors.directExecutor()); } private ListSessionsPagedResponse(ListSessionsPage page) { diff --git a/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/v1/SpannerSettings.java b/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/v1/SpannerSettings.java index e6bc753f5c95..59d76f84329a 100644 --- a/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/v1/SpannerSettings.java +++ b/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/v1/SpannerSettings.java @@ -36,6 +36,8 @@ import com.google.spanner.v1.CommitResponse; import com.google.spanner.v1.CreateSessionRequest; import com.google.spanner.v1.DeleteSessionRequest; +import com.google.spanner.v1.ExecuteBatchDmlRequest; +import com.google.spanner.v1.ExecuteBatchDmlResponse; import com.google.spanner.v1.ExecuteSqlRequest; import com.google.spanner.v1.GetSessionRequest; import com.google.spanner.v1.ListSessionsRequest; @@ -113,6 +115,12 @@ public UnaryCallSettings executeSqlSettings() { return ((SpannerStubSettings) getStubSettings()).executeStreamingSqlSettings(); } + /** Returns the object with the settings used for calls to executeBatchDml. */ + public UnaryCallSettings + executeBatchDmlSettings() { + return ((SpannerStubSettings) getStubSettings()).executeBatchDmlSettings(); + } + /** Returns the object with the settings used for calls to read. */ public UnaryCallSettings readSettings() { return ((SpannerStubSettings) getStubSettings()).readSettings(); @@ -277,6 +285,12 @@ public UnaryCallSettings.Builder executeSqlSetting return getStubSettingsBuilder().executeStreamingSqlSettings(); } + /** Returns the builder for the settings used for calls to executeBatchDml. */ + public UnaryCallSettings.Builder + executeBatchDmlSettings() { + return getStubSettingsBuilder().executeBatchDmlSettings(); + } + /** Returns the builder for the settings used for calls to read. */ public UnaryCallSettings.Builder readSettings() { return getStubSettingsBuilder().readSettings(); diff --git a/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/v1/stub/GrpcSpannerStub.java b/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/v1/stub/GrpcSpannerStub.java index 3818afc33859..326ec0816c08 100644 --- a/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/v1/stub/GrpcSpannerStub.java +++ b/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/v1/stub/GrpcSpannerStub.java @@ -31,6 +31,8 @@ import com.google.spanner.v1.CommitResponse; import com.google.spanner.v1.CreateSessionRequest; import com.google.spanner.v1.DeleteSessionRequest; +import com.google.spanner.v1.ExecuteBatchDmlRequest; +import com.google.spanner.v1.ExecuteBatchDmlResponse; import com.google.spanner.v1.ExecuteSqlRequest; import com.google.spanner.v1.GetSessionRequest; import com.google.spanner.v1.ListSessionsRequest; @@ -107,6 +109,16 @@ public class GrpcSpannerStub extends SpannerStub { .setRequestMarshaller(ProtoUtils.marshaller(ExecuteSqlRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(PartialResultSet.getDefaultInstance())) .build(); + private static final MethodDescriptor + executeBatchDmlMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.spanner.v1.Spanner/ExecuteBatchDml") + .setRequestMarshaller( + ProtoUtils.marshaller(ExecuteBatchDmlRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ExecuteBatchDmlResponse.getDefaultInstance())) + .build(); private static final MethodDescriptor readMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -175,6 +187,8 @@ public class GrpcSpannerStub extends SpannerStub { private final UnaryCallable executeSqlCallable; private final ServerStreamingCallable executeStreamingSqlCallable; + private final UnaryCallable + executeBatchDmlCallable; private final UnaryCallable readCallable; private final ServerStreamingCallable streamingReadCallable; private final UnaryCallable beginTransactionCallable; @@ -243,6 +257,11 @@ protected GrpcSpannerStub( GrpcCallSettings.newBuilder() .setMethodDescriptor(executeStreamingSqlMethodDescriptor) .build(); + GrpcCallSettings + executeBatchDmlTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(executeBatchDmlMethodDescriptor) + .build(); GrpcCallSettings readTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(readMethodDescriptor) @@ -295,6 +314,9 @@ protected GrpcSpannerStub( executeStreamingSqlTransportSettings, settings.executeStreamingSqlSettings(), clientContext); + this.executeBatchDmlCallable = + callableFactory.createUnaryCallable( + executeBatchDmlTransportSettings, settings.executeBatchDmlSettings(), clientContext); this.readCallable = callableFactory.createUnaryCallable( readTransportSettings, settings.readSettings(), clientContext); @@ -349,6 +371,10 @@ public UnaryCallable executeSqlCallable() { return executeStreamingSqlCallable; } + public UnaryCallable executeBatchDmlCallable() { + return executeBatchDmlCallable; + } + public UnaryCallable readCallable() { return readCallable; } diff --git a/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/v1/stub/SpannerStub.java b/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/v1/stub/SpannerStub.java index 45a0ac0dd0ed..0b72ec8200d2 100644 --- a/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/v1/stub/SpannerStub.java +++ b/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/v1/stub/SpannerStub.java @@ -27,6 +27,8 @@ import com.google.spanner.v1.CommitResponse; import com.google.spanner.v1.CreateSessionRequest; import com.google.spanner.v1.DeleteSessionRequest; +import com.google.spanner.v1.ExecuteBatchDmlRequest; +import com.google.spanner.v1.ExecuteBatchDmlResponse; import com.google.spanner.v1.ExecuteSqlRequest; import com.google.spanner.v1.GetSessionRequest; import com.google.spanner.v1.ListSessionsRequest; @@ -81,6 +83,10 @@ public UnaryCallable executeSqlCallable() { throw new UnsupportedOperationException("Not implemented: executeStreamingSqlCallable()"); } + public UnaryCallable executeBatchDmlCallable() { + throw new UnsupportedOperationException("Not implemented: executeBatchDmlCallable()"); + } + public UnaryCallable readCallable() { throw new UnsupportedOperationException("Not implemented: readCallable()"); } diff --git a/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/v1/stub/SpannerStubSettings.java b/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/v1/stub/SpannerStubSettings.java index e05a2447db75..775a86c72538 100644 --- a/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/v1/stub/SpannerStubSettings.java +++ b/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/v1/stub/SpannerStubSettings.java @@ -50,6 +50,8 @@ import com.google.spanner.v1.CommitResponse; import com.google.spanner.v1.CreateSessionRequest; import com.google.spanner.v1.DeleteSessionRequest; +import com.google.spanner.v1.ExecuteBatchDmlRequest; +import com.google.spanner.v1.ExecuteBatchDmlResponse; import com.google.spanner.v1.ExecuteSqlRequest; import com.google.spanner.v1.GetSessionRequest; import com.google.spanner.v1.ListSessionsRequest; @@ -112,6 +114,8 @@ public class SpannerStubSettings extends StubSettings { private final UnaryCallSettings executeSqlSettings; private final ServerStreamingCallSettings executeStreamingSqlSettings; + private final UnaryCallSettings + executeBatchDmlSettings; private final UnaryCallSettings readSettings; private final ServerStreamingCallSettings streamingReadSettings; private final UnaryCallSettings beginTransactionSettings; @@ -152,6 +156,12 @@ public UnaryCallSettings executeSqlSettings() { return executeStreamingSqlSettings; } + /** Returns the object with the settings used for calls to executeBatchDml. */ + public UnaryCallSettings + executeBatchDmlSettings() { + return executeBatchDmlSettings; + } + /** Returns the object with the settings used for calls to read. */ public UnaryCallSettings readSettings() { return readSettings; @@ -260,6 +270,7 @@ protected SpannerStubSettings(Builder settingsBuilder) throws IOException { deleteSessionSettings = settingsBuilder.deleteSessionSettings().build(); executeSqlSettings = settingsBuilder.executeSqlSettings().build(); executeStreamingSqlSettings = settingsBuilder.executeStreamingSqlSettings().build(); + executeBatchDmlSettings = settingsBuilder.executeBatchDmlSettings().build(); readSettings = settingsBuilder.readSettings().build(); streamingReadSettings = settingsBuilder.streamingReadSettings().build(); beginTransactionSettings = settingsBuilder.beginTransactionSettings().build(); @@ -335,6 +346,8 @@ public static class Builder extends StubSettings.Builder executeSqlSettings; private final ServerStreamingCallSettings.Builder executeStreamingSqlSettings; + private final UnaryCallSettings.Builder + executeBatchDmlSettings; private final UnaryCallSettings.Builder readSettings; private final ServerStreamingCallSettings.Builder streamingReadSettings; @@ -425,6 +438,8 @@ protected Builder(ClientContext clientContext) { executeStreamingSqlSettings = ServerStreamingCallSettings.newBuilder(); + executeBatchDmlSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + readSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); streamingReadSettings = ServerStreamingCallSettings.newBuilder(); @@ -446,6 +461,7 @@ protected Builder(ClientContext clientContext) { listSessionsSettings, deleteSessionSettings, executeSqlSettings, + executeBatchDmlSettings, readSettings, beginTransactionSettings, commitSettings, @@ -497,6 +513,11 @@ private static Builder initDefaults(Builder builder) { .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("streaming")); + builder + .executeBatchDmlSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + builder .readSettings() .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) @@ -544,6 +565,7 @@ protected Builder(SpannerStubSettings settings) { deleteSessionSettings = settings.deleteSessionSettings.toBuilder(); executeSqlSettings = settings.executeSqlSettings.toBuilder(); executeStreamingSqlSettings = settings.executeStreamingSqlSettings.toBuilder(); + executeBatchDmlSettings = settings.executeBatchDmlSettings.toBuilder(); readSettings = settings.readSettings.toBuilder(); streamingReadSettings = settings.streamingReadSettings.toBuilder(); beginTransactionSettings = settings.beginTransactionSettings.toBuilder(); @@ -559,6 +581,7 @@ protected Builder(SpannerStubSettings settings) { listSessionsSettings, deleteSessionSettings, executeSqlSettings, + executeBatchDmlSettings, readSettings, beginTransactionSettings, commitSettings, @@ -616,6 +639,12 @@ public UnaryCallSettings.Builder executeSqlSetting return executeStreamingSqlSettings; } + /** Returns the builder for the settings used for calls to executeBatchDml. */ + public UnaryCallSettings.Builder + executeBatchDmlSettings() { + return executeBatchDmlSettings; + } + /** Returns the builder for the settings used for calls to read. */ public UnaryCallSettings.Builder readSettings() { return readSettings; diff --git a/google-cloud-clients/google-cloud-spanner/src/test/java/com/google/cloud/spanner/v1/MockSpannerImpl.java b/google-cloud-clients/google-cloud-spanner/src/test/java/com/google/cloud/spanner/v1/MockSpannerImpl.java index 0f23ffab7c33..1fc3105bca43 100644 --- a/google-cloud-clients/google-cloud-spanner/src/test/java/com/google/cloud/spanner/v1/MockSpannerImpl.java +++ b/google-cloud-clients/google-cloud-spanner/src/test/java/com/google/cloud/spanner/v1/MockSpannerImpl.java @@ -23,6 +23,8 @@ import com.google.spanner.v1.CommitResponse; import com.google.spanner.v1.CreateSessionRequest; import com.google.spanner.v1.DeleteSessionRequest; +import com.google.spanner.v1.ExecuteBatchDmlRequest; +import com.google.spanner.v1.ExecuteBatchDmlResponse; import com.google.spanner.v1.ExecuteSqlRequest; import com.google.spanner.v1.GetSessionRequest; import com.google.spanner.v1.ListSessionsRequest; @@ -162,6 +164,21 @@ public void executeStreamingSql( } } + @Override + public void executeBatchDml( + ExecuteBatchDmlRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof ExecuteBatchDmlResponse) { + requests.add(request); + responseObserver.onNext((ExecuteBatchDmlResponse) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + @Override public void read(ReadRequest request, StreamObserver responseObserver) { Object response = responses.remove(); diff --git a/google-cloud-clients/google-cloud-spanner/synth.metadata b/google-cloud-clients/google-cloud-spanner/synth.metadata index 951d594cb049..9e4f94580108 100644 --- a/google-cloud-clients/google-cloud-spanner/synth.metadata +++ b/google-cloud-clients/google-cloud-spanner/synth.metadata @@ -1,19 +1,19 @@ { - "updateTime": "2019-02-26T08:50:56.009586Z", + "updateTime": "2019-03-06T08:52:00.759549Z", "sources": [ { "generator": { "name": "artman", - "version": "0.16.14", - "dockerImage": "googleapis/artman@sha256:f3d61ae45abaeefb6be5f228cda22732c2f1b00fb687c79c4bd4f2c42bb1e1a7" + "version": "0.16.15", + "dockerImage": "googleapis/artman@sha256:9caadfa59d48224cba5f3217eb9d61a155b78ccf31e628abef385bc5b7ed3bd2" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "29f098cb03a9983cc9cb15993de5da64419046f2", - "internalRef": "235621085" + "sha": "856117505ff9075b3e9c0b5674113667b6cf9e00", + "internalRef": "236931378" } } ],