diff --git a/.github/workflows/spanner-lib-tests.yml b/.github/workflows/spanner-lib-tests.yml index 74488eb6..a163f63a 100644 --- a/.github/workflows/spanner-lib-tests.yml +++ b/.github/workflows/spanner-lib-tests.yml @@ -145,6 +145,9 @@ jobs: working-directory: spannerlib/wrappers/spannerlib-dotnet/spannerlib-dotnet-tests run: | dotnet --version + if [ "$RUNNER_OS" == "Linux" ]; then + export SKIP_SHARED_LIB_TESTS=true + fi # Retry the tests 3 times before the step actually fails. # We do this because the tests are executed using both the internal gRPC server and using a shared # native library. The latter is not really supported due to an incompatibility between the .NET and Go diff --git a/spannerlib/api/rows.go b/spannerlib/api/rows.go index 165d906d..1935836e 100644 --- a/spannerlib/api/rows.go +++ b/spannerlib/api/rows.go @@ -70,7 +70,7 @@ func NextResultSet(ctx context.Context, poolId, connId, rowsId int64) (*spannerp // as it allows the library to re-use the encoding buffer. // TODO: Add an encoder function as input argument, instead of hardcoding protobuf encoding here. func NextEncoded(ctx context.Context, poolId, connId, rowsId int64) ([]byte, error) { - _, bytes, err := next(ctx, poolId, connId, rowsId, true) + _, bytes, err := next(ctx, poolId, connId, rowsId /*marshalResult=*/, true /*resetBuffer=*/, false) if err != nil { return nil, err } @@ -79,7 +79,20 @@ func NextEncoded(ctx context.Context, poolId, connId, rowsId int64) ([]byte, err // Next returns the next row as a protobuf ListValue. func Next(ctx context.Context, poolId, connId, rowsId int64) (*structpb.ListValue, error) { - values, _, err := next(ctx, poolId, connId, rowsId, false) + return nextWithBufferOption(ctx, poolId, connId, rowsId /*resetBuffer=*/, true) +} + +// NextBuffered returns the next row as a protobuf ListValue. +// The same buffer is used to construct the ListValue for each call. This means that this function is only +// safe to call if the result that is returned is copied into a different data structure before the next call +// to this function. Safe use of this function for example includes calls that request the next row and then +// serialize this result into a byte slice or send it as a gRPC message (which also serializes the result). +func NextBuffered(ctx context.Context, poolId, connId, rowsId int64) (*structpb.ListValue, error) { + return nextWithBufferOption(ctx, poolId, connId, rowsId /*resetBuffer=*/, false) +} + +func nextWithBufferOption(ctx context.Context, poolId, connId, rowsId int64, resetBuffer bool) (*structpb.ListValue, error) { + values, _, err := next(ctx, poolId, connId, rowsId /*marshalResult=*/, false, resetBuffer) if err != nil { return nil, err } @@ -90,7 +103,7 @@ func Next(ctx context.Context, poolId, connId, rowsId int64) (*structpb.ListValu // The row is returned as a protobuf ListValue if marshalResult==false. // The row is returned as a byte slice if marshalResult==true. // TODO: Add generics to the function and add input arguments for encoding instead of hardcoding it. -func next(ctx context.Context, poolId, connId, rowsId int64, marshalResult bool) (*structpb.ListValue, []byte, error) { +func next(ctx context.Context, poolId, connId, rowsId int64, marshalResult, resetBuffer bool) (*structpb.ListValue, []byte, error) { rows, err := findRows(poolId, connId, rowsId) if err != nil { return nil, nil, err @@ -99,6 +112,9 @@ func next(ctx context.Context, poolId, connId, rowsId int64, marshalResult bool) if err != nil { return nil, nil, err } + if resetBuffer { + rows.buffer = nil + } if !marshalResult || values == nil { return values, nil, nil } diff --git a/spannerlib/grpc-server/google/spannerlib/v1/spannerlib.pb.go b/spannerlib/grpc-server/google/spannerlib/v1/spannerlib.pb.go index 9e74c5fe..01e3893a 100644 --- a/spannerlib/grpc-server/google/spannerlib/v1/spannerlib.pb.go +++ b/spannerlib/grpc-server/google/spannerlib/v1/spannerlib.pb.go @@ -9,6 +9,7 @@ package spannerlibpb import ( spannerpb "cloud.google.com/go/spanner/apiv1/spannerpb" _ "google.golang.org/genproto/googleapis/api/annotations" + status "google.golang.org/genproto/googleapis/rpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" emptypb "google.golang.org/protobuf/types/known/emptypb" @@ -193,17 +194,70 @@ func (x *CreateConnectionRequest) GetPool() *Pool { return nil } +type FetchOptions struct { + state protoimpl.MessageState `protogen:"open.v1"` + NumRows int64 `protobuf:"varint,1,opt,name=num_rows,json=numRows,proto3" json:"num_rows,omitempty"` + Encoding int64 `protobuf:"varint,2,opt,name=encoding,proto3" json:"encoding,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *FetchOptions) Reset() { + *x = FetchOptions{} + mi := &file_google_spannerlib_v1_spannerlib_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *FetchOptions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FetchOptions) ProtoMessage() {} + +func (x *FetchOptions) ProtoReflect() protoreflect.Message { + mi := &file_google_spannerlib_v1_spannerlib_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FetchOptions.ProtoReflect.Descriptor instead. +func (*FetchOptions) Descriptor() ([]byte, []int) { + return file_google_spannerlib_v1_spannerlib_proto_rawDescGZIP(), []int{4} +} + +func (x *FetchOptions) GetNumRows() int64 { + if x != nil { + return x.NumRows + } + return 0 +} + +func (x *FetchOptions) GetEncoding() int64 { + if x != nil { + return x.Encoding + } + return 0 +} + type ExecuteRequest struct { state protoimpl.MessageState `protogen:"open.v1"` Connection *Connection `protobuf:"bytes,1,opt,name=connection,proto3" json:"connection,omitempty"` ExecuteSqlRequest *spannerpb.ExecuteSqlRequest `protobuf:"bytes,2,opt,name=execute_sql_request,json=executeSqlRequest,proto3" json:"execute_sql_request,omitempty"` + FetchOptions *FetchOptions `protobuf:"bytes,3,opt,name=fetch_options,json=fetchOptions,proto3" json:"fetch_options,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } func (x *ExecuteRequest) Reset() { *x = ExecuteRequest{} - mi := &file_google_spannerlib_v1_spannerlib_proto_msgTypes[4] + mi := &file_google_spannerlib_v1_spannerlib_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -215,7 +269,7 @@ func (x *ExecuteRequest) String() string { func (*ExecuteRequest) ProtoMessage() {} func (x *ExecuteRequest) ProtoReflect() protoreflect.Message { - mi := &file_google_spannerlib_v1_spannerlib_proto_msgTypes[4] + mi := &file_google_spannerlib_v1_spannerlib_proto_msgTypes[5] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -228,7 +282,7 @@ func (x *ExecuteRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ExecuteRequest.ProtoReflect.Descriptor instead. func (*ExecuteRequest) Descriptor() ([]byte, []int) { - return file_google_spannerlib_v1_spannerlib_proto_rawDescGZIP(), []int{4} + return file_google_spannerlib_v1_spannerlib_proto_rawDescGZIP(), []int{5} } func (x *ExecuteRequest) GetConnection() *Connection { @@ -245,6 +299,13 @@ func (x *ExecuteRequest) GetExecuteSqlRequest() *spannerpb.ExecuteSqlRequest { return nil } +func (x *ExecuteRequest) GetFetchOptions() *FetchOptions { + if x != nil { + return x.FetchOptions + } + return nil +} + type ExecuteBatchRequest struct { state protoimpl.MessageState `protogen:"open.v1"` Connection *Connection `protobuf:"bytes,1,opt,name=connection,proto3" json:"connection,omitempty"` @@ -255,7 +316,7 @@ type ExecuteBatchRequest struct { func (x *ExecuteBatchRequest) Reset() { *x = ExecuteBatchRequest{} - mi := &file_google_spannerlib_v1_spannerlib_proto_msgTypes[5] + mi := &file_google_spannerlib_v1_spannerlib_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -267,7 +328,7 @@ func (x *ExecuteBatchRequest) String() string { func (*ExecuteBatchRequest) ProtoMessage() {} func (x *ExecuteBatchRequest) ProtoReflect() protoreflect.Message { - mi := &file_google_spannerlib_v1_spannerlib_proto_msgTypes[5] + mi := &file_google_spannerlib_v1_spannerlib_proto_msgTypes[6] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -280,7 +341,7 @@ func (x *ExecuteBatchRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ExecuteBatchRequest.ProtoReflect.Descriptor instead. func (*ExecuteBatchRequest) Descriptor() ([]byte, []int) { - return file_google_spannerlib_v1_spannerlib_proto_rawDescGZIP(), []int{5} + return file_google_spannerlib_v1_spannerlib_proto_rawDescGZIP(), []int{6} } func (x *ExecuteBatchRequest) GetConnection() *Connection { @@ -307,7 +368,7 @@ type BeginTransactionRequest struct { func (x *BeginTransactionRequest) Reset() { *x = BeginTransactionRequest{} - mi := &file_google_spannerlib_v1_spannerlib_proto_msgTypes[6] + mi := &file_google_spannerlib_v1_spannerlib_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -319,7 +380,7 @@ func (x *BeginTransactionRequest) String() string { func (*BeginTransactionRequest) ProtoMessage() {} func (x *BeginTransactionRequest) ProtoReflect() protoreflect.Message { - mi := &file_google_spannerlib_v1_spannerlib_proto_msgTypes[6] + mi := &file_google_spannerlib_v1_spannerlib_proto_msgTypes[7] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -332,7 +393,7 @@ func (x *BeginTransactionRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use BeginTransactionRequest.ProtoReflect.Descriptor instead. func (*BeginTransactionRequest) Descriptor() ([]byte, []int) { - return file_google_spannerlib_v1_spannerlib_proto_rawDescGZIP(), []int{6} + return file_google_spannerlib_v1_spannerlib_proto_rawDescGZIP(), []int{7} } func (x *BeginTransactionRequest) GetConnection() *Connection { @@ -359,7 +420,7 @@ type WriteMutationsRequest struct { func (x *WriteMutationsRequest) Reset() { *x = WriteMutationsRequest{} - mi := &file_google_spannerlib_v1_spannerlib_proto_msgTypes[7] + mi := &file_google_spannerlib_v1_spannerlib_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -371,7 +432,7 @@ func (x *WriteMutationsRequest) String() string { func (*WriteMutationsRequest) ProtoMessage() {} func (x *WriteMutationsRequest) ProtoReflect() protoreflect.Message { - mi := &file_google_spannerlib_v1_spannerlib_proto_msgTypes[7] + mi := &file_google_spannerlib_v1_spannerlib_proto_msgTypes[8] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -384,7 +445,7 @@ func (x *WriteMutationsRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use WriteMutationsRequest.ProtoReflect.Descriptor instead. func (*WriteMutationsRequest) Descriptor() ([]byte, []int) { - return file_google_spannerlib_v1_spannerlib_proto_rawDescGZIP(), []int{7} + return file_google_spannerlib_v1_spannerlib_proto_rawDescGZIP(), []int{8} } func (x *WriteMutationsRequest) GetConnection() *Connection { @@ -410,7 +471,7 @@ type Pool struct { func (x *Pool) Reset() { *x = Pool{} - mi := &file_google_spannerlib_v1_spannerlib_proto_msgTypes[8] + mi := &file_google_spannerlib_v1_spannerlib_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -422,7 +483,7 @@ func (x *Pool) String() string { func (*Pool) ProtoMessage() {} func (x *Pool) ProtoReflect() protoreflect.Message { - mi := &file_google_spannerlib_v1_spannerlib_proto_msgTypes[8] + mi := &file_google_spannerlib_v1_spannerlib_proto_msgTypes[9] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -435,7 +496,7 @@ func (x *Pool) ProtoReflect() protoreflect.Message { // Deprecated: Use Pool.ProtoReflect.Descriptor instead. func (*Pool) Descriptor() ([]byte, []int) { - return file_google_spannerlib_v1_spannerlib_proto_rawDescGZIP(), []int{8} + return file_google_spannerlib_v1_spannerlib_proto_rawDescGZIP(), []int{9} } func (x *Pool) GetId() int64 { @@ -455,7 +516,7 @@ type Connection struct { func (x *Connection) Reset() { *x = Connection{} - mi := &file_google_spannerlib_v1_spannerlib_proto_msgTypes[9] + mi := &file_google_spannerlib_v1_spannerlib_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -467,7 +528,7 @@ func (x *Connection) String() string { func (*Connection) ProtoMessage() {} func (x *Connection) ProtoReflect() protoreflect.Message { - mi := &file_google_spannerlib_v1_spannerlib_proto_msgTypes[9] + mi := &file_google_spannerlib_v1_spannerlib_proto_msgTypes[10] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -480,7 +541,7 @@ func (x *Connection) ProtoReflect() protoreflect.Message { // Deprecated: Use Connection.ProtoReflect.Descriptor instead. func (*Connection) Descriptor() ([]byte, []int) { - return file_google_spannerlib_v1_spannerlib_proto_rawDescGZIP(), []int{9} + return file_google_spannerlib_v1_spannerlib_proto_rawDescGZIP(), []int{10} } func (x *Connection) GetPool() *Pool { @@ -507,7 +568,7 @@ type Rows struct { func (x *Rows) Reset() { *x = Rows{} - mi := &file_google_spannerlib_v1_spannerlib_proto_msgTypes[10] + mi := &file_google_spannerlib_v1_spannerlib_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -519,7 +580,7 @@ func (x *Rows) String() string { func (*Rows) ProtoMessage() {} func (x *Rows) ProtoReflect() protoreflect.Message { - mi := &file_google_spannerlib_v1_spannerlib_proto_msgTypes[10] + mi := &file_google_spannerlib_v1_spannerlib_proto_msgTypes[11] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -532,7 +593,7 @@ func (x *Rows) ProtoReflect() protoreflect.Message { // Deprecated: Use Rows.ProtoReflect.Descriptor instead. func (*Rows) Descriptor() ([]byte, []int) { - return file_google_spannerlib_v1_spannerlib_proto_rawDescGZIP(), []int{10} + return file_google_spannerlib_v1_spannerlib_proto_rawDescGZIP(), []int{11} } func (x *Rows) GetConnection() *Connection { @@ -552,15 +613,14 @@ func (x *Rows) GetId() int64 { type NextRequest struct { state protoimpl.MessageState `protogen:"open.v1"` Rows *Rows `protobuf:"bytes,1,opt,name=rows,proto3" json:"rows,omitempty"` - NumRows int64 `protobuf:"varint,2,opt,name=num_rows,json=numRows,proto3" json:"num_rows,omitempty"` - Encoding int64 `protobuf:"varint,3,opt,name=encoding,proto3" json:"encoding,omitempty"` + FetchOptions *FetchOptions `protobuf:"bytes,2,opt,name=fetch_options,json=fetchOptions,proto3" json:"fetch_options,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } func (x *NextRequest) Reset() { *x = NextRequest{} - mi := &file_google_spannerlib_v1_spannerlib_proto_msgTypes[11] + mi := &file_google_spannerlib_v1_spannerlib_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -572,7 +632,7 @@ func (x *NextRequest) String() string { func (*NextRequest) ProtoMessage() {} func (x *NextRequest) ProtoReflect() protoreflect.Message { - mi := &file_google_spannerlib_v1_spannerlib_proto_msgTypes[11] + mi := &file_google_spannerlib_v1_spannerlib_proto_msgTypes[12] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -585,7 +645,7 @@ func (x *NextRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use NextRequest.ProtoReflect.Descriptor instead. func (*NextRequest) Descriptor() ([]byte, []int) { - return file_google_spannerlib_v1_spannerlib_proto_rawDescGZIP(), []int{11} + return file_google_spannerlib_v1_spannerlib_proto_rawDescGZIP(), []int{12} } func (x *NextRequest) GetRows() *Rows { @@ -595,18 +655,11 @@ func (x *NextRequest) GetRows() *Rows { return nil } -func (x *NextRequest) GetNumRows() int64 { +func (x *NextRequest) GetFetchOptions() *FetchOptions { if x != nil { - return x.NumRows + return x.FetchOptions } - return 0 -} - -func (x *NextRequest) GetEncoding() int64 { - if x != nil { - return x.Encoding - } - return 0 + return nil } type RowData struct { @@ -622,7 +675,7 @@ type RowData struct { func (x *RowData) Reset() { *x = RowData{} - mi := &file_google_spannerlib_v1_spannerlib_proto_msgTypes[12] + mi := &file_google_spannerlib_v1_spannerlib_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -634,7 +687,7 @@ func (x *RowData) String() string { func (*RowData) ProtoMessage() {} func (x *RowData) ProtoReflect() protoreflect.Message { - mi := &file_google_spannerlib_v1_spannerlib_proto_msgTypes[12] + mi := &file_google_spannerlib_v1_spannerlib_proto_msgTypes[13] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -647,7 +700,7 @@ func (x *RowData) ProtoReflect() protoreflect.Message { // Deprecated: Use RowData.ProtoReflect.Descriptor instead. func (*RowData) Descriptor() ([]byte, []int) { - return file_google_spannerlib_v1_spannerlib_proto_rawDescGZIP(), []int{12} + return file_google_spannerlib_v1_spannerlib_proto_rawDescGZIP(), []int{13} } func (x *RowData) GetRows() *Rows { @@ -694,7 +747,7 @@ type MetadataRequest struct { func (x *MetadataRequest) Reset() { *x = MetadataRequest{} - mi := &file_google_spannerlib_v1_spannerlib_proto_msgTypes[13] + mi := &file_google_spannerlib_v1_spannerlib_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -706,7 +759,7 @@ func (x *MetadataRequest) String() string { func (*MetadataRequest) ProtoMessage() {} func (x *MetadataRequest) ProtoReflect() protoreflect.Message { - mi := &file_google_spannerlib_v1_spannerlib_proto_msgTypes[13] + mi := &file_google_spannerlib_v1_spannerlib_proto_msgTypes[14] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -719,7 +772,7 @@ func (x *MetadataRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use MetadataRequest.ProtoReflect.Descriptor instead. func (*MetadataRequest) Descriptor() ([]byte, []int) { - return file_google_spannerlib_v1_spannerlib_proto_rawDescGZIP(), []int{13} + return file_google_spannerlib_v1_spannerlib_proto_rawDescGZIP(), []int{14} } func (x *MetadataRequest) GetRows() *Rows { @@ -738,7 +791,7 @@ type ResultSetStatsRequest struct { func (x *ResultSetStatsRequest) Reset() { *x = ResultSetStatsRequest{} - mi := &file_google_spannerlib_v1_spannerlib_proto_msgTypes[14] + mi := &file_google_spannerlib_v1_spannerlib_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -750,7 +803,7 @@ func (x *ResultSetStatsRequest) String() string { func (*ResultSetStatsRequest) ProtoMessage() {} func (x *ResultSetStatsRequest) ProtoReflect() protoreflect.Message { - mi := &file_google_spannerlib_v1_spannerlib_proto_msgTypes[14] + mi := &file_google_spannerlib_v1_spannerlib_proto_msgTypes[15] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -763,7 +816,7 @@ func (x *ResultSetStatsRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ResultSetStatsRequest.ProtoReflect.Descriptor instead. func (*ResultSetStatsRequest) Descriptor() ([]byte, []int) { - return file_google_spannerlib_v1_spannerlib_proto_rawDescGZIP(), []int{14} + return file_google_spannerlib_v1_spannerlib_proto_rawDescGZIP(), []int{15} } func (x *ResultSetStatsRequest) GetRows() *Rows { @@ -773,11 +826,18 @@ func (x *ResultSetStatsRequest) GetRows() *Rows { return nil } +// ConnectionStreamRequest is used by a client to send a request to the server using a +// bi-directional gRPC stream. Such a stream is opened by calling the ConnectionStream RPC. type ConnectionStreamRequest struct { state protoimpl.MessageState `protogen:"open.v1"` // Types that are valid to be assigned to Request: // // *ConnectionStreamRequest_ExecuteRequest + // *ConnectionStreamRequest_ExecuteBatchRequest + // *ConnectionStreamRequest_BeginTransactionRequest + // *ConnectionStreamRequest_CommitRequest + // *ConnectionStreamRequest_RollbackRequest + // *ConnectionStreamRequest_WriteMutationsRequest Request isConnectionStreamRequest_Request `protobuf_oneof:"request"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache @@ -785,7 +845,7 @@ type ConnectionStreamRequest struct { func (x *ConnectionStreamRequest) Reset() { *x = ConnectionStreamRequest{} - mi := &file_google_spannerlib_v1_spannerlib_proto_msgTypes[15] + mi := &file_google_spannerlib_v1_spannerlib_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -797,7 +857,7 @@ func (x *ConnectionStreamRequest) String() string { func (*ConnectionStreamRequest) ProtoMessage() {} func (x *ConnectionStreamRequest) ProtoReflect() protoreflect.Message { - mi := &file_google_spannerlib_v1_spannerlib_proto_msgTypes[15] + mi := &file_google_spannerlib_v1_spannerlib_proto_msgTypes[16] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -810,7 +870,7 @@ func (x *ConnectionStreamRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ConnectionStreamRequest.ProtoReflect.Descriptor instead. func (*ConnectionStreamRequest) Descriptor() ([]byte, []int) { - return file_google_spannerlib_v1_spannerlib_proto_rawDescGZIP(), []int{15} + return file_google_spannerlib_v1_spannerlib_proto_rawDescGZIP(), []int{16} } func (x *ConnectionStreamRequest) GetRequest() isConnectionStreamRequest_Request { @@ -829,6 +889,51 @@ func (x *ConnectionStreamRequest) GetExecuteRequest() *ExecuteRequest { return nil } +func (x *ConnectionStreamRequest) GetExecuteBatchRequest() *ExecuteBatchRequest { + if x != nil { + if x, ok := x.Request.(*ConnectionStreamRequest_ExecuteBatchRequest); ok { + return x.ExecuteBatchRequest + } + } + return nil +} + +func (x *ConnectionStreamRequest) GetBeginTransactionRequest() *BeginTransactionRequest { + if x != nil { + if x, ok := x.Request.(*ConnectionStreamRequest_BeginTransactionRequest); ok { + return x.BeginTransactionRequest + } + } + return nil +} + +func (x *ConnectionStreamRequest) GetCommitRequest() *Connection { + if x != nil { + if x, ok := x.Request.(*ConnectionStreamRequest_CommitRequest); ok { + return x.CommitRequest + } + } + return nil +} + +func (x *ConnectionStreamRequest) GetRollbackRequest() *Connection { + if x != nil { + if x, ok := x.Request.(*ConnectionStreamRequest_RollbackRequest); ok { + return x.RollbackRequest + } + } + return nil +} + +func (x *ConnectionStreamRequest) GetWriteMutationsRequest() *WriteMutationsRequest { + if x != nil { + if x, ok := x.Request.(*ConnectionStreamRequest_WriteMutationsRequest); ok { + return x.WriteMutationsRequest + } + } + return nil +} + type isConnectionStreamRequest_Request interface { isConnectionStreamRequest_Request() } @@ -837,13 +942,134 @@ type ConnectionStreamRequest_ExecuteRequest struct { ExecuteRequest *ExecuteRequest `protobuf:"bytes,1,opt,name=execute_request,json=executeRequest,proto3,oneof"` } +type ConnectionStreamRequest_ExecuteBatchRequest struct { + ExecuteBatchRequest *ExecuteBatchRequest `protobuf:"bytes,2,opt,name=execute_batch_request,json=executeBatchRequest,proto3,oneof"` +} + +type ConnectionStreamRequest_BeginTransactionRequest struct { + BeginTransactionRequest *BeginTransactionRequest `protobuf:"bytes,3,opt,name=begin_transaction_request,json=beginTransactionRequest,proto3,oneof"` +} + +type ConnectionStreamRequest_CommitRequest struct { + CommitRequest *Connection `protobuf:"bytes,4,opt,name=commit_request,json=commitRequest,proto3,oneof"` +} + +type ConnectionStreamRequest_RollbackRequest struct { + RollbackRequest *Connection `protobuf:"bytes,5,opt,name=rollback_request,json=rollbackRequest,proto3,oneof"` +} + +type ConnectionStreamRequest_WriteMutationsRequest struct { + WriteMutationsRequest *WriteMutationsRequest `protobuf:"bytes,6,opt,name=write_mutations_request,json=writeMutationsRequest,proto3,oneof"` +} + func (*ConnectionStreamRequest_ExecuteRequest) isConnectionStreamRequest_Request() {} +func (*ConnectionStreamRequest_ExecuteBatchRequest) isConnectionStreamRequest_Request() {} + +func (*ConnectionStreamRequest_BeginTransactionRequest) isConnectionStreamRequest_Request() {} + +func (*ConnectionStreamRequest_CommitRequest) isConnectionStreamRequest_Request() {} + +func (*ConnectionStreamRequest_RollbackRequest) isConnectionStreamRequest_Request() {} + +func (*ConnectionStreamRequest_WriteMutationsRequest) isConnectionStreamRequest_Request() {} + +// ExecuteResponse is returned by the server when it receives an ExecuteRequest on a bi-directional +// ConnectionStream. The response contains the first N rows, the metadata, and an indication whether +// the result contains more data than in the initial response. The client should fetch the remaining +// data by calling the ContinueStreaming RPC. This will start a separate server stream with the +// remaining results. The client can continue to send additional requests on the ConnectionStream +// while the additional server stream is open. +// +// The initial response also contains the ResultSetStats if there is no more data to be returned. +type ExecuteResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Rows *Rows `protobuf:"bytes,1,opt,name=rows,proto3" json:"rows,omitempty"` + ResultSets []*spannerpb.ResultSet `protobuf:"bytes,2,rep,name=result_sets,json=resultSets,proto3" json:"result_sets,omitempty"` + Status *status.Status `protobuf:"bytes,3,opt,name=status,proto3" json:"status,omitempty"` + HasMoreResults bool `protobuf:"varint,4,opt,name=has_more_results,json=hasMoreResults,proto3" json:"has_more_results,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ExecuteResponse) Reset() { + *x = ExecuteResponse{} + mi := &file_google_spannerlib_v1_spannerlib_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ExecuteResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ExecuteResponse) ProtoMessage() {} + +func (x *ExecuteResponse) ProtoReflect() protoreflect.Message { + mi := &file_google_spannerlib_v1_spannerlib_proto_msgTypes[17] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ExecuteResponse.ProtoReflect.Descriptor instead. +func (*ExecuteResponse) Descriptor() ([]byte, []int) { + return file_google_spannerlib_v1_spannerlib_proto_rawDescGZIP(), []int{17} +} + +func (x *ExecuteResponse) GetRows() *Rows { + if x != nil { + return x.Rows + } + return nil +} + +func (x *ExecuteResponse) GetResultSets() []*spannerpb.ResultSet { + if x != nil { + return x.ResultSets + } + return nil +} + +func (x *ExecuteResponse) GetStatus() *status.Status { + if x != nil { + return x.Status + } + return nil +} + +func (x *ExecuteResponse) GetHasMoreResults() bool { + if x != nil { + return x.HasMoreResults + } + return false +} + +// ConnectionStreamResponse is returned by the server when it receives a ConnectionStreamRequest. +// The contents of the response depends on the request that the client sent. +// +// The response contains a Status that indicates whether the request succeeded or not. The stream +// itself normally does not return an error if a request fails. +// The stream only returns an error and is discontinued in case of a network error or other +// unexpected internal errors. type ConnectionStreamResponse struct { state protoimpl.MessageState `protogen:"open.v1"` + // Status indicates whether the request succeeded or failed. The response field only contains + // a value if the status code is OK. + Status *status.Status `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"` // Types that are valid to be assigned to Response: // - // *ConnectionStreamResponse_Row + // *ConnectionStreamResponse_ExecuteResponse + // *ConnectionStreamResponse_ExecuteBatchResponse + // *ConnectionStreamResponse_BeginTransactionResponse + // *ConnectionStreamResponse_CommitResponse + // *ConnectionStreamResponse_RollbackResponse + // *ConnectionStreamResponse_WriteMutationsResponse Response isConnectionStreamResponse_Response `protobuf_oneof:"response"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache @@ -851,7 +1077,7 @@ type ConnectionStreamResponse struct { func (x *ConnectionStreamResponse) Reset() { *x = ConnectionStreamResponse{} - mi := &file_google_spannerlib_v1_spannerlib_proto_msgTypes[16] + mi := &file_google_spannerlib_v1_spannerlib_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -863,7 +1089,7 @@ func (x *ConnectionStreamResponse) String() string { func (*ConnectionStreamResponse) ProtoMessage() {} func (x *ConnectionStreamResponse) ProtoReflect() protoreflect.Message { - mi := &file_google_spannerlib_v1_spannerlib_proto_msgTypes[16] + mi := &file_google_spannerlib_v1_spannerlib_proto_msgTypes[18] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -876,7 +1102,14 @@ func (x *ConnectionStreamResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ConnectionStreamResponse.ProtoReflect.Descriptor instead. func (*ConnectionStreamResponse) Descriptor() ([]byte, []int) { - return file_google_spannerlib_v1_spannerlib_proto_rawDescGZIP(), []int{16} + return file_google_spannerlib_v1_spannerlib_proto_rawDescGZIP(), []int{18} +} + +func (x *ConnectionStreamResponse) GetStatus() *status.Status { + if x != nil { + return x.Status + } + return nil } func (x *ConnectionStreamResponse) GetResponse() isConnectionStreamResponse_Response { @@ -886,10 +1119,55 @@ func (x *ConnectionStreamResponse) GetResponse() isConnectionStreamResponse_Resp return nil } -func (x *ConnectionStreamResponse) GetRow() *spannerpb.PartialResultSet { +func (x *ConnectionStreamResponse) GetExecuteResponse() *ExecuteResponse { + if x != nil { + if x, ok := x.Response.(*ConnectionStreamResponse_ExecuteResponse); ok { + return x.ExecuteResponse + } + } + return nil +} + +func (x *ConnectionStreamResponse) GetExecuteBatchResponse() *spannerpb.ExecuteBatchDmlResponse { + if x != nil { + if x, ok := x.Response.(*ConnectionStreamResponse_ExecuteBatchResponse); ok { + return x.ExecuteBatchResponse + } + } + return nil +} + +func (x *ConnectionStreamResponse) GetBeginTransactionResponse() *emptypb.Empty { + if x != nil { + if x, ok := x.Response.(*ConnectionStreamResponse_BeginTransactionResponse); ok { + return x.BeginTransactionResponse + } + } + return nil +} + +func (x *ConnectionStreamResponse) GetCommitResponse() *spannerpb.CommitResponse { + if x != nil { + if x, ok := x.Response.(*ConnectionStreamResponse_CommitResponse); ok { + return x.CommitResponse + } + } + return nil +} + +func (x *ConnectionStreamResponse) GetRollbackResponse() *emptypb.Empty { + if x != nil { + if x, ok := x.Response.(*ConnectionStreamResponse_RollbackResponse); ok { + return x.RollbackResponse + } + } + return nil +} + +func (x *ConnectionStreamResponse) GetWriteMutationsResponse() *spannerpb.CommitResponse { if x != nil { - if x, ok := x.Response.(*ConnectionStreamResponse_Row); ok { - return x.Row + if x, ok := x.Response.(*ConnectionStreamResponse_WriteMutationsResponse); ok { + return x.WriteMutationsResponse } } return nil @@ -899,29 +1177,63 @@ type isConnectionStreamResponse_Response interface { isConnectionStreamResponse_Response() } -type ConnectionStreamResponse_Row struct { - Row *spannerpb.PartialResultSet `protobuf:"bytes,1,opt,name=row,proto3,oneof"` +type ConnectionStreamResponse_ExecuteResponse struct { + ExecuteResponse *ExecuteResponse `protobuf:"bytes,2,opt,name=execute_response,json=executeResponse,proto3,oneof"` } -func (*ConnectionStreamResponse_Row) isConnectionStreamResponse_Response() {} +type ConnectionStreamResponse_ExecuteBatchResponse struct { + ExecuteBatchResponse *spannerpb.ExecuteBatchDmlResponse `protobuf:"bytes,3,opt,name=execute_batch_response,json=executeBatchResponse,proto3,oneof"` +} + +type ConnectionStreamResponse_BeginTransactionResponse struct { + BeginTransactionResponse *emptypb.Empty `protobuf:"bytes,4,opt,name=begin_transaction_response,json=beginTransactionResponse,proto3,oneof"` +} + +type ConnectionStreamResponse_CommitResponse struct { + CommitResponse *spannerpb.CommitResponse `protobuf:"bytes,5,opt,name=commit_response,json=commitResponse,proto3,oneof"` +} + +type ConnectionStreamResponse_RollbackResponse struct { + RollbackResponse *emptypb.Empty `protobuf:"bytes,6,opt,name=rollback_response,json=rollbackResponse,proto3,oneof"` +} + +type ConnectionStreamResponse_WriteMutationsResponse struct { + WriteMutationsResponse *spannerpb.CommitResponse `protobuf:"bytes,7,opt,name=write_mutations_response,json=writeMutationsResponse,proto3,oneof"` +} + +func (*ConnectionStreamResponse_ExecuteResponse) isConnectionStreamResponse_Response() {} + +func (*ConnectionStreamResponse_ExecuteBatchResponse) isConnectionStreamResponse_Response() {} + +func (*ConnectionStreamResponse_BeginTransactionResponse) isConnectionStreamResponse_Response() {} + +func (*ConnectionStreamResponse_CommitResponse) isConnectionStreamResponse_Response() {} + +func (*ConnectionStreamResponse_RollbackResponse) isConnectionStreamResponse_Response() {} + +func (*ConnectionStreamResponse_WriteMutationsResponse) isConnectionStreamResponse_Response() {} var File_google_spannerlib_v1_spannerlib_proto protoreflect.FileDescriptor const file_google_spannerlib_v1_spannerlib_proto_rawDesc = "" + "\n" + - "%google/spannerlib/v1/spannerlib.proto\x12\x14google.spannerlib.v1\x1a\x1fgoogle/api/field_behavior.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a\x1cgoogle/protobuf/struct.proto\x1a\"google/spanner/v1/result_set.proto\x1a\x1fgoogle/spanner/v1/spanner.proto\x1a#google/spanner/v1/transaction.proto\"\r\n" + + "%google/spannerlib/v1/spannerlib.proto\x12\x14google.spannerlib.v1\x1a\x1fgoogle/api/field_behavior.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a\x1cgoogle/protobuf/struct.proto\x1a\x17google/rpc/status.proto\x1a\"google/spanner/v1/result_set.proto\x1a\x1fgoogle/spanner/v1/spanner.proto\x1a#google/spanner/v1/transaction.proto\"\r\n" + "\vInfoRequest\"(\n" + "\fInfoResponse\x12\x18\n" + "\aversion\x18\x01 \x01(\tR\aversion\"E\n" + "\x11CreatePoolRequest\x120\n" + "\x11connection_string\x18\x01 \x01(\tB\x03\xe0A\x02R\x10connectionString\"N\n" + "\x17CreateConnectionRequest\x123\n" + - "\x04pool\x18\x01 \x01(\v2\x1a.google.spannerlib.v1.PoolB\x03\xe0A\x02R\x04pool\"\xb2\x01\n" + + "\x04pool\x18\x01 \x01(\v2\x1a.google.spannerlib.v1.PoolB\x03\xe0A\x02R\x04pool\"O\n" + + "\fFetchOptions\x12\x1e\n" + + "\bnum_rows\x18\x01 \x01(\x03B\x03\xe0A\x02R\anumRows\x12\x1f\n" + + "\bencoding\x18\x02 \x01(\x03B\x03\xe0A\x02R\bencoding\"\xfb\x01\n" + "\x0eExecuteRequest\x12E\n" + "\n" + "connection\x18\x01 \x01(\v2 .google.spannerlib.v1.ConnectionB\x03\xe0A\x02R\n" + "connection\x12Y\n" + - "\x13execute_sql_request\x18\x02 \x01(\v2$.google.spanner.v1.ExecuteSqlRequestB\x03\xe0A\x02R\x11executeSqlRequest\"\xc7\x01\n" + + "\x13execute_sql_request\x18\x02 \x01(\v2$.google.spanner.v1.ExecuteSqlRequestB\x03\xe0A\x02R\x11executeSqlRequest\x12G\n" + + "\rfetch_options\x18\x03 \x01(\v2\".google.spannerlib.v1.FetchOptionsR\ffetchOptions\"\xc7\x01\n" + "\x13ExecuteBatchRequest\x12E\n" + "\n" + "connection\x18\x01 \x01(\v2 .google.spannerlib.v1.ConnectionB\x03\xe0A\x02R\n" + @@ -947,11 +1259,10 @@ const file_google_spannerlib_v1_spannerlib_proto_rawDesc = "" + "\n" + "connection\x18\x01 \x01(\v2 .google.spannerlib.v1.ConnectionB\x03\xe0A\x02R\n" + "connection\x12\x13\n" + - "\x02id\x18\x02 \x01(\x03B\x03\xe0A\x02R\x02id\"\x83\x01\n" + + "\x02id\x18\x02 \x01(\x03B\x03\xe0A\x02R\x02id\"\x90\x01\n" + "\vNextRequest\x123\n" + - "\x04rows\x18\x01 \x01(\v2\x1a.google.spannerlib.v1.RowsB\x03\xe0A\x02R\x04rows\x12\x1e\n" + - "\bnum_rows\x18\x02 \x01(\x03B\x03\xe0A\x02R\anumRows\x12\x1f\n" + - "\bencoding\x18\x03 \x01(\x03B\x03\xe0A\x02R\bencoding\"\x98\x02\n" + + "\x04rows\x18\x01 \x01(\v2\x1a.google.spannerlib.v1.RowsB\x03\xe0A\x02R\x04rows\x12L\n" + + "\rfetch_options\x18\x02 \x01(\v2\".google.spannerlib.v1.FetchOptionsB\x03\xe0A\x02R\ffetchOptions\"\x98\x02\n" + "\aRowData\x123\n" + "\x04rows\x18\x01 \x01(\v2\x1a.google.spannerlib.v1.RowsB\x03\xe0A\x02R\x04rows\x12@\n" + "\bmetadata\x18\x02 \x01(\v2$.google.spanner.v1.ResultSetMetadataR\bmetadata\x123\n" + @@ -961,14 +1272,31 @@ const file_google_spannerlib_v1_spannerlib_proto_rawDesc = "" + "\x0fMetadataRequest\x123\n" + "\x04rows\x18\x01 \x01(\v2\x1a.google.spannerlib.v1.RowsB\x03\xe0A\x02R\x04rows\"L\n" + "\x15ResultSetStatsRequest\x123\n" + - "\x04rows\x18\x01 \x01(\v2\x1a.google.spannerlib.v1.RowsB\x03\xe0A\x02R\x04rows\"u\n" + + "\x04rows\x18\x01 \x01(\v2\x1a.google.spannerlib.v1.RowsB\x03\xe0A\x02R\x04rows\"\xc4\x04\n" + "\x17ConnectionStreamRequest\x12O\n" + - "\x0fexecute_request\x18\x01 \x01(\v2$.google.spannerlib.v1.ExecuteRequestH\x00R\x0eexecuteRequestB\t\n" + - "\arequest\"_\n" + - "\x18ConnectionStreamResponse\x127\n" + - "\x03row\x18\x01 \x01(\v2#.google.spanner.v1.PartialResultSetH\x00R\x03rowB\n" + + "\x0fexecute_request\x18\x01 \x01(\v2$.google.spannerlib.v1.ExecuteRequestH\x00R\x0eexecuteRequest\x12_\n" + + "\x15execute_batch_request\x18\x02 \x01(\v2).google.spannerlib.v1.ExecuteBatchRequestH\x00R\x13executeBatchRequest\x12k\n" + + "\x19begin_transaction_request\x18\x03 \x01(\v2-.google.spannerlib.v1.BeginTransactionRequestH\x00R\x17beginTransactionRequest\x12I\n" + + "\x0ecommit_request\x18\x04 \x01(\v2 .google.spannerlib.v1.ConnectionH\x00R\rcommitRequest\x12M\n" + + "\x10rollback_request\x18\x05 \x01(\v2 .google.spannerlib.v1.ConnectionH\x00R\x0frollbackRequest\x12e\n" + + "\x17write_mutations_request\x18\x06 \x01(\v2+.google.spannerlib.v1.WriteMutationsRequestH\x00R\x15writeMutationsRequestB\t\n" + + "\arequest\"\xdb\x01\n" + + "\x0fExecuteResponse\x123\n" + + "\x04rows\x18\x01 \x01(\v2\x1a.google.spannerlib.v1.RowsB\x03\xe0A\x02R\x04rows\x12=\n" + + "\vresult_sets\x18\x02 \x03(\v2\x1c.google.spanner.v1.ResultSetR\n" + + "resultSets\x12*\n" + + "\x06status\x18\x03 \x01(\v2\x12.google.rpc.StatusR\x06status\x12(\n" + + "\x10has_more_results\x18\x04 \x01(\bR\x0ehasMoreResults\"\xd6\x04\n" + + "\x18ConnectionStreamResponse\x12*\n" + + "\x06status\x18\x01 \x01(\v2\x12.google.rpc.StatusR\x06status\x12R\n" + + "\x10execute_response\x18\x02 \x01(\v2%.google.spannerlib.v1.ExecuteResponseH\x00R\x0fexecuteResponse\x12b\n" + + "\x16execute_batch_response\x18\x03 \x01(\v2*.google.spanner.v1.ExecuteBatchDmlResponseH\x00R\x14executeBatchResponse\x12V\n" + + "\x1abegin_transaction_response\x18\x04 \x01(\v2\x16.google.protobuf.EmptyH\x00R\x18beginTransactionResponse\x12L\n" + + "\x0fcommit_response\x18\x05 \x01(\v2!.google.spanner.v1.CommitResponseH\x00R\x0ecommitResponse\x12E\n" + + "\x11rollback_response\x18\x06 \x01(\v2\x16.google.protobuf.EmptyH\x00R\x10rollbackResponse\x12]\n" + + "\x18write_mutations_response\x18\a \x01(\v2!.google.spanner.v1.CommitResponseH\x00R\x16writeMutationsResponseB\n" + "\n" + - "\bresponse2\x97\f\n" + + "\bresponse2\xeb\f\n" + "\n" + "SpannerLib\x12O\n" + "\x04Info\x12!.google.spannerlib.v1.InfoRequest\x1a\".google.spannerlib.v1.InfoResponse\"\x00\x12S\n" + @@ -989,7 +1317,8 @@ const file_google_spannerlib_v1_spannerlib_proto_rawDesc = "" + "\x06Commit\x12 .google.spannerlib.v1.Connection\x1a!.google.spanner.v1.CommitResponse\"\x00\x12F\n" + "\bRollback\x12 .google.spannerlib.v1.Connection\x1a\x16.google.protobuf.Empty\"\x00\x12b\n" + "\x0eWriteMutations\x12+.google.spannerlib.v1.WriteMutationsRequest\x1a!.google.spanner.v1.CommitResponse\"\x00\x12w\n" + - "\x10ConnectionStream\x12-.google.spannerlib.v1.ConnectionStreamRequest\x1a..google.spannerlib.v1.ConnectionStreamResponse\"\x00(\x010\x01B\xcd\x01\n" + + "\x10ConnectionStream\x12-.google.spannerlib.v1.ConnectionStreamRequest\x1a..google.spannerlib.v1.ConnectionStreamResponse\"\x00(\x010\x01\x12R\n" + + "\x11ContinueStreaming\x12\x1a.google.spannerlib.v1.Rows\x1a\x1d.google.spannerlib.v1.RowData\"\x000\x01B\xcd\x01\n" + "\x1ecom.google.cloud.spannerlib.v1B\x0fSpannerLibProtoP\x01Z>cloud.google.com/go/spannerlib/apiv1/spannerlibpb;spannerlibpb\xaa\x02\x1aGoogle.Cloud.SpannerLib.V1\xca\x02\x1aGoogle\\Cloud\\SpannerLib\\V1\xea\x02\x1dGoogle::Cloud::SpannerLib::V1b\x06proto3" var ( @@ -1004,99 +1333,120 @@ func file_google_spannerlib_v1_spannerlib_proto_rawDescGZIP() []byte { return file_google_spannerlib_v1_spannerlib_proto_rawDescData } -var file_google_spannerlib_v1_spannerlib_proto_msgTypes = make([]protoimpl.MessageInfo, 17) +var file_google_spannerlib_v1_spannerlib_proto_msgTypes = make([]protoimpl.MessageInfo, 19) var file_google_spannerlib_v1_spannerlib_proto_goTypes = []any{ (*InfoRequest)(nil), // 0: google.spannerlib.v1.InfoRequest (*InfoResponse)(nil), // 1: google.spannerlib.v1.InfoResponse (*CreatePoolRequest)(nil), // 2: google.spannerlib.v1.CreatePoolRequest (*CreateConnectionRequest)(nil), // 3: google.spannerlib.v1.CreateConnectionRequest - (*ExecuteRequest)(nil), // 4: google.spannerlib.v1.ExecuteRequest - (*ExecuteBatchRequest)(nil), // 5: google.spannerlib.v1.ExecuteBatchRequest - (*BeginTransactionRequest)(nil), // 6: google.spannerlib.v1.BeginTransactionRequest - (*WriteMutationsRequest)(nil), // 7: google.spannerlib.v1.WriteMutationsRequest - (*Pool)(nil), // 8: google.spannerlib.v1.Pool - (*Connection)(nil), // 9: google.spannerlib.v1.Connection - (*Rows)(nil), // 10: google.spannerlib.v1.Rows - (*NextRequest)(nil), // 11: google.spannerlib.v1.NextRequest - (*RowData)(nil), // 12: google.spannerlib.v1.RowData - (*MetadataRequest)(nil), // 13: google.spannerlib.v1.MetadataRequest - (*ResultSetStatsRequest)(nil), // 14: google.spannerlib.v1.ResultSetStatsRequest - (*ConnectionStreamRequest)(nil), // 15: google.spannerlib.v1.ConnectionStreamRequest - (*ConnectionStreamResponse)(nil), // 16: google.spannerlib.v1.ConnectionStreamResponse - (*spannerpb.ExecuteSqlRequest)(nil), // 17: google.spanner.v1.ExecuteSqlRequest - (*spannerpb.ExecuteBatchDmlRequest)(nil), // 18: google.spanner.v1.ExecuteBatchDmlRequest - (*spannerpb.TransactionOptions)(nil), // 19: google.spanner.v1.TransactionOptions - (*spannerpb.BatchWriteRequest_MutationGroup)(nil), // 20: google.spanner.v1.BatchWriteRequest.MutationGroup - (*spannerpb.ResultSetMetadata)(nil), // 21: google.spanner.v1.ResultSetMetadata - (*structpb.ListValue)(nil), // 22: google.protobuf.ListValue - (*spannerpb.ResultSetStats)(nil), // 23: google.spanner.v1.ResultSetStats - (*spannerpb.PartialResultSet)(nil), // 24: google.spanner.v1.PartialResultSet - (*emptypb.Empty)(nil), // 25: google.protobuf.Empty - (*spannerpb.ExecuteBatchDmlResponse)(nil), // 26: google.spanner.v1.ExecuteBatchDmlResponse - (*spannerpb.CommitResponse)(nil), // 27: google.spanner.v1.CommitResponse + (*FetchOptions)(nil), // 4: google.spannerlib.v1.FetchOptions + (*ExecuteRequest)(nil), // 5: google.spannerlib.v1.ExecuteRequest + (*ExecuteBatchRequest)(nil), // 6: google.spannerlib.v1.ExecuteBatchRequest + (*BeginTransactionRequest)(nil), // 7: google.spannerlib.v1.BeginTransactionRequest + (*WriteMutationsRequest)(nil), // 8: google.spannerlib.v1.WriteMutationsRequest + (*Pool)(nil), // 9: google.spannerlib.v1.Pool + (*Connection)(nil), // 10: google.spannerlib.v1.Connection + (*Rows)(nil), // 11: google.spannerlib.v1.Rows + (*NextRequest)(nil), // 12: google.spannerlib.v1.NextRequest + (*RowData)(nil), // 13: google.spannerlib.v1.RowData + (*MetadataRequest)(nil), // 14: google.spannerlib.v1.MetadataRequest + (*ResultSetStatsRequest)(nil), // 15: google.spannerlib.v1.ResultSetStatsRequest + (*ConnectionStreamRequest)(nil), // 16: google.spannerlib.v1.ConnectionStreamRequest + (*ExecuteResponse)(nil), // 17: google.spannerlib.v1.ExecuteResponse + (*ConnectionStreamResponse)(nil), // 18: google.spannerlib.v1.ConnectionStreamResponse + (*spannerpb.ExecuteSqlRequest)(nil), // 19: google.spanner.v1.ExecuteSqlRequest + (*spannerpb.ExecuteBatchDmlRequest)(nil), // 20: google.spanner.v1.ExecuteBatchDmlRequest + (*spannerpb.TransactionOptions)(nil), // 21: google.spanner.v1.TransactionOptions + (*spannerpb.BatchWriteRequest_MutationGroup)(nil), // 22: google.spanner.v1.BatchWriteRequest.MutationGroup + (*spannerpb.ResultSetMetadata)(nil), // 23: google.spanner.v1.ResultSetMetadata + (*structpb.ListValue)(nil), // 24: google.protobuf.ListValue + (*spannerpb.ResultSetStats)(nil), // 25: google.spanner.v1.ResultSetStats + (*spannerpb.ResultSet)(nil), // 26: google.spanner.v1.ResultSet + (*status.Status)(nil), // 27: google.rpc.Status + (*spannerpb.ExecuteBatchDmlResponse)(nil), // 28: google.spanner.v1.ExecuteBatchDmlResponse + (*emptypb.Empty)(nil), // 29: google.protobuf.Empty + (*spannerpb.CommitResponse)(nil), // 30: google.spanner.v1.CommitResponse } var file_google_spannerlib_v1_spannerlib_proto_depIdxs = []int32{ - 8, // 0: google.spannerlib.v1.CreateConnectionRequest.pool:type_name -> google.spannerlib.v1.Pool - 9, // 1: google.spannerlib.v1.ExecuteRequest.connection:type_name -> google.spannerlib.v1.Connection - 17, // 2: google.spannerlib.v1.ExecuteRequest.execute_sql_request:type_name -> google.spanner.v1.ExecuteSqlRequest - 9, // 3: google.spannerlib.v1.ExecuteBatchRequest.connection:type_name -> google.spannerlib.v1.Connection - 18, // 4: google.spannerlib.v1.ExecuteBatchRequest.execute_batch_dml_request:type_name -> google.spanner.v1.ExecuteBatchDmlRequest - 9, // 5: google.spannerlib.v1.BeginTransactionRequest.connection:type_name -> google.spannerlib.v1.Connection - 19, // 6: google.spannerlib.v1.BeginTransactionRequest.transaction_options:type_name -> google.spanner.v1.TransactionOptions - 9, // 7: google.spannerlib.v1.WriteMutationsRequest.connection:type_name -> google.spannerlib.v1.Connection - 20, // 8: google.spannerlib.v1.WriteMutationsRequest.mutations:type_name -> google.spanner.v1.BatchWriteRequest.MutationGroup - 8, // 9: google.spannerlib.v1.Connection.pool:type_name -> google.spannerlib.v1.Pool - 9, // 10: google.spannerlib.v1.Rows.connection:type_name -> google.spannerlib.v1.Connection - 10, // 11: google.spannerlib.v1.NextRequest.rows:type_name -> google.spannerlib.v1.Rows - 10, // 12: google.spannerlib.v1.RowData.rows:type_name -> google.spannerlib.v1.Rows - 21, // 13: google.spannerlib.v1.RowData.metadata:type_name -> google.spanner.v1.ResultSetMetadata - 22, // 14: google.spannerlib.v1.RowData.data:type_name -> google.protobuf.ListValue - 23, // 15: google.spannerlib.v1.RowData.stats:type_name -> google.spanner.v1.ResultSetStats - 10, // 16: google.spannerlib.v1.MetadataRequest.rows:type_name -> google.spannerlib.v1.Rows - 10, // 17: google.spannerlib.v1.ResultSetStatsRequest.rows:type_name -> google.spannerlib.v1.Rows - 4, // 18: google.spannerlib.v1.ConnectionStreamRequest.execute_request:type_name -> google.spannerlib.v1.ExecuteRequest - 24, // 19: google.spannerlib.v1.ConnectionStreamResponse.row:type_name -> google.spanner.v1.PartialResultSet - 0, // 20: google.spannerlib.v1.SpannerLib.Info:input_type -> google.spannerlib.v1.InfoRequest - 2, // 21: google.spannerlib.v1.SpannerLib.CreatePool:input_type -> google.spannerlib.v1.CreatePoolRequest - 8, // 22: google.spannerlib.v1.SpannerLib.ClosePool:input_type -> google.spannerlib.v1.Pool - 3, // 23: google.spannerlib.v1.SpannerLib.CreateConnection:input_type -> google.spannerlib.v1.CreateConnectionRequest - 9, // 24: google.spannerlib.v1.SpannerLib.CloseConnection:input_type -> google.spannerlib.v1.Connection - 4, // 25: google.spannerlib.v1.SpannerLib.Execute:input_type -> google.spannerlib.v1.ExecuteRequest - 4, // 26: google.spannerlib.v1.SpannerLib.ExecuteStreaming:input_type -> google.spannerlib.v1.ExecuteRequest - 5, // 27: google.spannerlib.v1.SpannerLib.ExecuteBatch:input_type -> google.spannerlib.v1.ExecuteBatchRequest - 10, // 28: google.spannerlib.v1.SpannerLib.Metadata:input_type -> google.spannerlib.v1.Rows - 11, // 29: google.spannerlib.v1.SpannerLib.Next:input_type -> google.spannerlib.v1.NextRequest - 10, // 30: google.spannerlib.v1.SpannerLib.ResultSetStats:input_type -> google.spannerlib.v1.Rows - 10, // 31: google.spannerlib.v1.SpannerLib.NextResultSet:input_type -> google.spannerlib.v1.Rows - 10, // 32: google.spannerlib.v1.SpannerLib.CloseRows:input_type -> google.spannerlib.v1.Rows - 6, // 33: google.spannerlib.v1.SpannerLib.BeginTransaction:input_type -> google.spannerlib.v1.BeginTransactionRequest - 9, // 34: google.spannerlib.v1.SpannerLib.Commit:input_type -> google.spannerlib.v1.Connection - 9, // 35: google.spannerlib.v1.SpannerLib.Rollback:input_type -> google.spannerlib.v1.Connection - 7, // 36: google.spannerlib.v1.SpannerLib.WriteMutations:input_type -> google.spannerlib.v1.WriteMutationsRequest - 15, // 37: google.spannerlib.v1.SpannerLib.ConnectionStream:input_type -> google.spannerlib.v1.ConnectionStreamRequest - 1, // 38: google.spannerlib.v1.SpannerLib.Info:output_type -> google.spannerlib.v1.InfoResponse - 8, // 39: google.spannerlib.v1.SpannerLib.CreatePool:output_type -> google.spannerlib.v1.Pool - 25, // 40: google.spannerlib.v1.SpannerLib.ClosePool:output_type -> google.protobuf.Empty - 9, // 41: google.spannerlib.v1.SpannerLib.CreateConnection:output_type -> google.spannerlib.v1.Connection - 25, // 42: google.spannerlib.v1.SpannerLib.CloseConnection:output_type -> google.protobuf.Empty - 10, // 43: google.spannerlib.v1.SpannerLib.Execute:output_type -> google.spannerlib.v1.Rows - 12, // 44: google.spannerlib.v1.SpannerLib.ExecuteStreaming:output_type -> google.spannerlib.v1.RowData - 26, // 45: google.spannerlib.v1.SpannerLib.ExecuteBatch:output_type -> google.spanner.v1.ExecuteBatchDmlResponse - 21, // 46: google.spannerlib.v1.SpannerLib.Metadata:output_type -> google.spanner.v1.ResultSetMetadata - 22, // 47: google.spannerlib.v1.SpannerLib.Next:output_type -> google.protobuf.ListValue - 23, // 48: google.spannerlib.v1.SpannerLib.ResultSetStats:output_type -> google.spanner.v1.ResultSetStats - 21, // 49: google.spannerlib.v1.SpannerLib.NextResultSet:output_type -> google.spanner.v1.ResultSetMetadata - 25, // 50: google.spannerlib.v1.SpannerLib.CloseRows:output_type -> google.protobuf.Empty - 25, // 51: google.spannerlib.v1.SpannerLib.BeginTransaction:output_type -> google.protobuf.Empty - 27, // 52: google.spannerlib.v1.SpannerLib.Commit:output_type -> google.spanner.v1.CommitResponse - 25, // 53: google.spannerlib.v1.SpannerLib.Rollback:output_type -> google.protobuf.Empty - 27, // 54: google.spannerlib.v1.SpannerLib.WriteMutations:output_type -> google.spanner.v1.CommitResponse - 16, // 55: google.spannerlib.v1.SpannerLib.ConnectionStream:output_type -> google.spannerlib.v1.ConnectionStreamResponse - 38, // [38:56] is the sub-list for method output_type - 20, // [20:38] is the sub-list for method input_type - 20, // [20:20] is the sub-list for extension type_name - 20, // [20:20] is the sub-list for extension extendee - 0, // [0:20] is the sub-list for field type_name + 9, // 0: google.spannerlib.v1.CreateConnectionRequest.pool:type_name -> google.spannerlib.v1.Pool + 10, // 1: google.spannerlib.v1.ExecuteRequest.connection:type_name -> google.spannerlib.v1.Connection + 19, // 2: google.spannerlib.v1.ExecuteRequest.execute_sql_request:type_name -> google.spanner.v1.ExecuteSqlRequest + 4, // 3: google.spannerlib.v1.ExecuteRequest.fetch_options:type_name -> google.spannerlib.v1.FetchOptions + 10, // 4: google.spannerlib.v1.ExecuteBatchRequest.connection:type_name -> google.spannerlib.v1.Connection + 20, // 5: google.spannerlib.v1.ExecuteBatchRequest.execute_batch_dml_request:type_name -> google.spanner.v1.ExecuteBatchDmlRequest + 10, // 6: google.spannerlib.v1.BeginTransactionRequest.connection:type_name -> google.spannerlib.v1.Connection + 21, // 7: google.spannerlib.v1.BeginTransactionRequest.transaction_options:type_name -> google.spanner.v1.TransactionOptions + 10, // 8: google.spannerlib.v1.WriteMutationsRequest.connection:type_name -> google.spannerlib.v1.Connection + 22, // 9: google.spannerlib.v1.WriteMutationsRequest.mutations:type_name -> google.spanner.v1.BatchWriteRequest.MutationGroup + 9, // 10: google.spannerlib.v1.Connection.pool:type_name -> google.spannerlib.v1.Pool + 10, // 11: google.spannerlib.v1.Rows.connection:type_name -> google.spannerlib.v1.Connection + 11, // 12: google.spannerlib.v1.NextRequest.rows:type_name -> google.spannerlib.v1.Rows + 4, // 13: google.spannerlib.v1.NextRequest.fetch_options:type_name -> google.spannerlib.v1.FetchOptions + 11, // 14: google.spannerlib.v1.RowData.rows:type_name -> google.spannerlib.v1.Rows + 23, // 15: google.spannerlib.v1.RowData.metadata:type_name -> google.spanner.v1.ResultSetMetadata + 24, // 16: google.spannerlib.v1.RowData.data:type_name -> google.protobuf.ListValue + 25, // 17: google.spannerlib.v1.RowData.stats:type_name -> google.spanner.v1.ResultSetStats + 11, // 18: google.spannerlib.v1.MetadataRequest.rows:type_name -> google.spannerlib.v1.Rows + 11, // 19: google.spannerlib.v1.ResultSetStatsRequest.rows:type_name -> google.spannerlib.v1.Rows + 5, // 20: google.spannerlib.v1.ConnectionStreamRequest.execute_request:type_name -> google.spannerlib.v1.ExecuteRequest + 6, // 21: google.spannerlib.v1.ConnectionStreamRequest.execute_batch_request:type_name -> google.spannerlib.v1.ExecuteBatchRequest + 7, // 22: google.spannerlib.v1.ConnectionStreamRequest.begin_transaction_request:type_name -> google.spannerlib.v1.BeginTransactionRequest + 10, // 23: google.spannerlib.v1.ConnectionStreamRequest.commit_request:type_name -> google.spannerlib.v1.Connection + 10, // 24: google.spannerlib.v1.ConnectionStreamRequest.rollback_request:type_name -> google.spannerlib.v1.Connection + 8, // 25: google.spannerlib.v1.ConnectionStreamRequest.write_mutations_request:type_name -> google.spannerlib.v1.WriteMutationsRequest + 11, // 26: google.spannerlib.v1.ExecuteResponse.rows:type_name -> google.spannerlib.v1.Rows + 26, // 27: google.spannerlib.v1.ExecuteResponse.result_sets:type_name -> google.spanner.v1.ResultSet + 27, // 28: google.spannerlib.v1.ExecuteResponse.status:type_name -> google.rpc.Status + 27, // 29: google.spannerlib.v1.ConnectionStreamResponse.status:type_name -> google.rpc.Status + 17, // 30: google.spannerlib.v1.ConnectionStreamResponse.execute_response:type_name -> google.spannerlib.v1.ExecuteResponse + 28, // 31: google.spannerlib.v1.ConnectionStreamResponse.execute_batch_response:type_name -> google.spanner.v1.ExecuteBatchDmlResponse + 29, // 32: google.spannerlib.v1.ConnectionStreamResponse.begin_transaction_response:type_name -> google.protobuf.Empty + 30, // 33: google.spannerlib.v1.ConnectionStreamResponse.commit_response:type_name -> google.spanner.v1.CommitResponse + 29, // 34: google.spannerlib.v1.ConnectionStreamResponse.rollback_response:type_name -> google.protobuf.Empty + 30, // 35: google.spannerlib.v1.ConnectionStreamResponse.write_mutations_response:type_name -> google.spanner.v1.CommitResponse + 0, // 36: google.spannerlib.v1.SpannerLib.Info:input_type -> google.spannerlib.v1.InfoRequest + 2, // 37: google.spannerlib.v1.SpannerLib.CreatePool:input_type -> google.spannerlib.v1.CreatePoolRequest + 9, // 38: google.spannerlib.v1.SpannerLib.ClosePool:input_type -> google.spannerlib.v1.Pool + 3, // 39: google.spannerlib.v1.SpannerLib.CreateConnection:input_type -> google.spannerlib.v1.CreateConnectionRequest + 10, // 40: google.spannerlib.v1.SpannerLib.CloseConnection:input_type -> google.spannerlib.v1.Connection + 5, // 41: google.spannerlib.v1.SpannerLib.Execute:input_type -> google.spannerlib.v1.ExecuteRequest + 5, // 42: google.spannerlib.v1.SpannerLib.ExecuteStreaming:input_type -> google.spannerlib.v1.ExecuteRequest + 6, // 43: google.spannerlib.v1.SpannerLib.ExecuteBatch:input_type -> google.spannerlib.v1.ExecuteBatchRequest + 11, // 44: google.spannerlib.v1.SpannerLib.Metadata:input_type -> google.spannerlib.v1.Rows + 12, // 45: google.spannerlib.v1.SpannerLib.Next:input_type -> google.spannerlib.v1.NextRequest + 11, // 46: google.spannerlib.v1.SpannerLib.ResultSetStats:input_type -> google.spannerlib.v1.Rows + 11, // 47: google.spannerlib.v1.SpannerLib.NextResultSet:input_type -> google.spannerlib.v1.Rows + 11, // 48: google.spannerlib.v1.SpannerLib.CloseRows:input_type -> google.spannerlib.v1.Rows + 7, // 49: google.spannerlib.v1.SpannerLib.BeginTransaction:input_type -> google.spannerlib.v1.BeginTransactionRequest + 10, // 50: google.spannerlib.v1.SpannerLib.Commit:input_type -> google.spannerlib.v1.Connection + 10, // 51: google.spannerlib.v1.SpannerLib.Rollback:input_type -> google.spannerlib.v1.Connection + 8, // 52: google.spannerlib.v1.SpannerLib.WriteMutations:input_type -> google.spannerlib.v1.WriteMutationsRequest + 16, // 53: google.spannerlib.v1.SpannerLib.ConnectionStream:input_type -> google.spannerlib.v1.ConnectionStreamRequest + 11, // 54: google.spannerlib.v1.SpannerLib.ContinueStreaming:input_type -> google.spannerlib.v1.Rows + 1, // 55: google.spannerlib.v1.SpannerLib.Info:output_type -> google.spannerlib.v1.InfoResponse + 9, // 56: google.spannerlib.v1.SpannerLib.CreatePool:output_type -> google.spannerlib.v1.Pool + 29, // 57: google.spannerlib.v1.SpannerLib.ClosePool:output_type -> google.protobuf.Empty + 10, // 58: google.spannerlib.v1.SpannerLib.CreateConnection:output_type -> google.spannerlib.v1.Connection + 29, // 59: google.spannerlib.v1.SpannerLib.CloseConnection:output_type -> google.protobuf.Empty + 11, // 60: google.spannerlib.v1.SpannerLib.Execute:output_type -> google.spannerlib.v1.Rows + 13, // 61: google.spannerlib.v1.SpannerLib.ExecuteStreaming:output_type -> google.spannerlib.v1.RowData + 28, // 62: google.spannerlib.v1.SpannerLib.ExecuteBatch:output_type -> google.spanner.v1.ExecuteBatchDmlResponse + 23, // 63: google.spannerlib.v1.SpannerLib.Metadata:output_type -> google.spanner.v1.ResultSetMetadata + 24, // 64: google.spannerlib.v1.SpannerLib.Next:output_type -> google.protobuf.ListValue + 25, // 65: google.spannerlib.v1.SpannerLib.ResultSetStats:output_type -> google.spanner.v1.ResultSetStats + 23, // 66: google.spannerlib.v1.SpannerLib.NextResultSet:output_type -> google.spanner.v1.ResultSetMetadata + 29, // 67: google.spannerlib.v1.SpannerLib.CloseRows:output_type -> google.protobuf.Empty + 29, // 68: google.spannerlib.v1.SpannerLib.BeginTransaction:output_type -> google.protobuf.Empty + 30, // 69: google.spannerlib.v1.SpannerLib.Commit:output_type -> google.spanner.v1.CommitResponse + 29, // 70: google.spannerlib.v1.SpannerLib.Rollback:output_type -> google.protobuf.Empty + 30, // 71: google.spannerlib.v1.SpannerLib.WriteMutations:output_type -> google.spanner.v1.CommitResponse + 18, // 72: google.spannerlib.v1.SpannerLib.ConnectionStream:output_type -> google.spannerlib.v1.ConnectionStreamResponse + 13, // 73: google.spannerlib.v1.SpannerLib.ContinueStreaming:output_type -> google.spannerlib.v1.RowData + 55, // [55:74] is the sub-list for method output_type + 36, // [36:55] is the sub-list for method input_type + 36, // [36:36] is the sub-list for extension type_name + 36, // [36:36] is the sub-list for extension extendee + 0, // [0:36] is the sub-list for field type_name } func init() { file_google_spannerlib_v1_spannerlib_proto_init() } @@ -1104,11 +1454,21 @@ func file_google_spannerlib_v1_spannerlib_proto_init() { if File_google_spannerlib_v1_spannerlib_proto != nil { return } - file_google_spannerlib_v1_spannerlib_proto_msgTypes[15].OneofWrappers = []any{ + file_google_spannerlib_v1_spannerlib_proto_msgTypes[16].OneofWrappers = []any{ (*ConnectionStreamRequest_ExecuteRequest)(nil), + (*ConnectionStreamRequest_ExecuteBatchRequest)(nil), + (*ConnectionStreamRequest_BeginTransactionRequest)(nil), + (*ConnectionStreamRequest_CommitRequest)(nil), + (*ConnectionStreamRequest_RollbackRequest)(nil), + (*ConnectionStreamRequest_WriteMutationsRequest)(nil), } - file_google_spannerlib_v1_spannerlib_proto_msgTypes[16].OneofWrappers = []any{ - (*ConnectionStreamResponse_Row)(nil), + file_google_spannerlib_v1_spannerlib_proto_msgTypes[18].OneofWrappers = []any{ + (*ConnectionStreamResponse_ExecuteResponse)(nil), + (*ConnectionStreamResponse_ExecuteBatchResponse)(nil), + (*ConnectionStreamResponse_BeginTransactionResponse)(nil), + (*ConnectionStreamResponse_CommitResponse)(nil), + (*ConnectionStreamResponse_RollbackResponse)(nil), + (*ConnectionStreamResponse_WriteMutationsResponse)(nil), } type x struct{} out := protoimpl.TypeBuilder{ @@ -1116,7 +1476,7 @@ func file_google_spannerlib_v1_spannerlib_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_google_spannerlib_v1_spannerlib_proto_rawDesc), len(file_google_spannerlib_v1_spannerlib_proto_rawDesc)), NumEnums: 0, - NumMessages: 17, + NumMessages: 19, NumExtensions: 0, NumServices: 1, }, diff --git a/spannerlib/grpc-server/google/spannerlib/v1/spannerlib.proto b/spannerlib/grpc-server/google/spannerlib/v1/spannerlib.proto index 4cf46d2e..458f2154 100644 --- a/spannerlib/grpc-server/google/spannerlib/v1/spannerlib.proto +++ b/spannerlib/grpc-server/google/spannerlib/v1/spannerlib.proto @@ -5,6 +5,7 @@ package google.spannerlib.v1; import "google/api/field_behavior.proto"; import "google/protobuf/empty.proto"; import "google/protobuf/struct.proto"; +import "google/rpc/status.proto"; import "google/spanner/v1/result_set.proto"; import "google/spanner/v1/spanner.proto"; import "google/spanner/v1/transaction.proto"; @@ -41,7 +42,16 @@ service SpannerLib { rpc WriteMutations(WriteMutationsRequest) returns (google.spanner.v1.CommitResponse) {} + // ConnectionStream opens a bi-directional gRPC stream between the client and the server. + // This stream can be re-used by the client for multiple requests, and normally gives the + // lowest possible latency, at the cost of a slightly more complex API. rpc ConnectionStream(stream ConnectionStreamRequest) returns (stream ConnectionStreamResponse) {} + + // ContinueStreaming returns a server stream that returns the remaining rows of a SQL statement + // that has previously been executed using a ConnectionStreamRequest on a bi-directional + // ConnectionStream. The client is responsible for calling this RPC if the has_more_data flag + // of the ExecuteResponse was true. + rpc ContinueStreaming(Rows) returns (stream RowData) {} } message InfoRequest { @@ -63,6 +73,15 @@ message CreateConnectionRequest { ]; } +message FetchOptions { + int64 num_rows = 1 [ + (google.api.field_behavior) = REQUIRED + ]; + int64 encoding = 2 [ + (google.api.field_behavior) = REQUIRED + ]; +} + message ExecuteRequest { Connection connection = 1 [ (google.api.field_behavior) = REQUIRED @@ -70,6 +89,7 @@ message ExecuteRequest { google.spanner.v1.ExecuteSqlRequest execute_sql_request = 2 [ (google.api.field_behavior) = REQUIRED ]; + FetchOptions fetch_options = 3; } message ExecuteBatchRequest { @@ -127,10 +147,7 @@ message NextRequest { Rows rows = 1 [ (google.api.field_behavior) = REQUIRED ]; - int64 num_rows = 2 [ - (google.api.field_behavior) = REQUIRED - ]; - int64 encoding = 3 [ + FetchOptions fetch_options = 2 [ (google.api.field_behavior) = REQUIRED ]; } @@ -159,14 +176,53 @@ message ResultSetStatsRequest { ]; } +// ConnectionStreamRequest is used by a client to send a request to the server using a +// bi-directional gRPC stream. Such a stream is opened by calling the ConnectionStream RPC. message ConnectionStreamRequest { oneof request { ExecuteRequest execute_request = 1; + ExecuteBatchRequest execute_batch_request = 2; + BeginTransactionRequest begin_transaction_request = 3; + Connection commit_request = 4; + Connection rollback_request = 5; + WriteMutationsRequest write_mutations_request = 6; } } +// ExecuteResponse is returned by the server when it receives an ExecuteRequest on a bi-directional +// ConnectionStream. The response contains the first N rows, the metadata, and an indication whether +// the result contains more data than in the initial response. The client should fetch the remaining +// data by calling the ContinueStreaming RPC. This will start a separate server stream with the +// remaining results. The client can continue to send additional requests on the ConnectionStream +// while the additional server stream is open. +// +// The initial response also contains the ResultSetStats if there is no more data to be returned. +message ExecuteResponse { + Rows rows = 1 [ + (google.api.field_behavior) = REQUIRED + ]; + repeated google.spanner.v1.ResultSet result_sets = 2; + google.rpc.Status status = 3; + bool has_more_results = 4; +} + +// ConnectionStreamResponse is returned by the server when it receives a ConnectionStreamRequest. +// The contents of the response depends on the request that the client sent. +// +// The response contains a Status that indicates whether the request succeeded or not. The stream +// itself normally does not return an error if a request fails. +// The stream only returns an error and is discontinued in case of a network error or other +// unexpected internal errors. message ConnectionStreamResponse { + // Status indicates whether the request succeeded or failed. The response field only contains + // a value if the status code is OK. + google.rpc.Status status = 1; oneof response { - google.spanner.v1.PartialResultSet row = 1; + ExecuteResponse execute_response = 2; + google.spanner.v1.ExecuteBatchDmlResponse execute_batch_response = 3; + google.protobuf.Empty begin_transaction_response = 4; + google.spanner.v1.CommitResponse commit_response = 5; + google.protobuf.Empty rollback_response = 6; + google.spanner.v1.CommitResponse write_mutations_response = 7; } } diff --git a/spannerlib/grpc-server/google/spannerlib/v1/spannerlib_grpc.pb.go b/spannerlib/grpc-server/google/spannerlib/v1/spannerlib_grpc.pb.go index 73ceb12f..4b9de47b 100644 --- a/spannerlib/grpc-server/google/spannerlib/v1/spannerlib_grpc.pb.go +++ b/spannerlib/grpc-server/google/spannerlib/v1/spannerlib_grpc.pb.go @@ -22,24 +22,25 @@ import ( const _ = grpc.SupportPackageIsVersion9 const ( - SpannerLib_Info_FullMethodName = "/google.spannerlib.v1.SpannerLib/Info" - SpannerLib_CreatePool_FullMethodName = "/google.spannerlib.v1.SpannerLib/CreatePool" - SpannerLib_ClosePool_FullMethodName = "/google.spannerlib.v1.SpannerLib/ClosePool" - SpannerLib_CreateConnection_FullMethodName = "/google.spannerlib.v1.SpannerLib/CreateConnection" - SpannerLib_CloseConnection_FullMethodName = "/google.spannerlib.v1.SpannerLib/CloseConnection" - SpannerLib_Execute_FullMethodName = "/google.spannerlib.v1.SpannerLib/Execute" - SpannerLib_ExecuteStreaming_FullMethodName = "/google.spannerlib.v1.SpannerLib/ExecuteStreaming" - SpannerLib_ExecuteBatch_FullMethodName = "/google.spannerlib.v1.SpannerLib/ExecuteBatch" - SpannerLib_Metadata_FullMethodName = "/google.spannerlib.v1.SpannerLib/Metadata" - SpannerLib_Next_FullMethodName = "/google.spannerlib.v1.SpannerLib/Next" - SpannerLib_ResultSetStats_FullMethodName = "/google.spannerlib.v1.SpannerLib/ResultSetStats" - SpannerLib_NextResultSet_FullMethodName = "/google.spannerlib.v1.SpannerLib/NextResultSet" - SpannerLib_CloseRows_FullMethodName = "/google.spannerlib.v1.SpannerLib/CloseRows" - SpannerLib_BeginTransaction_FullMethodName = "/google.spannerlib.v1.SpannerLib/BeginTransaction" - SpannerLib_Commit_FullMethodName = "/google.spannerlib.v1.SpannerLib/Commit" - SpannerLib_Rollback_FullMethodName = "/google.spannerlib.v1.SpannerLib/Rollback" - SpannerLib_WriteMutations_FullMethodName = "/google.spannerlib.v1.SpannerLib/WriteMutations" - SpannerLib_ConnectionStream_FullMethodName = "/google.spannerlib.v1.SpannerLib/ConnectionStream" + SpannerLib_Info_FullMethodName = "/google.spannerlib.v1.SpannerLib/Info" + SpannerLib_CreatePool_FullMethodName = "/google.spannerlib.v1.SpannerLib/CreatePool" + SpannerLib_ClosePool_FullMethodName = "/google.spannerlib.v1.SpannerLib/ClosePool" + SpannerLib_CreateConnection_FullMethodName = "/google.spannerlib.v1.SpannerLib/CreateConnection" + SpannerLib_CloseConnection_FullMethodName = "/google.spannerlib.v1.SpannerLib/CloseConnection" + SpannerLib_Execute_FullMethodName = "/google.spannerlib.v1.SpannerLib/Execute" + SpannerLib_ExecuteStreaming_FullMethodName = "/google.spannerlib.v1.SpannerLib/ExecuteStreaming" + SpannerLib_ExecuteBatch_FullMethodName = "/google.spannerlib.v1.SpannerLib/ExecuteBatch" + SpannerLib_Metadata_FullMethodName = "/google.spannerlib.v1.SpannerLib/Metadata" + SpannerLib_Next_FullMethodName = "/google.spannerlib.v1.SpannerLib/Next" + SpannerLib_ResultSetStats_FullMethodName = "/google.spannerlib.v1.SpannerLib/ResultSetStats" + SpannerLib_NextResultSet_FullMethodName = "/google.spannerlib.v1.SpannerLib/NextResultSet" + SpannerLib_CloseRows_FullMethodName = "/google.spannerlib.v1.SpannerLib/CloseRows" + SpannerLib_BeginTransaction_FullMethodName = "/google.spannerlib.v1.SpannerLib/BeginTransaction" + SpannerLib_Commit_FullMethodName = "/google.spannerlib.v1.SpannerLib/Commit" + SpannerLib_Rollback_FullMethodName = "/google.spannerlib.v1.SpannerLib/Rollback" + SpannerLib_WriteMutations_FullMethodName = "/google.spannerlib.v1.SpannerLib/WriteMutations" + SpannerLib_ConnectionStream_FullMethodName = "/google.spannerlib.v1.SpannerLib/ConnectionStream" + SpannerLib_ContinueStreaming_FullMethodName = "/google.spannerlib.v1.SpannerLib/ContinueStreaming" ) // SpannerLibClient is the client API for SpannerLib service. @@ -63,7 +64,15 @@ type SpannerLibClient interface { Commit(ctx context.Context, in *Connection, opts ...grpc.CallOption) (*spannerpb.CommitResponse, error) Rollback(ctx context.Context, in *Connection, opts ...grpc.CallOption) (*emptypb.Empty, error) WriteMutations(ctx context.Context, in *WriteMutationsRequest, opts ...grpc.CallOption) (*spannerpb.CommitResponse, error) + // ConnectionStream opens a bi-directional gRPC stream between the client and the server. + // This stream can be re-used by the client for multiple requests, and normally gives the + // lowest possible latency, at the cost of a slightly more complex API. ConnectionStream(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[ConnectionStreamRequest, ConnectionStreamResponse], error) + // ContinueStreaming returns a server stream that returns the remaining rows of a SQL statement + // that has previously been executed using a ConnectionStreamRequest on a bi-directional + // ConnectionStream. The client is responsible for calling this RPC if the has_more_data flag + // of the ExecuteResponse was true. + ContinueStreaming(ctx context.Context, in *Rows, opts ...grpc.CallOption) (grpc.ServerStreamingClient[RowData], error) } type spannerLibClient struct { @@ -266,6 +275,25 @@ func (c *spannerLibClient) ConnectionStream(ctx context.Context, opts ...grpc.Ca // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. type SpannerLib_ConnectionStreamClient = grpc.BidiStreamingClient[ConnectionStreamRequest, ConnectionStreamResponse] +func (c *spannerLibClient) ContinueStreaming(ctx context.Context, in *Rows, opts ...grpc.CallOption) (grpc.ServerStreamingClient[RowData], error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &SpannerLib_ServiceDesc.Streams[2], SpannerLib_ContinueStreaming_FullMethodName, cOpts...) + if err != nil { + return nil, err + } + x := &grpc.GenericClientStream[Rows, RowData]{ClientStream: stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type SpannerLib_ContinueStreamingClient = grpc.ServerStreamingClient[RowData] + // SpannerLibServer is the server API for SpannerLib service. // All implementations must embed UnimplementedSpannerLibServer // for forward compatibility. @@ -287,7 +315,15 @@ type SpannerLibServer interface { Commit(context.Context, *Connection) (*spannerpb.CommitResponse, error) Rollback(context.Context, *Connection) (*emptypb.Empty, error) WriteMutations(context.Context, *WriteMutationsRequest) (*spannerpb.CommitResponse, error) + // ConnectionStream opens a bi-directional gRPC stream between the client and the server. + // This stream can be re-used by the client for multiple requests, and normally gives the + // lowest possible latency, at the cost of a slightly more complex API. ConnectionStream(grpc.BidiStreamingServer[ConnectionStreamRequest, ConnectionStreamResponse]) error + // ContinueStreaming returns a server stream that returns the remaining rows of a SQL statement + // that has previously been executed using a ConnectionStreamRequest on a bi-directional + // ConnectionStream. The client is responsible for calling this RPC if the has_more_data flag + // of the ExecuteResponse was true. + ContinueStreaming(*Rows, grpc.ServerStreamingServer[RowData]) error mustEmbedUnimplementedSpannerLibServer() } @@ -352,6 +388,9 @@ func (UnimplementedSpannerLibServer) WriteMutations(context.Context, *WriteMutat func (UnimplementedSpannerLibServer) ConnectionStream(grpc.BidiStreamingServer[ConnectionStreamRequest, ConnectionStreamResponse]) error { return status.Errorf(codes.Unimplemented, "method ConnectionStream not implemented") } +func (UnimplementedSpannerLibServer) ContinueStreaming(*Rows, grpc.ServerStreamingServer[RowData]) error { + return status.Errorf(codes.Unimplemented, "method ContinueStreaming not implemented") +} func (UnimplementedSpannerLibServer) mustEmbedUnimplementedSpannerLibServer() {} func (UnimplementedSpannerLibServer) testEmbeddedByValue() {} @@ -679,6 +718,17 @@ func _SpannerLib_ConnectionStream_Handler(srv interface{}, stream grpc.ServerStr // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. type SpannerLib_ConnectionStreamServer = grpc.BidiStreamingServer[ConnectionStreamRequest, ConnectionStreamResponse] +func _SpannerLib_ContinueStreaming_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(Rows) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(SpannerLibServer).ContinueStreaming(m, &grpc.GenericServerStream[Rows, RowData]{ServerStream: stream}) +} + +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type SpannerLib_ContinueStreamingServer = grpc.ServerStreamingServer[RowData] + // SpannerLib_ServiceDesc is the grpc.ServiceDesc for SpannerLib service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -763,6 +813,11 @@ var SpannerLib_ServiceDesc = grpc.ServiceDesc{ ServerStreams: true, ClientStreams: true, }, + { + StreamName: "ContinueStreaming", + Handler: _SpannerLib_ContinueStreaming_Handler, + ServerStreams: true, + }, }, Metadata: "google/spannerlib/v1/spannerlib.proto", } diff --git a/spannerlib/grpc-server/server.go b/spannerlib/grpc-server/server.go index f17de419..c9f6a47f 100644 --- a/spannerlib/grpc-server/server.go +++ b/spannerlib/grpc-server/server.go @@ -10,7 +10,10 @@ import ( "syscall" "cloud.google.com/go/spanner/apiv1/spannerpb" + "google.golang.org/genproto/googleapis/rpc/status" "google.golang.org/grpc" + "google.golang.org/grpc/codes" + gstatus "google.golang.org/grpc/status" "google.golang.org/protobuf/types/known/emptypb" "google.golang.org/protobuf/types/known/structpb" "spannerlib/api" @@ -131,6 +134,11 @@ func (s *spannerLibServer) ExecuteStreaming(request *pb.ExecuteRequest, stream g return s.streamRows(queryContext, rows, stream) } +func (s *spannerLibServer) ContinueStreaming(rows *pb.Rows, stream grpc.ServerStreamingServer[pb.RowData]) error { + queryContext := stream.Context() + return s.streamRows(queryContext, rows, stream) +} + func (s *spannerLibServer) streamRows(queryContext context.Context, rows *pb.Rows, stream grpc.ServerStreamingServer[pb.RowData]) error { defer func() { _ = api.CloseRows(context.Background(), rows.Connection.Pool.Id, rows.Connection.Id, rows.Id) }() metadata, err := api.Metadata(queryContext, rows.Connection.Pool.Id, rows.Connection.Id, rows.Id) @@ -140,7 +148,7 @@ func (s *spannerLibServer) streamRows(queryContext context.Context, rows *pb.Row first := true for { - if row, err := api.Next(queryContext, rows.Connection.Pool.Id, rows.Connection.Id, rows.Id); err != nil { + if row, err := api.NextBuffered(queryContext, rows.Connection.Pool.Id, rows.Connection.Id, rows.Id); err != nil { return err } else { if row == nil { @@ -180,6 +188,117 @@ func (s *spannerLibServer) streamRows(queryContext context.Context, rows *pb.Row return nil } +func (s *spannerLibServer) ConnectionStream(stream grpc.BidiStreamingServer[pb.ConnectionStreamRequest, pb.ConnectionStreamResponse]) error { + for { + var err error + var response *pb.ConnectionStreamResponse + req, err := stream.Recv() + if err != nil { + return err + } + if req.GetExecuteRequest() != nil { + ctx := stream.Context() + response, err = s.handleExecuteRequest(ctx, req.GetExecuteRequest()) + } else if req.GetExecuteBatchRequest() != nil { + ctx := stream.Context() + response, err = s.handleExecuteBatchRequest(ctx, req.GetExecuteBatchRequest()) + } else if req.GetWriteMutationsRequest() != nil { + ctx := stream.Context() + response, err = s.handleWriteMutationsRequest(ctx, req.GetWriteMutationsRequest()) + } else if req.GetBeginTransactionRequest() != nil { + ctx := stream.Context() + response, err = s.handleBeginTransactionRequest(ctx, req.GetBeginTransactionRequest()) + } else if req.GetCommitRequest() != nil { + ctx := stream.Context() + response, err = s.handleCommitRequest(ctx, req.GetCommitRequest()) + } else if req.GetRollbackRequest() != nil { + ctx := stream.Context() + response, err = s.handleRollbackRequest(ctx, req.GetRollbackRequest()) + } else { + return gstatus.Errorf(codes.Unimplemented, "unsupported request type: %v", req.Request) + } + if err != nil { + response = &pb.ConnectionStreamResponse{Status: gstatus.Convert(err).Proto()} + } + if stream.Send(response) != nil { + return err + } + } +} + +func (s *spannerLibServer) handleExecuteRequest(ctx context.Context, request *pb.ExecuteRequest) (*pb.ConnectionStreamResponse, error) { + maxFetchRows := int64(50) + if request.FetchOptions != nil && request.FetchOptions.NumRows > 0 { + maxFetchRows = request.FetchOptions.NumRows + } + + rows, err := s.Execute(ctx, request) + if err != nil { + return nil, err + } + response := &pb.ConnectionStreamResponse_ExecuteResponse{ExecuteResponse: &pb.ExecuteResponse{Rows: rows}} + defer func() { + if !response.ExecuteResponse.HasMoreResults { + _ = api.CloseRows(context.Background(), rows.Connection.Pool.Id, rows.Connection.Id, rows.Id) + } + }() + + metadata, err := api.Metadata(ctx, rows.Connection.Pool.Id, rows.Connection.Id, rows.Id) + numRows := int64(0) + for { + resultSet := &spannerpb.ResultSet{} + if err != nil { + return nil, err + } + resultSet.Metadata = metadata + response.ExecuteResponse.ResultSets = append(response.ExecuteResponse.ResultSets, resultSet) + for { + row, err := api.Next(ctx, rows.Connection.Pool.Id, rows.Connection.Id, rows.Id) + if err != nil { + if len(response.ExecuteResponse.ResultSets) == 1 { + return nil, err + } + // Remove the last result set from the response and return an error code for it instead. + response.ExecuteResponse.ResultSets = response.ExecuteResponse.ResultSets[:len(response.ExecuteResponse.ResultSets)-1] + response.ExecuteResponse.Status = gstatus.Convert(err).Proto() + return &pb.ConnectionStreamResponse{Status: &status.Status{}, Response: response}, nil + } + if row == nil { + break + } + resultSet.Rows = append(resultSet.Rows, row) + numRows++ + if numRows == maxFetchRows { + response.ExecuteResponse.HasMoreResults = true + return &pb.ConnectionStreamResponse{Status: &status.Status{}, Response: response}, nil + } + } + + stats, err := api.ResultSetStats(ctx, rows.Connection.Pool.Id, rows.Connection.Id, rows.Id) + if err != nil { + if len(response.ExecuteResponse.ResultSets) == 1 { + return nil, err + } + // Remove the last result set from the response and return an error code for it instead. + response.ExecuteResponse.ResultSets = response.ExecuteResponse.ResultSets[:len(response.ExecuteResponse.ResultSets)-1] + response.ExecuteResponse.Status = gstatus.Convert(err).Proto() + return &pb.ConnectionStreamResponse{Status: &status.Status{}, Response: response}, nil + } + resultSet.Stats = stats + + metadata, err = api.NextResultSet(ctx, rows.Connection.Pool.Id, rows.Connection.Id, rows.Id) + if err != nil { + response.ExecuteResponse.Status = gstatus.Convert(err).Proto() + return &pb.ConnectionStreamResponse{Status: &status.Status{}, Response: response}, nil + } + if metadata == nil { + break + } + } + response.ExecuteResponse.Status = &status.Status{} + return &pb.ConnectionStreamResponse{Status: &status.Status{}, Response: response}, nil +} + func (s *spannerLibServer) ExecuteBatch(ctx context.Context, request *pb.ExecuteBatchRequest) (*spannerpb.ExecuteBatchDmlResponse, error) { resp, err := api.ExecuteBatch(ctx, request.Connection.Pool.Id, request.Connection.Id, request.ExecuteBatchDmlRequest) if err != nil { @@ -188,6 +307,14 @@ func (s *spannerLibServer) ExecuteBatch(ctx context.Context, request *pb.Execute return resp, nil } +func (s *spannerLibServer) handleExecuteBatchRequest(ctx context.Context, request *pb.ExecuteBatchRequest) (*pb.ConnectionStreamResponse, error) { + res, err := s.ExecuteBatch(ctx, request) + if err != nil { + return nil, err + } + return &pb.ConnectionStreamResponse{Status: &status.Status{}, Response: &pb.ConnectionStreamResponse_ExecuteBatchResponse{ExecuteBatchResponse: res}}, nil +} + func (s *spannerLibServer) Metadata(ctx context.Context, rows *pb.Rows) (*spannerpb.ResultSetMetadata, error) { metadata, err := api.Metadata(ctx, rows.Connection.Pool.Id, rows.Connection.Id, rows.Id) if err != nil { @@ -198,7 +325,7 @@ func (s *spannerLibServer) Metadata(ctx context.Context, rows *pb.Rows) (*spanne func (s *spannerLibServer) Next(ctx context.Context, request *pb.NextRequest) (*structpb.ListValue, error) { // TODO: Pass in numRows and encoding option. - values, err := api.Next(ctx, request.Rows.Connection.Pool.Id, request.Rows.Connection.Id, request.Rows.Id) + values, err := api.NextBuffered(ctx, request.Rows.Connection.Pool.Id, request.Rows.Connection.Id, request.Rows.Id) if err != nil { return nil, err } @@ -241,6 +368,14 @@ func (s *spannerLibServer) BeginTransaction(ctx context.Context, request *pb.Beg return &emptypb.Empty{}, nil } +func (s *spannerLibServer) handleBeginTransactionRequest(ctx context.Context, request *pb.BeginTransactionRequest) (*pb.ConnectionStreamResponse, error) { + res, err := s.BeginTransaction(ctx, request) + if err != nil { + return nil, err + } + return &pb.ConnectionStreamResponse{Status: &status.Status{}, Response: &pb.ConnectionStreamResponse_BeginTransactionResponse{BeginTransactionResponse: res}}, nil +} + func (s *spannerLibServer) Commit(ctx context.Context, connection *pb.Connection) (*spannerpb.CommitResponse, error) { resp, err := api.Commit(ctx, connection.Pool.Id, connection.Id) if err != nil { @@ -249,6 +384,14 @@ func (s *spannerLibServer) Commit(ctx context.Context, connection *pb.Connection return resp, nil } +func (s *spannerLibServer) handleCommitRequest(ctx context.Context, connection *pb.Connection) (*pb.ConnectionStreamResponse, error) { + res, err := s.Commit(ctx, connection) + if err != nil { + return nil, err + } + return &pb.ConnectionStreamResponse{Status: &status.Status{}, Response: &pb.ConnectionStreamResponse_CommitResponse{CommitResponse: res}}, nil +} + func (s *spannerLibServer) Rollback(ctx context.Context, connection *pb.Connection) (*emptypb.Empty, error) { err := api.Rollback(ctx, connection.Pool.Id, connection.Id) if err != nil { @@ -257,6 +400,14 @@ func (s *spannerLibServer) Rollback(ctx context.Context, connection *pb.Connecti return &emptypb.Empty{}, nil } +func (s *spannerLibServer) handleRollbackRequest(ctx context.Context, connection *pb.Connection) (*pb.ConnectionStreamResponse, error) { + res, err := s.Rollback(ctx, connection) + if err != nil { + return nil, err + } + return &pb.ConnectionStreamResponse{Status: &status.Status{}, Response: &pb.ConnectionStreamResponse_RollbackResponse{RollbackResponse: res}}, nil +} + func (s *spannerLibServer) WriteMutations(ctx context.Context, request *pb.WriteMutationsRequest) (*spannerpb.CommitResponse, error) { resp, err := api.WriteMutations(ctx, request.Connection.Pool.Id, request.Connection.Id, request.Mutations) if err != nil { @@ -264,3 +415,11 @@ func (s *spannerLibServer) WriteMutations(ctx context.Context, request *pb.Write } return resp, nil } + +func (s *spannerLibServer) handleWriteMutationsRequest(ctx context.Context, request *pb.WriteMutationsRequest) (*pb.ConnectionStreamResponse, error) { + res, err := s.WriteMutations(ctx, request) + if err != nil { + return nil, err + } + return &pb.ConnectionStreamResponse{Status: &status.Status{}, Response: &pb.ConnectionStreamResponse_WriteMutationsResponse{WriteMutationsResponse: res}}, nil +} diff --git a/spannerlib/grpc-server/server_test.go b/spannerlib/grpc-server/server_test.go index 41afde63..9224d394 100644 --- a/spannerlib/grpc-server/server_test.go +++ b/spannerlib/grpc-server/server_test.go @@ -123,7 +123,7 @@ func TestExecute(t *testing.T) { numRows := 0 for { - row, err := client.Next(ctx, &pb.NextRequest{Rows: rows, NumRows: 1}) + row, err := client.Next(ctx, &pb.NextRequest{Rows: rows, FetchOptions: &pb.FetchOptions{NumRows: 1}}) if err != nil { t.Fatalf("failed to fetch next row: %v", err) } @@ -367,6 +367,11 @@ func TestExecuteStreamingMultiStatement(t *testing.T) { Name: "test-operation", }, }) + invalidQuery := "select * from unknown_table" + _ = server.TestSpanner.PutStatementResult(invalidQuery, &testutil.StatementResult{ + Type: testutil.StatementResultError, + Err: status.Error(codes.NotFound, "Table not found"), + }) client, cleanup := startTestSpannerLibServer(t) defer cleanup() @@ -383,6 +388,7 @@ func TestExecuteStreamingMultiStatement(t *testing.T) { type expectedResults struct { numRows int affected int64 + err codes.Code } type test struct { name string @@ -480,6 +486,15 @@ func TestExecuteStreamingMultiStatement(t *testing.T) { {affected: testutil.UpdateBarSetFooRowCount}, }, }, + { + name: "query then error", + sql: fmt.Sprintf("%s;%s", testutil.SelectFooFromBar, invalidQuery), + numExecuteRequests: 2, + expectedResults: []expectedResults{ + {numRows: 2}, + {err: codes.NotFound}, + }, + }, } { t.Run(tt.name, func(t *testing.T) { stream, err := client.ExecuteStreaming(ctx, &pb.ExecuteRequest{ @@ -493,8 +508,15 @@ func TestExecuteStreamingMultiStatement(t *testing.T) { numRows := 0 for { row, err := stream.Recv() - if err != nil { - t.Fatalf("failed to receive row: %v", err) + if tt.expectedResults[numResultSets-1].err != codes.OK { + if g, w := status.Code(err), tt.expectedResults[numResultSets-1].err; g != w { + t.Fatalf("err code mismatch\n Got: %v\n Want: %v", g, w) + } + break + } else { + if err != nil { + t.Fatalf("failed to receive row: %v", err) + } } if len(row.Data) == 0 { if g, w := numRows, tt.expectedResults[numResultSets-1].numRows; g != w { @@ -843,6 +865,60 @@ func TestExecuteBatch(t *testing.T) { } } +func TestExecuteBatchBidi(t *testing.T) { + t.Parallel() + ctx := context.Background() + + server, teardown := setupMockSpannerServer(t) + defer teardown() + dsn := fmt.Sprintf("%s/projects/p/instances/i/databases/d?useplaintext=true", server.Address) + + client, cleanup := startTestSpannerLibServer(t) + defer cleanup() + + pool, err := client.CreatePool(ctx, &pb.CreatePoolRequest{ConnectionString: dsn}) + if err != nil { + t.Fatalf("failed to create pool: %v", err) + } + connection, err := client.CreateConnection(ctx, &pb.CreateConnectionRequest{Pool: pool}) + if err != nil { + t.Fatalf("failed to create connection: %v", err) + } + stream, err := client.ConnectionStream(ctx) + if err != nil { + t.Fatalf("failed to start stream: %v", err) + } + if err := stream.Send(&pb.ConnectionStreamRequest{ + Request: &pb.ConnectionStreamRequest_ExecuteBatchRequest{ + ExecuteBatchRequest: &pb.ExecuteBatchRequest{ + Connection: connection, + ExecuteBatchDmlRequest: &sppb.ExecuteBatchDmlRequest{ + Statements: []*sppb.ExecuteBatchDmlRequest_Statement{ + {Sql: testutil.UpdateBarSetFoo}, + {Sql: testutil.UpdateBarSetFoo}, + }, + }, + }, + }, + }); err != nil { + t.Fatalf("failed to send ExecuteBatch request: %v", err) + } + resp, err := stream.Recv() + if err != nil { + t.Fatalf("failed to execute batch: %v", err) + } + if g, w := len(resp.GetExecuteBatchResponse().ResultSets), 2; g != w { + t.Fatalf("num results mismatch\n Got: %v\nWant: %v", g, w) + } + + if err := stream.CloseSend(); err != nil { + t.Fatalf("failed to close send: %v", err) + } + if _, err := client.ClosePool(ctx, pool); err != nil { + t.Fatalf("failed to close pool: %v", err) + } +} + func TestTransaction(t *testing.T) { t.Parallel() ctx := context.Background() @@ -868,53 +944,162 @@ func TestTransaction(t *testing.T) { }); err != nil { t.Fatalf("failed to set transaction_tag: %v", err) } - if _, err := client.BeginTransaction(ctx, &pb.BeginTransactionRequest{ - Connection: connection, - TransactionOptions: &sppb.TransactionOptions{}, - }); err != nil { - t.Fatalf("failed to begin transaction: %v", err) + + for i := 0; i < 2; i++ { + if _, err := client.BeginTransaction(ctx, &pb.BeginTransactionRequest{ + Connection: connection, + TransactionOptions: &sppb.TransactionOptions{}, + }); err != nil { + t.Fatalf("failed to begin transaction: %v", err) + } + rows, err := client.Execute(ctx, &pb.ExecuteRequest{ + Connection: connection, + ExecuteSqlRequest: &sppb.ExecuteSqlRequest{Sql: testutil.UpdateBarSetFoo}, + }) + if err != nil { + t.Fatalf("failed to execute: %v", err) + } + row, err := client.Next(ctx, &pb.NextRequest{Rows: rows, FetchOptions: &pb.FetchOptions{NumRows: 1}}) + if err != nil { + t.Fatalf("failed to fetch next row: %v", err) + } + if row.Values != nil { + t.Fatalf("row values should be nil: %v", row.Values) + } + stats, err := client.ResultSetStats(ctx, rows) + if err != nil { + t.Fatalf("failed to get stats: %v", err) + } + if g, w := stats.GetRowCountExact(), int64(testutil.UpdateBarSetFooRowCount); g != w { + t.Fatalf("row count mismatch\n Got: %v\nWant: %v", g, w) + } + if _, err := client.CloseRows(ctx, rows); err != nil { + t.Fatalf("failed to close rows: %v", err) + } + if _, err := client.Commit(ctx, connection); err != nil { + t.Fatalf("failed to commit: %v", err) + } + + requests := server.TestSpanner.DrainRequestsFromServer() + executeRequests := testutil.RequestsOfType(requests, reflect.TypeOf(&sppb.ExecuteSqlRequest{})) + if g, w := len(executeRequests), 1; g != w { + t.Fatalf("num execute requests mismatch\n Got: %v\nWant: %v", g, w) + } + request := executeRequests[0].(*sppb.ExecuteSqlRequest) + expectedTag := "test_tag" + if i == 1 { + expectedTag = "" + } + if g, w := request.RequestOptions.TransactionTag, expectedTag; g != w { + t.Fatalf("transaction tag mismatch\n Got: %v\nWant: %v", g, w) + } } - rows, err := client.Execute(ctx, &pb.ExecuteRequest{ - Connection: connection, - ExecuteSqlRequest: &sppb.ExecuteSqlRequest{Sql: testutil.UpdateBarSetFoo}, - }) - if err != nil { - t.Fatalf("failed to execute: %v", err) + + if _, err := client.ClosePool(ctx, pool); err != nil { + t.Fatalf("failed to close pool: %v", err) } - row, err := client.Next(ctx, &pb.NextRequest{Rows: rows, NumRows: 1}) +} + +func TestTransactionBidi(t *testing.T) { + t.Parallel() + ctx := context.Background() + + server, teardown := setupMockSpannerServer(t) + defer teardown() + dsn := fmt.Sprintf("%s/projects/p/instances/i/databases/d?useplaintext=true", server.Address) + + client, cleanup := startTestSpannerLibServer(t) + defer cleanup() + + pool, err := client.CreatePool(ctx, &pb.CreatePoolRequest{ConnectionString: dsn}) if err != nil { - t.Fatalf("failed to fetch next row: %v", err) + t.Fatalf("failed to create pool: %v", err) } - if row.Values != nil { - t.Fatalf("row values should be nil: %v", row.Values) + connection, err := client.CreateConnection(ctx, &pb.CreateConnectionRequest{Pool: pool}) + if err != nil { + t.Fatalf("failed to create connection: %v", err) } - stats, err := client.ResultSetStats(ctx, rows) + stream, err := client.ConnectionStream(ctx) if err != nil { - t.Fatalf("failed to get stats: %v", err) + t.Fatalf("failed to open connection stream: %v", err) } - if g, w := stats.GetRowCountExact(), int64(testutil.UpdateBarSetFooRowCount); g != w { - t.Fatalf("row count mismatch\n Got: %v\nWant: %v", g, w) + if err := stream.Send(&pb.ConnectionStreamRequest{Request: &pb.ConnectionStreamRequest_ExecuteRequest{ + ExecuteRequest: &pb.ExecuteRequest{ + Connection: connection, + ExecuteSqlRequest: &sppb.ExecuteSqlRequest{Sql: "set transaction_tag='test_tag'"}, + }, + }}); err != nil { + t.Fatalf("failed to set transaction_tag: %v", err) } - if _, err := client.CloseRows(ctx, rows); err != nil { - t.Fatalf("failed to close rows: %v", err) + if _, err := stream.Recv(); err != nil { + t.Fatalf("failed to receive response: %v", err) } - if _, err := client.Commit(ctx, connection); err != nil { - t.Fatalf("failed to commit: %v", err) + + for i := 0; i < 2; i++ { + if err := stream.Send(&pb.ConnectionStreamRequest{ + Request: &pb.ConnectionStreamRequest_BeginTransactionRequest{ + BeginTransactionRequest: &pb.BeginTransactionRequest{ + Connection: connection, + TransactionOptions: &sppb.TransactionOptions{}, + }, + }, + }); err != nil { + t.Fatalf("failed to begin transaction: %v", err) + } + if _, err := stream.Recv(); err != nil { + t.Fatalf("failed to receive response: %v", err) + } + if err := stream.Send(&pb.ConnectionStreamRequest{ + Request: &pb.ConnectionStreamRequest_ExecuteRequest{ + ExecuteRequest: &pb.ExecuteRequest{ + Connection: connection, + ExecuteSqlRequest: &sppb.ExecuteSqlRequest{Sql: testutil.UpdateBarSetFoo}, + }, + }, + }); err != nil { + t.Fatalf("failed to execute: %v", err) + } + response, err := stream.Recv() + if err != nil { + t.Fatalf("failed to execute: %v", err) + } + resultSet := response.GetExecuteResponse().ResultSets[0] + if resultSet.Rows != nil { + t.Fatalf("row values should be nil: %v", resultSet.Rows) + } + stats := response.GetExecuteResponse().ResultSets[0].Stats + if g, w := stats.GetRowCountExact(), int64(testutil.UpdateBarSetFooRowCount); g != w { + t.Fatalf("row count mismatch\n Got: %v\nWant: %v", g, w) + } + if err := stream.Send(&pb.ConnectionStreamRequest{ + Request: &pb.ConnectionStreamRequest_CommitRequest{ + CommitRequest: connection, + }, + }); err != nil { + t.Fatalf("failed to commit: %v", err) + } + if _, err := stream.Recv(); err != nil { + t.Fatalf("failed to receive response: %v", err) + } + + requests := server.TestSpanner.DrainRequestsFromServer() + executeRequests := testutil.RequestsOfType(requests, reflect.TypeOf(&sppb.ExecuteSqlRequest{})) + if g, w := len(executeRequests), 1; g != w { + t.Fatalf("num execute requests mismatch\n Got: %v\nWant: %v", g, w) + } + request := executeRequests[0].(*sppb.ExecuteSqlRequest) + expectedTag := "test_tag" + if i == 1 { + expectedTag = "" + } + if g, w := request.RequestOptions.TransactionTag, expectedTag; g != w { + t.Fatalf("transaction tag mismatch\n Got: %v\nWant: %v", g, w) + } } if _, err := client.ClosePool(ctx, pool); err != nil { t.Fatalf("failed to close pool: %v", err) } - - requests := server.TestSpanner.DrainRequestsFromServer() - executeRequests := testutil.RequestsOfType(requests, reflect.TypeOf(&sppb.ExecuteSqlRequest{})) - if g, w := len(executeRequests), 1; g != w { - t.Fatalf("num execute requests mismatch\n Got: %v\nWant: %v", g, w) - } - request := executeRequests[0].(*sppb.ExecuteSqlRequest) - if g, w := request.RequestOptions.TransactionTag, "test_tag"; g != w { - t.Fatalf("transaction tag mismatch\n Got: %v\nWant: %v", g, w) - } } func TestRollback(t *testing.T) { @@ -1018,6 +1203,375 @@ func TestWriteMutations(t *testing.T) { } } +func TestBidiStream(t *testing.T) { + t.Parallel() + ctx := context.Background() + + server, teardown := setupMockSpannerServer(t) + defer teardown() + dsn := fmt.Sprintf("%s/projects/p/instances/i/databases/d?useplaintext=true", server.Address) + + client, cleanup := startTestSpannerLibServer(t) + defer cleanup() + + pool, err := client.CreatePool(ctx, &pb.CreatePoolRequest{ConnectionString: dsn}) + if err != nil { + t.Fatalf("failed to create pool: %v", err) + } + connection, err := client.CreateConnection(ctx, &pb.CreateConnectionRequest{Pool: pool}) + if err != nil { + t.Fatalf("failed to create connection: %v", err) + } + + connStream, err := client.ConnectionStream(ctx) + if err != nil { + t.Fatalf("failed to open connection stream: %v", err) + } + for range 10 { + if err := connStream.Send(&pb.ConnectionStreamRequest{Request: &pb.ConnectionStreamRequest_ExecuteRequest{ExecuteRequest: &pb.ExecuteRequest{ + Connection: connection, + ExecuteSqlRequest: &sppb.ExecuteSqlRequest{Sql: testutil.SelectFooFromBar}, + }}}); err != nil { + t.Fatalf("failed to send execute request: %v", err) + } + numRows := 0 + response, err := connStream.Recv() + if err != nil { + t.Fatalf("failed to receive response: %v", err) + } + for _, resultSet := range response.GetExecuteResponse().ResultSets { + for i, row := range resultSet.Rows { + if g, w := len(row.Values), 1; g != w { + t.Fatalf("num values mismatch\n Got: %v\nWant: %v", g, w) + } + if g, w := row.Values[0].GetStringValue(), fmt.Sprintf("%d", i+1); g != w { + t.Fatalf("value mismatch\n Got: %v\nWant: %v", g, w) + } + numRows++ + } + } + if g, w := numRows, 2; g != w { + t.Fatalf("num rows mismatch\n Got: %v\nWant: %v", g, w) + } + } + if err := connStream.CloseSend(); err != nil { + t.Fatalf("failed to close connection stream: %v", err) + } + + if _, err := client.ClosePool(ctx, pool); err != nil { + t.Fatalf("failed to close pool: %v", err) + } +} + +func TestBidiStreamMultiStatement(t *testing.T) { + t.Parallel() + ctx := context.Background() + + server, teardown := setupMockSpannerServer(t) + defer teardown() + dsn := fmt.Sprintf("%s/projects/p/instances/i/databases/d?useplaintext=true", server.Address) + + client, cleanup := startTestSpannerLibServer(t) + defer cleanup() + + pool, err := client.CreatePool(ctx, &pb.CreatePoolRequest{ConnectionString: dsn}) + if err != nil { + t.Fatalf("failed to create pool: %v", err) + } + connection, err := client.CreateConnection(ctx, &pb.CreateConnectionRequest{Pool: pool}) + if err != nil { + t.Fatalf("failed to create connection: %v", err) + } + + connStream, err := client.ConnectionStream(ctx) + if err != nil { + t.Fatalf("failed to open connection stream: %v", err) + } + if err := connStream.Send(&pb.ConnectionStreamRequest{Request: &pb.ConnectionStreamRequest_ExecuteRequest{ExecuteRequest: &pb.ExecuteRequest{ + Connection: connection, + ExecuteSqlRequest: &sppb.ExecuteSqlRequest{Sql: fmt.Sprintf("%s;%s", testutil.SelectFooFromBar, testutil.UpdateBarSetFoo)}, + }}}); err != nil { + t.Fatalf("failed to send execute request: %v", err) + } + numRows := 0 + response, err := connStream.Recv() + if err != nil { + t.Fatalf("failed to receive response: %v", err) + } + if g, w := len(response.GetExecuteResponse().ResultSets), 2; g != w { + t.Fatalf("num result sets mismatch\n Got: %v\nWant: %v", g, w) + } + + // Get the query result. + resultSet := response.GetExecuteResponse().ResultSets[0] + for i, row := range resultSet.Rows { + if g, w := len(row.Values), 1; g != w { + t.Fatalf("num values mismatch\n Got: %v\nWant: %v", g, w) + } + if g, w := row.Values[0].GetStringValue(), fmt.Sprintf("%d", i+1); g != w { + t.Fatalf("value mismatch\n Got: %v\nWant: %v", g, w) + } + numRows++ + } + if g, w := numRows, 2; g != w { + t.Fatalf("num rows mismatch\n Got: %v\nWant: %v", g, w) + } + // Get the DML result. + dmlResult := response.GetExecuteResponse().ResultSets[1] + if g, w := len(dmlResult.Rows), 0; g != w { + t.Fatalf("num rows mismatch\n Got: %v\nWant: %v", g, w) + } + if g, w := dmlResult.Stats.GetRowCountExact(), int64(testutil.UpdateBarSetFooRowCount); g != w { + t.Fatalf("update count mismatch\n Got: %v\nWant: %v", g, w) + } + if response.GetExecuteResponse().HasMoreResults { + t.Fatal("expected no more results") + } + + if err := connStream.CloseSend(); err != nil { + t.Fatalf("failed to close connection stream: %v", err) + } + + if _, err := client.ClosePool(ctx, pool); err != nil { + t.Fatalf("failed to close pool: %v", err) + } +} + +func TestBidiStreamMultiStatementFirstFails(t *testing.T) { + t.Parallel() + ctx := context.Background() + + server, teardown := setupMockSpannerServer(t) + defer teardown() + dsn := fmt.Sprintf("%s/projects/p/instances/i/databases/d?useplaintext=true", server.Address) + + client, cleanup := startTestSpannerLibServer(t) + defer cleanup() + + pool, err := client.CreatePool(ctx, &pb.CreatePoolRequest{ConnectionString: dsn}) + if err != nil { + t.Fatalf("failed to create pool: %v", err) + } + connection, err := client.CreateConnection(ctx, &pb.CreateConnectionRequest{Pool: pool}) + if err != nil { + t.Fatalf("failed to create connection: %v", err) + } + + connStream, err := client.ConnectionStream(ctx) + if err != nil { + t.Fatalf("failed to open connection stream: %v", err) + } + if err := connStream.Send(&pb.ConnectionStreamRequest{Request: &pb.ConnectionStreamRequest_ExecuteRequest{ExecuteRequest: &pb.ExecuteRequest{ + Connection: connection, + ExecuteSqlRequest: &sppb.ExecuteSqlRequest{Sql: fmt.Sprintf("%s;%s", testutil.SelectFooFromBar, testutil.UpdateBarSetFoo)}, + }}}); err != nil { + t.Fatalf("failed to send execute request: %v", err) + } + numRows := 0 + response, err := connStream.Recv() + if err != nil { + t.Fatalf("failed to receive response: %v", err) + } + if g, w := len(response.GetExecuteResponse().ResultSets), 2; g != w { + t.Fatalf("num result sets mismatch\n Got: %v\nWant: %v", g, w) + } + + // Get the query result. + resultSet := response.GetExecuteResponse().ResultSets[0] + for i, row := range resultSet.Rows { + if g, w := len(row.Values), 1; g != w { + t.Fatalf("num values mismatch\n Got: %v\nWant: %v", g, w) + } + if g, w := row.Values[0].GetStringValue(), fmt.Sprintf("%d", i+1); g != w { + t.Fatalf("value mismatch\n Got: %v\nWant: %v", g, w) + } + numRows++ + } + if g, w := numRows, 2; g != w { + t.Fatalf("num rows mismatch\n Got: %v\nWant: %v", g, w) + } + // Get the DML result. + dmlResult := response.GetExecuteResponse().ResultSets[1] + if g, w := len(dmlResult.Rows), 0; g != w { + t.Fatalf("num rows mismatch\n Got: %v\nWant: %v", g, w) + } + if g, w := dmlResult.Stats.GetRowCountExact(), int64(testutil.UpdateBarSetFooRowCount); g != w { + t.Fatalf("update count mismatch\n Got: %v\nWant: %v", g, w) + } + if response.GetExecuteResponse().HasMoreResults { + t.Fatal("expected no more results") + } + + if err := connStream.CloseSend(); err != nil { + t.Fatalf("failed to close connection stream: %v", err) + } + + if _, err := client.ClosePool(ctx, pool); err != nil { + t.Fatalf("failed to close pool: %v", err) + } +} + +func TestBidiStreamEmptyResults(t *testing.T) { + t.Parallel() + ctx := context.Background() + + server, teardown := setupMockSpannerServer(t) + defer teardown() + dsn := fmt.Sprintf("%s/projects/p/instances/i/databases/d?useplaintext=true", server.Address) + + query := "select * from my_table where 1=0" + _ = server.TestSpanner.PutStatementResult(query, &testutil.StatementResult{ + Type: testutil.StatementResultResultSet, + ResultSet: &sppb.ResultSet{ + Metadata: &sppb.ResultSetMetadata{ + RowType: &sppb.StructType{ + Fields: []*sppb.StructType_Field{{Name: "c", Type: &sppb.Type{Code: sppb.TypeCode_INT64}}}, + }, + }, + Rows: []*structpb.ListValue{}, + }, + }) + + client, cleanup := startTestSpannerLibServer(t) + defer cleanup() + + pool, err := client.CreatePool(ctx, &pb.CreatePoolRequest{ConnectionString: dsn}) + if err != nil { + t.Fatalf("failed to create pool: %v", err) + } + connection, err := client.CreateConnection(ctx, &pb.CreateConnectionRequest{Pool: pool}) + if err != nil { + t.Fatalf("failed to create connection: %v", err) + } + + connStream, err := client.ConnectionStream(ctx) + if err != nil { + t.Fatalf("failed to open connection stream: %v", err) + } + if err := connStream.Send(&pb.ConnectionStreamRequest{Request: &pb.ConnectionStreamRequest_ExecuteRequest{ExecuteRequest: &pb.ExecuteRequest{ + Connection: connection, + ExecuteSqlRequest: &sppb.ExecuteSqlRequest{Sql: query}, + }}}); err != nil { + t.Fatalf("failed to send execute request: %v", err) + } + numRows := 0 + row, err := connStream.Recv() + if err != nil { + t.Fatalf("failed to receive response: %v", err) + } + for _, resultSet := range row.GetExecuteResponse().ResultSets { + numRows += len(resultSet.Rows) + } + if g, w := numRows, 0; g != w { + t.Fatalf("num rows mismatch\n Got: %v\nWant: %v", g, w) + } + if err := connStream.CloseSend(); err != nil { + t.Fatalf("failed to close connection stream: %v", err) + } + + if _, err := client.ClosePool(ctx, pool); err != nil { + t.Fatalf("failed to close pool: %v", err) + } +} + +func TestBidiStreamLargeResult(t *testing.T) { + t.Parallel() + ctx := context.Background() + + server, teardown := setupMockSpannerServer(t) + defer teardown() + dsn := fmt.Sprintf("%s/projects/p/instances/i/databases/d?useplaintext=true", server.Address) + + numRows := 125 + query := "select id from my_table" + _ = server.TestSpanner.PutStatementResult(query, &testutil.StatementResult{ + Type: testutil.StatementResultResultSet, + ResultSet: testutil.CreateSingleColumnInt64ResultSet(createInt64Slice(numRows), "id"), + }) + + client, cleanup := startTestSpannerLibServer(t) + defer cleanup() + + pool, err := client.CreatePool(ctx, &pb.CreatePoolRequest{ConnectionString: dsn}) + if err != nil { + t.Fatalf("failed to create pool: %v", err) + } + connection, err := client.CreateConnection(ctx, &pb.CreateConnectionRequest{Pool: pool}) + if err != nil { + t.Fatalf("failed to create connection: %v", err) + } + + connStream, err := client.ConnectionStream(ctx) + if err != nil { + t.Fatalf("failed to open connection stream: %v", err) + } + if err := connStream.Send(&pb.ConnectionStreamRequest{Request: &pb.ConnectionStreamRequest_ExecuteRequest{ExecuteRequest: &pb.ExecuteRequest{ + Connection: connection, + ExecuteSqlRequest: &sppb.ExecuteSqlRequest{Sql: query}, + }}}); err != nil { + t.Fatalf("failed to send execute request: %v", err) + } + foundRows := 0 + response, err := connStream.Recv() + if err != nil { + t.Fatalf("failed to receive response: %v", err) + } + for _, resultSet := range response.GetExecuteResponse().ResultSets { + for i, row := range resultSet.Rows { + if g, w := len(row.Values), 1; g != w { + t.Fatalf("num values mismatch\n Got: %v\nWant: %v", g, w) + } + if g, w := row.Values[0].GetStringValue(), fmt.Sprintf("%d", i+1); g != w { + t.Fatalf("value mismatch\n Got: %v\nWant: %v", g, w) + } + foundRows++ + } + } + if response.GetExecuteResponse().HasMoreResults { + stream, err := client.ContinueStreaming(ctx, response.GetExecuteResponse().Rows) + if err != nil { + t.Fatalf("failed to open stream: %v", err) + } + for { + row, err := stream.Recv() + if err != nil { + t.Fatalf("failed to receive row: %v", err) + } + if len(row.Data) == 0 { + break + } + if g, w := len(row.Data), 1; g != w { + t.Fatalf("num rows mismatch\n Got: %v\nWant: %v", g, w) + } + if g, w := len(row.Data[0].Values), 1; g != w { + t.Fatalf("num values mismatch\n Got: %v\nWant: %v", g, w) + } + if g, w := row.Data[0].Values[0].GetStringValue(), fmt.Sprintf("%d", foundRows+1); g != w { + t.Fatalf("value mismatch\n Got: %v\nWant: %v", g, w) + } + foundRows++ + } + } + if g, w := foundRows, numRows; g != w { + t.Fatalf("num rows mismatch\n Got: %v\nWant: %v", g, w) + } + if err := connStream.CloseSend(); err != nil { + t.Fatalf("failed to close connection stream: %v", err) + } + + if _, err := client.ClosePool(ctx, pool); err != nil { + t.Fatalf("failed to close pool: %v", err) + } +} + +func createInt64Slice(n int) []int64 { + res := make([]int64, n) + for i := 0; i < n; i++ { + res[i] = int64(i + 1) + } + return res +} + func startTestSpannerLibServer(t *testing.T) (client pb.SpannerLibClient, cleanup func()) { var tp string var name string diff --git a/spannerlib/wrappers/spannerlib-dotnet/spannerlib-dotnet-grpc-impl/GrpcBidiConnection.cs b/spannerlib/wrappers/spannerlib-dotnet/spannerlib-dotnet-grpc-impl/GrpcBidiConnection.cs new file mode 100644 index 00000000..6786bf41 --- /dev/null +++ b/spannerlib/wrappers/spannerlib-dotnet/spannerlib-dotnet-grpc-impl/GrpcBidiConnection.cs @@ -0,0 +1,233 @@ +// Copyright 2025 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Google.Cloud.Spanner.V1; +using Google.Cloud.SpannerLib.V1; +using Google.Rpc; +using Grpc.Core; +using BeginTransactionRequest = Google.Cloud.SpannerLib.V1.BeginTransactionRequest; +using Status = Google.Rpc.Status; + +namespace Google.Cloud.SpannerLib.Grpc; + +/// +/// GrpcConnection is a gRPC-specific implementation of a SpannerLib Connection. This class opens a bidirectional +/// gRPC stream to the gRPC server in SpannerLib. This stream can be used to execute multiple statements on Spanner +/// with the lowest possible latency. +/// +internal class GrpcBidiConnection(GrpcLibSpanner spanner, Pool pool, long id) : Connection(pool, id) +{ + private AsyncDuplexStreamingCall? _stream; + + /// + /// Returns a bidirectional gRPC stream for this connection. The stream is created the first time this property + /// is used. + /// + private AsyncDuplexStreamingCall Stream + { + get + { + _stream ??= spanner.Client.ConnectionStream(); + return _stream; + } + } + + protected override void CloseLibObject() + { + base.CloseLibObject(); + _stream?.Dispose(); + } + + /// + /// Executes the given request using a bidirectional gRPC stream and waits for a response on the same stream. + /// + private ConnectionStreamResponse ExecuteBidi(ConnectionStreamRequest request) + { + var connectionStream = Stream; + connectionStream.RequestStream.WriteAsync(request).GetAwaiter().GetResult(); + if (!connectionStream.ResponseStream.MoveNext(CancellationToken.None).GetAwaiter().GetResult()) + { + // This should never happen assuming that the gRPC server is well-behaved. + throw new SpannerException(new Status { Code = (int)Code.Internal, Message = "No response received" }); + } + if (connectionStream.ResponseStream.Current.Status.Code != (int)Code.Ok) + { + throw new SpannerException(connectionStream.ResponseStream.Current.Status); + } + return connectionStream.ResponseStream.Current; + } + + /// + /// Executes the given request using a bidirectional gRPC stream and waits for a response on the same stream. + /// + private async Task ExecuteBidiAsync( + ConnectionStreamRequest request, CancellationToken cancellationToken) + { + var connectionStream = Stream; + await connectionStream.RequestStream.WriteAsync(request, cancellationToken).ConfigureAwait(false); + if (!await connectionStream.ResponseStream.MoveNext(cancellationToken).ConfigureAwait(false)) + { + // This should never happen assuming that the gRPC server is well-behaved. + throw new SpannerException(new Status { Code = (int)Code.Internal, Message = "No response received" }); + } + if (connectionStream.ResponseStream.Current.Status.Code != (int)Code.Ok) + { + throw new SpannerException(connectionStream.ResponseStream.Current.Status); + } + return connectionStream.ResponseStream.Current; + } + + public override void BeginTransaction(TransactionOptions transactionOptions) + { + ExecuteBidi(CreateBeginTransactionRequest(transactionOptions)); + } + + public override Task BeginTransactionAsync(TransactionOptions transactionOptions, CancellationToken cancellationToken = default) + { + return ExecuteBidiAsync(CreateBeginTransactionRequest(transactionOptions), cancellationToken); + } + + private ConnectionStreamRequest CreateBeginTransactionRequest(TransactionOptions transactionOptions) + { + return new ConnectionStreamRequest + { + BeginTransactionRequest = new BeginTransactionRequest + { + Connection = GrpcLibSpanner.ToProto(this), + TransactionOptions = transactionOptions, + } + }; + } + + public override CommitResponse? Commit() + { + var response = ExecuteBidi(CreateCommitRequest()); + return response.CommitResponse.CommitTimestamp != null ? response.CommitResponse : null; + } + + public override async Task CommitAsync(CancellationToken cancellationToken = default) + { + var response = await ExecuteBidiAsync(CreateCommitRequest(), cancellationToken).ConfigureAwait(false); + return response.CommitResponse.CommitTimestamp != null ? response.CommitResponse : null; + } + + private ConnectionStreamRequest CreateCommitRequest() + { + return new ConnectionStreamRequest + { + CommitRequest = GrpcLibSpanner.ToProto(this), + }; + } + + public override void Rollback() + { + ExecuteBidi(CreateRollbackRequest()); + } + + public override Task RollbackAsync(CancellationToken cancellationToken = default) + { + return ExecuteBidiAsync(CreateRollbackRequest(), cancellationToken); + } + + private ConnectionStreamRequest CreateRollbackRequest() + { + return new ConnectionStreamRequest + { + RollbackRequest = GrpcLibSpanner.ToProto(this), + }; + } + + public override Rows Execute(ExecuteSqlRequest statement, int prefetchRows = 0) + { + var response = ExecuteBidi(CreateExecuteRequest(statement, prefetchRows)); + return StreamingRows.Create(spanner, this, response.ExecuteResponse); + } + + public override async Task ExecuteAsync(ExecuteSqlRequest statement, int prefetchRows = 0, CancellationToken cancellationToken = default) + { + var response = await ExecuteBidiAsync(CreateExecuteRequest(statement, prefetchRows), cancellationToken).ConfigureAwait(false); + return await StreamingRows.CreateAsync(spanner, this, response.ExecuteResponse, cancellationToken).ConfigureAwait(false); + } + + private ConnectionStreamRequest CreateExecuteRequest(ExecuteSqlRequest statement, int prefetchRows = 0) + { + return new ConnectionStreamRequest + { + ExecuteRequest = new ExecuteRequest + { + Connection = GrpcLibSpanner.ToProto(this), + ExecuteSqlRequest = statement, + FetchOptions = new FetchOptions + { + NumRows = prefetchRows, + }, + }, + }; + } + + public override long[] ExecuteBatch(List statements) + { + var response = ExecuteBidi(CreateExecuteBatchRequest(statements)); + return ISpannerLib.ToUpdateCounts(response.ExecuteBatchResponse); + } + + public override async Task ExecuteBatchAsync(List statements, CancellationToken cancellationToken = default) + { + var response = await ExecuteBidiAsync(CreateExecuteBatchRequest(statements), cancellationToken).ConfigureAwait(false); + return ISpannerLib.ToUpdateCounts(response.ExecuteBatchResponse); + } + + private ConnectionStreamRequest CreateExecuteBatchRequest( + IEnumerable statements) + { + return new ConnectionStreamRequest + { + ExecuteBatchRequest = new ExecuteBatchRequest + { + Connection = GrpcLibSpanner.ToProto(this), + ExecuteBatchDmlRequest = new ExecuteBatchDmlRequest + { + Statements = { statements }, + }, + }, + }; + } + + public override CommitResponse? WriteMutations(BatchWriteRequest.Types.MutationGroup mutations) + { + var response = ExecuteBidi(CreateWriteMutationsRequest(mutations)); + return response.WriteMutationsResponse?.CommitTimestamp != null ? response.WriteMutationsResponse : null; + } + + public override async Task WriteMutationsAsync(BatchWriteRequest.Types.MutationGroup mutations, CancellationToken cancellationToken = default) + { + var response = await ExecuteBidiAsync(CreateWriteMutationsRequest(mutations), cancellationToken).ConfigureAwait(false); + return response.WriteMutationsResponse?.CommitTimestamp != null ? response.WriteMutationsResponse : null; + } + + private ConnectionStreamRequest CreateWriteMutationsRequest(BatchWriteRequest.Types.MutationGroup mutations) + { + return new ConnectionStreamRequest + { + WriteMutationsRequest = new WriteMutationsRequest + { + Connection = GrpcLibSpanner.ToProto(this), + Mutations = mutations, + } + }; + } +} diff --git a/spannerlib/wrappers/spannerlib-dotnet/spannerlib-dotnet-grpc-impl/GrpcLibSpanner.cs b/spannerlib/wrappers/spannerlib-dotnet/spannerlib-dotnet-grpc-impl/GrpcLibSpanner.cs index edc871bc..17f4d985 100644 --- a/spannerlib/wrappers/spannerlib-dotnet/spannerlib-dotnet-grpc-impl/GrpcLibSpanner.cs +++ b/spannerlib/wrappers/spannerlib-dotnet/spannerlib-dotnet-grpc-impl/GrpcLibSpanner.cs @@ -75,20 +75,36 @@ public static GrpcChannel ForTcpSocket(string address) }); } + /// + /// This enum is used to configure a connection to use either a single bidirectional gRPC stream for all requests + /// that are sent to SpannerLib, or to use server streaming RPCs for queries and unary RPCs for all other + /// operations. + /// + /// NOTE: This enum is likely to be removed in a future version. + /// + public enum CommunicationStyle + { + ServerStreaming, + BidiStreaming, + } + private readonly Server _server; private readonly V1.SpannerLib.SpannerLibClient[] _clients; private readonly GrpcChannel[] _channels; + private readonly CommunicationStyle _communicationStyle; private bool _disposed; - private V1.SpannerLib.SpannerLibClient Client => _clients[Random.Shared.Next(_clients.Length)]; + internal V1.SpannerLib.SpannerLibClient Client => _clients[Random.Shared.Next(_clients.Length)]; public GrpcLibSpanner( + CommunicationStyle communicationStyle = CommunicationStyle.BidiStreaming, int numChannels = 4, Server.AddressType addressType = Server.AddressType.UnixDomainSocket) { GaxPreconditions.CheckArgument(numChannels > 0, nameof(numChannels), "numChannels must be > 0"); _server = new Server(); var file = _server.Start(addressType: addressType); + _communicationStyle = communicationStyle; _channels = new GrpcChannel[numChannels]; _clients = new V1.SpannerLib.SpannerLibClient[numChannels]; @@ -205,27 +221,41 @@ public async Task CloseConnectionAsync(Connection connection, CancellationToken } } - public Rows Execute(Connection connection, ExecuteSqlRequest statement) + public Rows Execute(Connection connection, ExecuteSqlRequest statement, int prefetchRows = 0) { - return ExecuteStreaming(connection, statement); + return ExecuteStreaming(connection, statement, prefetchRows); } - private StreamingRows ExecuteStreaming(Connection connection, ExecuteSqlRequest statement) + private StreamingRows ExecuteStreaming(Connection connection, ExecuteSqlRequest statement, int prefetchRows) { var client = _clients[Random.Shared.Next(_clients.Length)]; var stream = TranslateException(() => client.ExecuteStreaming(new ExecuteRequest { Connection = ToProto(connection), ExecuteSqlRequest = statement, + FetchOptions = new FetchOptions + { + NumRows = prefetchRows, + }, + })); + return StreamingRows.Create(this, connection, stream); + } + + internal AsyncServerStreamingCall ContinueStreaming(Connection connection, long rowsId) + { + var client = _clients[Random.Shared.Next(_clients.Length)]; + return TranslateException(() => client.ContinueStreaming(new V1.Rows + { + Connection = ToProto(connection), + Id = rowsId, })); - return StreamingRows.Create(connection, stream); } - public async Task ExecuteAsync(Connection connection, ExecuteSqlRequest statement, CancellationToken cancellationToken = default) + public async Task ExecuteAsync(Connection connection, ExecuteSqlRequest statement, int prefetchRows = 0, CancellationToken cancellationToken = default) { try { - return await ExecuteStreamingAsync(connection, statement, cancellationToken).ConfigureAwait(false); + return await ExecuteStreamingAsync(connection, statement, prefetchRows, cancellationToken).ConfigureAwait(false); } catch (RpcException exception) { @@ -233,15 +263,29 @@ public async Task ExecuteAsync(Connection connection, ExecuteSqlRequest st } } - private async Task ExecuteStreamingAsync(Connection connection, ExecuteSqlRequest statement, CancellationToken cancellationToken = default) + private async Task ExecuteStreamingAsync(Connection connection, ExecuteSqlRequest statement, int prefetchRows, CancellationToken cancellationToken = default) { var client = _clients[Random.Shared.Next(_clients.Length)]; var stream = TranslateException(() => client.ExecuteStreaming(new ExecuteRequest { Connection = ToProto(connection), ExecuteSqlRequest = statement, + FetchOptions = new FetchOptions + { + NumRows = prefetchRows, + }, })); - return await StreamingRows.CreateAsync(connection, stream, cancellationToken).ConfigureAwait(false); + return await StreamingRows.CreateAsync(this, connection, stream, cancellationToken).ConfigureAwait(false); + } + + internal AsyncServerStreamingCall ContinueStreamingAsync(Connection connection, long rowsId, CancellationToken cancellationToken) + { + var client = _clients[Random.Shared.Next(_clients.Length)]; + return TranslateException(() => client.ContinueStreaming(new V1.Rows + { + Connection = ToProto(connection), + Id = rowsId, + }, cancellationToken: cancellationToken)); } public long[] ExecuteBatch(Connection connection, ExecuteBatchDmlRequest statements) @@ -251,40 +295,19 @@ public long[] ExecuteBatch(Connection connection, ExecuteBatchDmlRequest stateme Connection = ToProto(connection), ExecuteBatchDmlRequest = statements, })); - var result = new long[response.ResultSets.Count]; - for (var i = 0; i < result.Length; i++) - { - if (response.ResultSets[i].Stats.HasRowCountExact) - { - result[i] = response.ResultSets[i].Stats.RowCountExact; - } - else if (response.ResultSets[i].Stats.HasRowCountLowerBound) - { - result[i] = response.ResultSets[i].Stats.RowCountLowerBound; - } - else - { - result[i] = -1; - } - } - return result; + return ISpannerLib.ToUpdateCounts(response); } public async Task ExecuteBatchAsync(Connection connection, ExecuteBatchDmlRequest statements, CancellationToken cancellationToken = default) { try { - var stats = await Client.ExecuteBatchAsync(new ExecuteBatchRequest + var response = await Client.ExecuteBatchAsync(new ExecuteBatchRequest { Connection = ToProto(connection), ExecuteBatchDmlRequest = statements, }, cancellationToken: cancellationToken).ConfigureAwait(false); - var result = new long[stats.ResultSets.Count]; - for (var i = 0; i < result.Length; i++) - { - result[i] = stats.ResultSets[i].Stats.RowCountExact; - } - return result; + return ISpannerLib.ToUpdateCounts(response); } catch (RpcException exception) { @@ -336,8 +359,11 @@ public async Task ExecuteBatchAsync(Connection connection, ExecuteBatchD var row = TranslateException(() =>Client.Next(new NextRequest { Rows = ToProto(rows), - NumRows = numRows, - Encoding = (long) encoding, + FetchOptions = new FetchOptions + { + NumRows = numRows, + Encoding = (long) encoding, + }, })); return row.Values.Count == 0 ? null : row; } @@ -349,8 +375,11 @@ public async Task ExecuteBatchAsync(Connection connection, ExecuteBatchD return await Client.NextAsync(new NextRequest { Rows = ToProto(rows), - NumRows = numRows, - Encoding = (long)encoding, + FetchOptions = new FetchOptions + { + NumRows = numRows, + Encoding = (long) encoding, + }, }, cancellationToken: cancellationToken).ConfigureAwait(false); } catch (RpcException exception) @@ -384,7 +413,16 @@ public void BeginTransaction(Connection connection, TransactionOptions transacti TransactionOptions = transactionOptions, })); } - + + public async Task BeginTransactionAsync(Connection connection, TransactionOptions transactionOptions, CancellationToken cancellationToken = default) + { + await TranslateException(() => Client.BeginTransactionAsync(new BeginTransactionRequest + { + Connection = ToProto(connection), + TransactionOptions = transactionOptions, + })).ConfigureAwait(false); + } + public CommitResponse? Commit(Connection connection) { var response = TranslateException(() => Client.Commit(ToProto(connection))); @@ -423,11 +461,14 @@ public async Task RollbackAsync(Connection connection, CancellationToken cancell private Pool FromProto(V1.Pool pool) => new(this, pool.Id); - private V1.Pool ToProto(Pool pool) => new() { Id = pool.Id }; + private static V1.Pool ToProto(Pool pool) => new() { Id = pool.Id }; - private Connection FromProto(Pool pool, V1.Connection proto) => new(pool, proto.Id); + private Connection FromProto(Pool pool, V1.Connection proto) => + _communicationStyle == CommunicationStyle.ServerStreaming + ? new Connection(pool, proto.Id) + : new GrpcBidiConnection(this, pool, proto.Id); - private V1.Connection ToProto(Connection connection) => new() { Id = connection.Id, Pool = ToProto(connection.Pool), }; + internal static V1.Connection ToProto(Connection connection) => new() { Id = connection.Id, Pool = ToProto(connection.Pool), }; private V1.Rows ToProto(Rows rows) => new() { Id = rows.Id, Connection = ToProto(rows.SpannerConnection), }; } \ No newline at end of file diff --git a/spannerlib/wrappers/spannerlib-dotnet/spannerlib-dotnet-grpc-impl/StreamingRows.cs b/spannerlib/wrappers/spannerlib-dotnet/spannerlib-dotnet-grpc-impl/StreamingRows.cs index 58c9124f..40257593 100644 --- a/spannerlib/wrappers/spannerlib-dotnet/spannerlib-dotnet-grpc-impl/StreamingRows.cs +++ b/spannerlib/wrappers/spannerlib-dotnet/spannerlib-dotnet-grpc-impl/StreamingRows.cs @@ -12,12 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; using System.Threading; using System.Threading.Tasks; using Google.Api.Gax; using Google.Cloud.Spanner.V1; using Google.Cloud.SpannerLib.V1; using Google.Protobuf.WellKnownTypes; +using Google.Rpc; using Grpc.Core; using Status = Google.Rpc.Status; @@ -25,54 +27,105 @@ namespace Google.Cloud.SpannerLib.Grpc; public class StreamingRows : Rows { - private readonly AsyncServerStreamingCall _stream; + private readonly GrpcLibSpanner _spanner; + private readonly ExecuteResponse? _executeResponse; + private AsyncServerStreamingCall? _stream; private ListValue? _pendingRow; private ResultSetMetadata? _metadata; private ResultSetStats? _stats; private bool _done; private bool _pendingNextResultSetCall; - protected override ResultSetStats? Stats => _stats; + private bool HasOnlyInMemResults => !_executeResponse?.HasMoreResults ?? false; + private bool HasMoreInMemRows => + _executeResponse != null + && _currentResultSetIndex < _executeResponse.ResultSets.Count + && (_currentResultSetIndex < _executeResponse.ResultSets.Count-1 || _currentRowIndex < _executeResponse.ResultSets[_currentResultSetIndex].Rows.Count-1); + private bool IsPositionedAtInMemResultSet => + _executeResponse != null + && _currentResultSetIndex < _executeResponse.ResultSets.Count; + private bool IsPositionedAtInMemResultSetWithAllData => + IsPositionedAtInMemResultSet + && (_currentResultSetIndex < _executeResponse!.ResultSets.Count - 1 || !_executeResponse.HasMoreResults); + private ResultSet CurrentInMemResultSet => _executeResponse!.ResultSets[_currentResultSetIndex]; - public override ResultSetMetadata? Metadata => _metadata; + private int _currentResultSetIndex; + private int _currentRowIndex = -1; + + private AsyncServerStreamingCall Stream => _stream!; + + protected override ResultSetStats? Stats => IsPositionedAtInMemResultSetWithAllData ? CurrentInMemResultSet.Stats : _stats; + + public override ResultSetMetadata? Metadata => IsPositionedAtInMemResultSet ? CurrentInMemResultSet.Metadata : _metadata; + + internal static StreamingRows Create(GrpcLibSpanner spanner, Connection connection, AsyncServerStreamingCall stream) + { + var rows = new StreamingRows(spanner, connection, stream); + rows._pendingRow = rows.Next(); + return rows; + } - public static StreamingRows Create(Connection connection, AsyncServerStreamingCall stream) + internal static StreamingRows Create(GrpcLibSpanner spanner, Connection connection, ExecuteResponse response) { - var rows = new StreamingRows(connection, stream); + var rows = new StreamingRows(spanner, connection, response); rows._pendingRow = rows.Next(); return rows; } - public static async Task CreateAsync(Connection connection, AsyncServerStreamingCall stream, CancellationToken cancellationToken = default) + internal static async Task CreateAsync(GrpcLibSpanner spanner, Connection connection, AsyncServerStreamingCall stream, CancellationToken cancellationToken) { - var rows = new StreamingRows(connection, stream); + var rows = new StreamingRows(spanner, connection, stream); rows._pendingRow = await rows.NextAsync(cancellationToken).ConfigureAwait(false); return rows; } - private StreamingRows(Connection connection, AsyncServerStreamingCall stream) : base(connection, 0, initMetadata: false) + internal static async Task CreateAsync(GrpcLibSpanner spanner, Connection connection, ExecuteResponse response, CancellationToken cancellationToken) { + var rows = new StreamingRows(spanner, connection, response); + rows._pendingRow = await rows.NextAsync(cancellationToken).ConfigureAwait(false); + return rows; + } + + private StreamingRows(GrpcLibSpanner spanner, Connection connection, AsyncServerStreamingCall stream) : base(connection, 0, initMetadata: false) + { + _spanner = spanner; _stream = stream; + _executeResponse = null; + } + + private StreamingRows(GrpcLibSpanner spanner, Connection connection, ExecuteResponse response) : base(connection, response.Rows.Id, initMetadata: false) + { + _spanner = spanner; + _stream = null; + _executeResponse = response; } protected override void Dispose(bool disposing) { Cleanup(); + if (_stream == null && (_executeResponse?.HasMoreResults ?? true)) + { + base.Dispose(disposing); + } } protected override ValueTask DisposeAsyncCore() { Cleanup(); + if (_stream == null && (_executeResponse?.HasMoreResults ?? true)) + { + return base.DisposeAsyncCore(); + } return ValueTask.CompletedTask; } - + private void Cleanup() { if (!_done) { MarkDone(); } - _stream.Dispose(); + _stream?.Dispose(); } private void MarkDone() @@ -80,27 +133,43 @@ private void MarkDone() _done = true; } - public override ListValue? Next() + private bool TryNextCached(out ListValue? result) { - // TODO: Combine sync and async methods - if (_pendingNextResultSetCall) + if (_pendingNextResultSetCall || _done) { - return null; + result = null; + return true; } if (_pendingRow != null) { - var row = _pendingRow; + result = _pendingRow; _pendingRow = null; - return row; + return true; + } + if (HasOnlyInMemResults || HasMoreInMemRows) + { + result = NextInMem(); + return true; + } + result = null; + return false; + } + + public override ListValue? Next() + { + if (TryNextCached(out var result)) + { + return result; } + _stream ??= _spanner.ContinueStreaming(SpannerConnection, Id); try { - var hasNext = Task.Run(() => _stream.ResponseStream.MoveNext()).ResultWithUnwrappedExceptions(); + var hasNext = Task.Run(() => Stream.ResponseStream.MoveNext()).ResultWithUnwrappedExceptions(); if (!hasNext) { MarkDone(); return null; } - var rowData = _stream.ResponseStream.Current; + var rowData = Stream.ResponseStream.Current; if (rowData.Metadata != null) { _metadata = rowData.Metadata; @@ -131,24 +200,20 @@ private void MarkDone() public override async Task NextAsync(CancellationToken cancellationToken = default) { - if (_pendingNextResultSetCall) + if (TryNextCached(out var result)) { - return null; - } - if (_pendingRow != null) { - var row = _pendingRow; - _pendingRow = null; - return row; + return result; } + _stream ??= _spanner.ContinueStreamingAsync(SpannerConnection, Id, cancellationToken); try { - var hasNext = await _stream.ResponseStream.MoveNext(cancellationToken).ConfigureAwait(false); + var hasNext = await Stream.ResponseStream.MoveNext(cancellationToken).ConfigureAwait(false); if (!hasNext) { MarkDone(); return null; } - var rowData = _stream.ResponseStream.Current; + var rowData = Stream.ResponseStream.Current; if (rowData.Metadata != null) { _metadata = rowData.Metadata; @@ -177,6 +242,37 @@ private void MarkDone() } } + /// + /// Returns the next row based on the cached in-memory results. + /// This method assumes that the cursor is positioned at an in-memory result. + /// + private ListValue? NextInMem() + { + GaxPreconditions.CheckNotNull(_executeResponse, nameof(_executeResponse)); + if (_currentResultSetIndex == _executeResponse!.ResultSets.Count) + { + return null; + } + _currentRowIndex = Math.Min(_currentRowIndex + 1, CurrentInMemResultSet.Rows.Count); + return _currentRowIndex == CurrentInMemResultSet.Rows.Count ? null : CurrentInMemResultSet.Rows[_currentRowIndex]; + } + + private bool TryNextResultSetInMem(out bool result) + { + if (HasOnlyInMemResults) + { + result = NextResultSetInMem(); + return true; + } + if (_executeResponse != null && _currentResultSetIndex < _executeResponse.ResultSets.Count-1) + { + result = NextResultSetInMem(); + return true; + } + result = false; + return false; + } + /// /// Moves the cursor to the next result set in this Rows object. /// @@ -187,6 +283,12 @@ public override bool NextResultSet() { return false; } + if (TryNextResultSetInMem(out var result)) + { + return result; + } + _stream ??= _spanner.ContinueStreaming(SpannerConnection, Id); + // Read data until we reach the next result set. ReadUntilEnd(); @@ -205,6 +307,12 @@ public override async Task NextResultSetAsync(CancellationToken cancellati { return false; } + if (TryNextResultSetInMem(out var result)) + { + return result; + } + _stream ??= _spanner.ContinueStreaming(SpannerConnection, Id); + // Read data until we reach the next result set. await ReadUntilEndAsync(cancellationToken).ConfigureAwait(false); @@ -213,6 +321,22 @@ public override async Task NextResultSetAsync(CancellationToken cancellati return hasNextResultSet; } + private bool NextResultSetInMem() + { + GaxPreconditions.CheckNotNull(_executeResponse, nameof(_executeResponse)); + if (_currentResultSetIndex == _executeResponse!.ResultSets.Count - 1) + { + if (_executeResponse.Status != null && _executeResponse.Status.Code != (int)Code.Ok) + { + throw new SpannerException(_executeResponse.Status); + } + return false; + } + _currentResultSetIndex++; + _currentRowIndex = -1; + return true; + } + private bool HasNextResultSet() { if (_pendingNextResultSetCall) @@ -240,4 +364,4 @@ private async Task ReadUntilEndAsync(CancellationToken cancellationToken) { } } -} \ No newline at end of file +} diff --git a/spannerlib/wrappers/spannerlib-dotnet/spannerlib-dotnet-grpc-v1/Spannerlib.g.cs b/spannerlib/wrappers/spannerlib-dotnet/spannerlib-dotnet-grpc-v1/Spannerlib.g.cs index c83094e1..2807f91b 100644 --- a/spannerlib/wrappers/spannerlib-dotnet/spannerlib-dotnet-grpc-v1/Spannerlib.g.cs +++ b/spannerlib/wrappers/spannerlib-dotnet/spannerlib-dotnet-grpc-v1/Spannerlib.g.cs @@ -27,106 +27,134 @@ static SpannerlibReflection() { "CiVnb29nbGUvc3Bhbm5lcmxpYi92MS9zcGFubmVybGliLnByb3RvEhRnb29n", "bGUuc3Bhbm5lcmxpYi52MRofZ29vZ2xlL2FwaS9maWVsZF9iZWhhdmlvci5w", "cm90bxobZ29vZ2xlL3Byb3RvYnVmL2VtcHR5LnByb3RvGhxnb29nbGUvcHJv", - "dG9idWYvc3RydWN0LnByb3RvGiJnb29nbGUvc3Bhbm5lci92MS9yZXN1bHRf", - "c2V0LnByb3RvGh9nb29nbGUvc3Bhbm5lci92MS9zcGFubmVyLnByb3RvGiNn", - "b29nbGUvc3Bhbm5lci92MS90cmFuc2FjdGlvbi5wcm90byINCgtJbmZvUmVx", - "dWVzdCIfCgxJbmZvUmVzcG9uc2USDwoHdmVyc2lvbhgBIAEoCSIzChFDcmVh", - "dGVQb29sUmVxdWVzdBIeChFjb25uZWN0aW9uX3N0cmluZxgBIAEoCUID4EEC", - "IkgKF0NyZWF0ZUNvbm5lY3Rpb25SZXF1ZXN0Ei0KBHBvb2wYASABKAsyGi5n", - "b29nbGUuc3Bhbm5lcmxpYi52MS5Qb29sQgPgQQIikwEKDkV4ZWN1dGVSZXF1", - "ZXN0EjkKCmNvbm5lY3Rpb24YASABKAsyIC5nb29nbGUuc3Bhbm5lcmxpYi52", - "MS5Db25uZWN0aW9uQgPgQQISRgoTZXhlY3V0ZV9zcWxfcmVxdWVzdBgCIAEo", - "CzIkLmdvb2dsZS5zcGFubmVyLnYxLkV4ZWN1dGVTcWxSZXF1ZXN0QgPgQQIi", - "owEKE0V4ZWN1dGVCYXRjaFJlcXVlc3QSOQoKY29ubmVjdGlvbhgBIAEoCzIg", - "Lmdvb2dsZS5zcGFubmVybGliLnYxLkNvbm5lY3Rpb25CA+BBAhJRChlleGVj", - "dXRlX2JhdGNoX2RtbF9yZXF1ZXN0GAIgASgLMikuZ29vZ2xlLnNwYW5uZXIu", - "djEuRXhlY3V0ZUJhdGNoRG1sUmVxdWVzdEID4EECIp0BChdCZWdpblRyYW5z", - "YWN0aW9uUmVxdWVzdBI5Cgpjb25uZWN0aW9uGAEgASgLMiAuZ29vZ2xlLnNw", - "YW5uZXJsaWIudjEuQ29ubmVjdGlvbkID4EECEkcKE3RyYW5zYWN0aW9uX29w", - "dGlvbnMYAiABKAsyJS5nb29nbGUuc3Bhbm5lci52MS5UcmFuc2FjdGlvbk9w", - "dGlvbnNCA+BBAiKeAQoVV3JpdGVNdXRhdGlvbnNSZXF1ZXN0EjkKCmNvbm5l", - "Y3Rpb24YASABKAsyIC5nb29nbGUuc3Bhbm5lcmxpYi52MS5Db25uZWN0aW9u", - "QgPgQQISSgoJbXV0YXRpb25zGAIgASgLMjIuZ29vZ2xlLnNwYW5uZXIudjEu", - "QmF0Y2hXcml0ZVJlcXVlc3QuTXV0YXRpb25Hcm91cEID4EECIhcKBFBvb2wS", - "DwoCaWQYASABKANCA+BBAiJMCgpDb25uZWN0aW9uEi0KBHBvb2wYASABKAsy", - "Gi5nb29nbGUuc3Bhbm5lcmxpYi52MS5Qb29sQgPgQQISDwoCaWQYAiABKANC", - "A+BBAiJSCgRSb3dzEjkKCmNvbm5lY3Rpb24YASABKAsyIC5nb29nbGUuc3Bh", - "bm5lcmxpYi52MS5Db25uZWN0aW9uQgPgQQISDwoCaWQYAiABKANCA+BBAiJq", - "CgtOZXh0UmVxdWVzdBItCgRyb3dzGAEgASgLMhouZ29vZ2xlLnNwYW5uZXJs", - "aWIudjEuUm93c0ID4EECEhUKCG51bV9yb3dzGAIgASgDQgPgQQISFQoIZW5j", - "b2RpbmcYAyABKANCA+BBAiLrAQoHUm93RGF0YRItCgRyb3dzGAEgASgLMhou", - "Z29vZ2xlLnNwYW5uZXJsaWIudjEuUm93c0ID4EECEjYKCG1ldGFkYXRhGAIg", - "ASgLMiQuZ29vZ2xlLnNwYW5uZXIudjEuUmVzdWx0U2V0TWV0YWRhdGESLQoE", - "ZGF0YRgDIAMoCzIaLmdvb2dsZS5wcm90b2J1Zi5MaXN0VmFsdWVCA+BBAhIw", - "CgVzdGF0cxgEIAEoCzIhLmdvb2dsZS5zcGFubmVyLnYxLlJlc3VsdFNldFN0", - "YXRzEhgKEGhhc19tb3JlX3Jlc3VsdHMYBSABKAgiQAoPTWV0YWRhdGFSZXF1", - "ZXN0Ei0KBHJvd3MYASABKAsyGi5nb29nbGUuc3Bhbm5lcmxpYi52MS5Sb3dz", - "QgPgQQIiRgoVUmVzdWx0U2V0U3RhdHNSZXF1ZXN0Ei0KBHJvd3MYASABKAsy", - "Gi5nb29nbGUuc3Bhbm5lcmxpYi52MS5Sb3dzQgPgQQIiZQoXQ29ubmVjdGlv", - "blN0cmVhbVJlcXVlc3QSPwoPZXhlY3V0ZV9yZXF1ZXN0GAEgASgLMiQuZ29v", - "Z2xlLnNwYW5uZXJsaWIudjEuRXhlY3V0ZVJlcXVlc3RIAEIJCgdyZXF1ZXN0", - "IloKGENvbm5lY3Rpb25TdHJlYW1SZXNwb25zZRIyCgNyb3cYASABKAsyIy5n", - "b29nbGUuc3Bhbm5lci52MS5QYXJ0aWFsUmVzdWx0U2V0SABCCgoIcmVzcG9u", - "c2UylwwKClNwYW5uZXJMaWISTwoESW5mbxIhLmdvb2dsZS5zcGFubmVybGli", - "LnYxLkluZm9SZXF1ZXN0GiIuZ29vZ2xlLnNwYW5uZXJsaWIudjEuSW5mb1Jl", - "c3BvbnNlIgASUwoKQ3JlYXRlUG9vbBInLmdvb2dsZS5zcGFubmVybGliLnYx", - "LkNyZWF0ZVBvb2xSZXF1ZXN0GhouZ29vZ2xlLnNwYW5uZXJsaWIudjEuUG9v", - "bCIAEkEKCUNsb3NlUG9vbBIaLmdvb2dsZS5zcGFubmVybGliLnYxLlBvb2wa", - "Fi5nb29nbGUucHJvdG9idWYuRW1wdHkiABJlChBDcmVhdGVDb25uZWN0aW9u", - "Ei0uZ29vZ2xlLnNwYW5uZXJsaWIudjEuQ3JlYXRlQ29ubmVjdGlvblJlcXVl", - "c3QaIC5nb29nbGUuc3Bhbm5lcmxpYi52MS5Db25uZWN0aW9uIgASTQoPQ2xv", - "c2VDb25uZWN0aW9uEiAuZ29vZ2xlLnNwYW5uZXJsaWIudjEuQ29ubmVjdGlv", - "bhoWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eSIAEk0KB0V4ZWN1dGUSJC5nb29n", - "bGUuc3Bhbm5lcmxpYi52MS5FeGVjdXRlUmVxdWVzdBoaLmdvb2dsZS5zcGFu", - "bmVybGliLnYxLlJvd3MiABJbChBFeGVjdXRlU3RyZWFtaW5nEiQuZ29vZ2xl", - "LnNwYW5uZXJsaWIudjEuRXhlY3V0ZVJlcXVlc3QaHS5nb29nbGUuc3Bhbm5l", - "cmxpYi52MS5Sb3dEYXRhIgAwARJnCgxFeGVjdXRlQmF0Y2gSKS5nb29nbGUu", - "c3Bhbm5lcmxpYi52MS5FeGVjdXRlQmF0Y2hSZXF1ZXN0GiouZ29vZ2xlLnNw", - "YW5uZXIudjEuRXhlY3V0ZUJhdGNoRG1sUmVzcG9uc2UiABJOCghNZXRhZGF0", - "YRIaLmdvb2dsZS5zcGFubmVybGliLnYxLlJvd3MaJC5nb29nbGUuc3Bhbm5l", - "ci52MS5SZXN1bHRTZXRNZXRhZGF0YSIAEkcKBE5leHQSIS5nb29nbGUuc3Bh", - "bm5lcmxpYi52MS5OZXh0UmVxdWVzdBoaLmdvb2dsZS5wcm90b2J1Zi5MaXN0", - "VmFsdWUiABJRCg5SZXN1bHRTZXRTdGF0cxIaLmdvb2dsZS5zcGFubmVybGli", - "LnYxLlJvd3MaIS5nb29nbGUuc3Bhbm5lci52MS5SZXN1bHRTZXRTdGF0cyIA", - "ElMKDU5leHRSZXN1bHRTZXQSGi5nb29nbGUuc3Bhbm5lcmxpYi52MS5Sb3dz", - "GiQuZ29vZ2xlLnNwYW5uZXIudjEuUmVzdWx0U2V0TWV0YWRhdGEiABJBCglD", - "bG9zZVJvd3MSGi5nb29nbGUuc3Bhbm5lcmxpYi52MS5Sb3dzGhYuZ29vZ2xl", - "LnByb3RvYnVmLkVtcHR5IgASWwoQQmVnaW5UcmFuc2FjdGlvbhItLmdvb2ds", - "ZS5zcGFubmVybGliLnYxLkJlZ2luVHJhbnNhY3Rpb25SZXF1ZXN0GhYuZ29v", - "Z2xlLnByb3RvYnVmLkVtcHR5IgASTwoGQ29tbWl0EiAuZ29vZ2xlLnNwYW5u", - "ZXJsaWIudjEuQ29ubmVjdGlvbhohLmdvb2dsZS5zcGFubmVyLnYxLkNvbW1p", - "dFJlc3BvbnNlIgASRgoIUm9sbGJhY2sSIC5nb29nbGUuc3Bhbm5lcmxpYi52", - "MS5Db25uZWN0aW9uGhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5IgASYgoOV3Jp", - "dGVNdXRhdGlvbnMSKy5nb29nbGUuc3Bhbm5lcmxpYi52MS5Xcml0ZU11dGF0", - "aW9uc1JlcXVlc3QaIS5nb29nbGUuc3Bhbm5lci52MS5Db21taXRSZXNwb25z", - "ZSIAEncKEENvbm5lY3Rpb25TdHJlYW0SLS5nb29nbGUuc3Bhbm5lcmxpYi52", - "MS5Db25uZWN0aW9uU3RyZWFtUmVxdWVzdBouLmdvb2dsZS5zcGFubmVybGli", - "LnYxLkNvbm5lY3Rpb25TdHJlYW1SZXNwb25zZSIAKAEwAULNAQoeY29tLmdv", - "b2dsZS5jbG91ZC5zcGFubmVybGliLnYxQg9TcGFubmVyTGliUHJvdG9QAVo+", - "Y2xvdWQuZ29vZ2xlLmNvbS9nby9zcGFubmVybGliL2FwaXYxL3NwYW5uZXJs", - "aWJwYjtzcGFubmVybGlicGKqAhpHb29nbGUuQ2xvdWQuU3Bhbm5lckxpYi5W", - "McoCGkdvb2dsZVxDbG91ZFxTcGFubmVyTGliXFYx6gIdR29vZ2xlOjpDbG91", - "ZDo6U3Bhbm5lckxpYjo6VjFiBnByb3RvMw==")); + "dG9idWYvc3RydWN0LnByb3RvGhdnb29nbGUvcnBjL3N0YXR1cy5wcm90bxoi", + "Z29vZ2xlL3NwYW5uZXIvdjEvcmVzdWx0X3NldC5wcm90bxofZ29vZ2xlL3Nw", + "YW5uZXIvdjEvc3Bhbm5lci5wcm90bxojZ29vZ2xlL3NwYW5uZXIvdjEvdHJh", + "bnNhY3Rpb24ucHJvdG8iDQoLSW5mb1JlcXVlc3QiHwoMSW5mb1Jlc3BvbnNl", + "Eg8KB3ZlcnNpb24YASABKAkiMwoRQ3JlYXRlUG9vbFJlcXVlc3QSHgoRY29u", + "bmVjdGlvbl9zdHJpbmcYASABKAlCA+BBAiJIChdDcmVhdGVDb25uZWN0aW9u", + "UmVxdWVzdBItCgRwb29sGAEgASgLMhouZ29vZ2xlLnNwYW5uZXJsaWIudjEu", + "UG9vbEID4EECIjwKDEZldGNoT3B0aW9ucxIVCghudW1fcm93cxgBIAEoA0ID", + "4EECEhUKCGVuY29kaW5nGAIgASgDQgPgQQIizgEKDkV4ZWN1dGVSZXF1ZXN0", + "EjkKCmNvbm5lY3Rpb24YASABKAsyIC5nb29nbGUuc3Bhbm5lcmxpYi52MS5D", + "b25uZWN0aW9uQgPgQQISRgoTZXhlY3V0ZV9zcWxfcmVxdWVzdBgCIAEoCzIk", + "Lmdvb2dsZS5zcGFubmVyLnYxLkV4ZWN1dGVTcWxSZXF1ZXN0QgPgQQISOQoN", + "ZmV0Y2hfb3B0aW9ucxgDIAEoCzIiLmdvb2dsZS5zcGFubmVybGliLnYxLkZl", + "dGNoT3B0aW9ucyKjAQoTRXhlY3V0ZUJhdGNoUmVxdWVzdBI5Cgpjb25uZWN0", + "aW9uGAEgASgLMiAuZ29vZ2xlLnNwYW5uZXJsaWIudjEuQ29ubmVjdGlvbkID", + "4EECElEKGWV4ZWN1dGVfYmF0Y2hfZG1sX3JlcXVlc3QYAiABKAsyKS5nb29n", + "bGUuc3Bhbm5lci52MS5FeGVjdXRlQmF0Y2hEbWxSZXF1ZXN0QgPgQQIinQEK", + "F0JlZ2luVHJhbnNhY3Rpb25SZXF1ZXN0EjkKCmNvbm5lY3Rpb24YASABKAsy", + "IC5nb29nbGUuc3Bhbm5lcmxpYi52MS5Db25uZWN0aW9uQgPgQQISRwoTdHJh", + "bnNhY3Rpb25fb3B0aW9ucxgCIAEoCzIlLmdvb2dsZS5zcGFubmVyLnYxLlRy", + "YW5zYWN0aW9uT3B0aW9uc0ID4EECIp4BChVXcml0ZU11dGF0aW9uc1JlcXVl", + "c3QSOQoKY29ubmVjdGlvbhgBIAEoCzIgLmdvb2dsZS5zcGFubmVybGliLnYx", + "LkNvbm5lY3Rpb25CA+BBAhJKCgltdXRhdGlvbnMYAiABKAsyMi5nb29nbGUu", + "c3Bhbm5lci52MS5CYXRjaFdyaXRlUmVxdWVzdC5NdXRhdGlvbkdyb3VwQgPg", + "QQIiFwoEUG9vbBIPCgJpZBgBIAEoA0ID4EECIkwKCkNvbm5lY3Rpb24SLQoE", + "cG9vbBgBIAEoCzIaLmdvb2dsZS5zcGFubmVybGliLnYxLlBvb2xCA+BBAhIP", + "CgJpZBgCIAEoA0ID4EECIlIKBFJvd3MSOQoKY29ubmVjdGlvbhgBIAEoCzIg", + "Lmdvb2dsZS5zcGFubmVybGliLnYxLkNvbm5lY3Rpb25CA+BBAhIPCgJpZBgC", + "IAEoA0ID4EECInwKC05leHRSZXF1ZXN0Ei0KBHJvd3MYASABKAsyGi5nb29n", + "bGUuc3Bhbm5lcmxpYi52MS5Sb3dzQgPgQQISPgoNZmV0Y2hfb3B0aW9ucxgC", + "IAEoCzIiLmdvb2dsZS5zcGFubmVybGliLnYxLkZldGNoT3B0aW9uc0ID4EEC", + "IusBCgdSb3dEYXRhEi0KBHJvd3MYASABKAsyGi5nb29nbGUuc3Bhbm5lcmxp", + "Yi52MS5Sb3dzQgPgQQISNgoIbWV0YWRhdGEYAiABKAsyJC5nb29nbGUuc3Bh", + "bm5lci52MS5SZXN1bHRTZXRNZXRhZGF0YRItCgRkYXRhGAMgAygLMhouZ29v", + "Z2xlLnByb3RvYnVmLkxpc3RWYWx1ZUID4EECEjAKBXN0YXRzGAQgASgLMiEu", + "Z29vZ2xlLnNwYW5uZXIudjEuUmVzdWx0U2V0U3RhdHMSGAoQaGFzX21vcmVf", + "cmVzdWx0cxgFIAEoCCJACg9NZXRhZGF0YVJlcXVlc3QSLQoEcm93cxgBIAEo", + "CzIaLmdvb2dsZS5zcGFubmVybGliLnYxLlJvd3NCA+BBAiJGChVSZXN1bHRT", + "ZXRTdGF0c1JlcXVlc3QSLQoEcm93cxgBIAEoCzIaLmdvb2dsZS5zcGFubmVy", + "bGliLnYxLlJvd3NCA+BBAiLPAwoXQ29ubmVjdGlvblN0cmVhbVJlcXVlc3QS", + "PwoPZXhlY3V0ZV9yZXF1ZXN0GAEgASgLMiQuZ29vZ2xlLnNwYW5uZXJsaWIu", + "djEuRXhlY3V0ZVJlcXVlc3RIABJKChVleGVjdXRlX2JhdGNoX3JlcXVlc3QY", + "AiABKAsyKS5nb29nbGUuc3Bhbm5lcmxpYi52MS5FeGVjdXRlQmF0Y2hSZXF1", + "ZXN0SAASUgoZYmVnaW5fdHJhbnNhY3Rpb25fcmVxdWVzdBgDIAEoCzItLmdv", + "b2dsZS5zcGFubmVybGliLnYxLkJlZ2luVHJhbnNhY3Rpb25SZXF1ZXN0SAAS", + "OgoOY29tbWl0X3JlcXVlc3QYBCABKAsyIC5nb29nbGUuc3Bhbm5lcmxpYi52", + "MS5Db25uZWN0aW9uSAASPAoQcm9sbGJhY2tfcmVxdWVzdBgFIAEoCzIgLmdv", + "b2dsZS5zcGFubmVybGliLnYxLkNvbm5lY3Rpb25IABJOChd3cml0ZV9tdXRh", + "dGlvbnNfcmVxdWVzdBgGIAEoCzIrLmdvb2dsZS5zcGFubmVybGliLnYxLldy", + "aXRlTXV0YXRpb25zUmVxdWVzdEgAQgkKB3JlcXVlc3QisQEKD0V4ZWN1dGVS", + "ZXNwb25zZRItCgRyb3dzGAEgASgLMhouZ29vZ2xlLnNwYW5uZXJsaWIudjEu", + "Um93c0ID4EECEjEKC3Jlc3VsdF9zZXRzGAIgAygLMhwuZ29vZ2xlLnNwYW5u", + "ZXIudjEuUmVzdWx0U2V0EiIKBnN0YXR1cxgDIAEoCzISLmdvb2dsZS5ycGMu", + "U3RhdHVzEhgKEGhhc19tb3JlX3Jlc3VsdHMYBCABKAgi0wMKGENvbm5lY3Rp", + "b25TdHJlYW1SZXNwb25zZRIiCgZzdGF0dXMYASABKAsyEi5nb29nbGUucnBj", + "LlN0YXR1cxJBChBleGVjdXRlX3Jlc3BvbnNlGAIgASgLMiUuZ29vZ2xlLnNw", + "YW5uZXJsaWIudjEuRXhlY3V0ZVJlc3BvbnNlSAASTAoWZXhlY3V0ZV9iYXRj", + "aF9yZXNwb25zZRgDIAEoCzIqLmdvb2dsZS5zcGFubmVyLnYxLkV4ZWN1dGVC", + "YXRjaERtbFJlc3BvbnNlSAASPAoaYmVnaW5fdHJhbnNhY3Rpb25fcmVzcG9u", + "c2UYBCABKAsyFi5nb29nbGUucHJvdG9idWYuRW1wdHlIABI8Cg9jb21taXRf", + "cmVzcG9uc2UYBSABKAsyIS5nb29nbGUuc3Bhbm5lci52MS5Db21taXRSZXNw", + "b25zZUgAEjMKEXJvbGxiYWNrX3Jlc3BvbnNlGAYgASgLMhYuZ29vZ2xlLnBy", + "b3RvYnVmLkVtcHR5SAASRQoYd3JpdGVfbXV0YXRpb25zX3Jlc3BvbnNlGAcg", + "ASgLMiEuZ29vZ2xlLnNwYW5uZXIudjEuQ29tbWl0UmVzcG9uc2VIAEIKCghy", + "ZXNwb25zZTLrDAoKU3Bhbm5lckxpYhJPCgRJbmZvEiEuZ29vZ2xlLnNwYW5u", + "ZXJsaWIudjEuSW5mb1JlcXVlc3QaIi5nb29nbGUuc3Bhbm5lcmxpYi52MS5J", + "bmZvUmVzcG9uc2UiABJTCgpDcmVhdGVQb29sEicuZ29vZ2xlLnNwYW5uZXJs", + "aWIudjEuQ3JlYXRlUG9vbFJlcXVlc3QaGi5nb29nbGUuc3Bhbm5lcmxpYi52", + "MS5Qb29sIgASQQoJQ2xvc2VQb29sEhouZ29vZ2xlLnNwYW5uZXJsaWIudjEu", + "UG9vbBoWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eSIAEmUKEENyZWF0ZUNvbm5l", + "Y3Rpb24SLS5nb29nbGUuc3Bhbm5lcmxpYi52MS5DcmVhdGVDb25uZWN0aW9u", + "UmVxdWVzdBogLmdvb2dsZS5zcGFubmVybGliLnYxLkNvbm5lY3Rpb24iABJN", + "Cg9DbG9zZUNvbm5lY3Rpb24SIC5nb29nbGUuc3Bhbm5lcmxpYi52MS5Db25u", + "ZWN0aW9uGhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5IgASTQoHRXhlY3V0ZRIk", + "Lmdvb2dsZS5zcGFubmVybGliLnYxLkV4ZWN1dGVSZXF1ZXN0GhouZ29vZ2xl", + "LnNwYW5uZXJsaWIudjEuUm93cyIAElsKEEV4ZWN1dGVTdHJlYW1pbmcSJC5n", + "b29nbGUuc3Bhbm5lcmxpYi52MS5FeGVjdXRlUmVxdWVzdBodLmdvb2dsZS5z", + "cGFubmVybGliLnYxLlJvd0RhdGEiADABEmcKDEV4ZWN1dGVCYXRjaBIpLmdv", + "b2dsZS5zcGFubmVybGliLnYxLkV4ZWN1dGVCYXRjaFJlcXVlc3QaKi5nb29n", + "bGUuc3Bhbm5lci52MS5FeGVjdXRlQmF0Y2hEbWxSZXNwb25zZSIAEk4KCE1l", + "dGFkYXRhEhouZ29vZ2xlLnNwYW5uZXJsaWIudjEuUm93cxokLmdvb2dsZS5z", + "cGFubmVyLnYxLlJlc3VsdFNldE1ldGFkYXRhIgASRwoETmV4dBIhLmdvb2ds", + "ZS5zcGFubmVybGliLnYxLk5leHRSZXF1ZXN0GhouZ29vZ2xlLnByb3RvYnVm", + "Lkxpc3RWYWx1ZSIAElEKDlJlc3VsdFNldFN0YXRzEhouZ29vZ2xlLnNwYW5u", + "ZXJsaWIudjEuUm93cxohLmdvb2dsZS5zcGFubmVyLnYxLlJlc3VsdFNldFN0", + "YXRzIgASUwoNTmV4dFJlc3VsdFNldBIaLmdvb2dsZS5zcGFubmVybGliLnYx", + "LlJvd3MaJC5nb29nbGUuc3Bhbm5lci52MS5SZXN1bHRTZXRNZXRhZGF0YSIA", + "EkEKCUNsb3NlUm93cxIaLmdvb2dsZS5zcGFubmVybGliLnYxLlJvd3MaFi5n", + "b29nbGUucHJvdG9idWYuRW1wdHkiABJbChBCZWdpblRyYW5zYWN0aW9uEi0u", + "Z29vZ2xlLnNwYW5uZXJsaWIudjEuQmVnaW5UcmFuc2FjdGlvblJlcXVlc3Qa", + "Fi5nb29nbGUucHJvdG9idWYuRW1wdHkiABJPCgZDb21taXQSIC5nb29nbGUu", + "c3Bhbm5lcmxpYi52MS5Db25uZWN0aW9uGiEuZ29vZ2xlLnNwYW5uZXIudjEu", + "Q29tbWl0UmVzcG9uc2UiABJGCghSb2xsYmFjaxIgLmdvb2dsZS5zcGFubmVy", + "bGliLnYxLkNvbm5lY3Rpb24aFi5nb29nbGUucHJvdG9idWYuRW1wdHkiABJi", + "Cg5Xcml0ZU11dGF0aW9ucxIrLmdvb2dsZS5zcGFubmVybGliLnYxLldyaXRl", + "TXV0YXRpb25zUmVxdWVzdBohLmdvb2dsZS5zcGFubmVyLnYxLkNvbW1pdFJl", + "c3BvbnNlIgASdwoQQ29ubmVjdGlvblN0cmVhbRItLmdvb2dsZS5zcGFubmVy", + "bGliLnYxLkNvbm5lY3Rpb25TdHJlYW1SZXF1ZXN0Gi4uZ29vZ2xlLnNwYW5u", + "ZXJsaWIudjEuQ29ubmVjdGlvblN0cmVhbVJlc3BvbnNlIgAoATABElIKEUNv", + "bnRpbnVlU3RyZWFtaW5nEhouZ29vZ2xlLnNwYW5uZXJsaWIudjEuUm93cxod", + "Lmdvb2dsZS5zcGFubmVybGliLnYxLlJvd0RhdGEiADABQs0BCh5jb20uZ29v", + "Z2xlLmNsb3VkLnNwYW5uZXJsaWIudjFCD1NwYW5uZXJMaWJQcm90b1ABWj5j", + "bG91ZC5nb29nbGUuY29tL2dvL3NwYW5uZXJsaWIvYXBpdjEvc3Bhbm5lcmxp", + "YnBiO3NwYW5uZXJsaWJwYqoCGkdvb2dsZS5DbG91ZC5TcGFubmVyTGliLlYx", + "ygIaR29vZ2xlXENsb3VkXFNwYW5uZXJMaWJcVjHqAh1Hb29nbGU6OkNsb3Vk", + "OjpTcGFubmVyTGliOjpWMWIGcHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { global::Google.Api.FieldBehaviorReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.EmptyReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.StructReflection.Descriptor, global::Google.Cloud.Spanner.V1.ResultSetReflection.Descriptor, global::Google.Cloud.Spanner.V1.SpannerReflection.Descriptor, global::Google.Cloud.Spanner.V1.TransactionReflection.Descriptor, }, + new pbr::FileDescriptor[] { global::Google.Api.FieldBehaviorReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.EmptyReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.StructReflection.Descriptor, global::Google.Rpc.StatusReflection.Descriptor, global::Google.Cloud.Spanner.V1.ResultSetReflection.Descriptor, global::Google.Cloud.Spanner.V1.SpannerReflection.Descriptor, global::Google.Cloud.Spanner.V1.TransactionReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.SpannerLib.V1.InfoRequest), global::Google.Cloud.SpannerLib.V1.InfoRequest.Parser, null, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.SpannerLib.V1.InfoResponse), global::Google.Cloud.SpannerLib.V1.InfoResponse.Parser, new[]{ "Version" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.SpannerLib.V1.CreatePoolRequest), global::Google.Cloud.SpannerLib.V1.CreatePoolRequest.Parser, new[]{ "ConnectionString" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.SpannerLib.V1.CreateConnectionRequest), global::Google.Cloud.SpannerLib.V1.CreateConnectionRequest.Parser, new[]{ "Pool" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.SpannerLib.V1.ExecuteRequest), global::Google.Cloud.SpannerLib.V1.ExecuteRequest.Parser, new[]{ "Connection", "ExecuteSqlRequest" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.SpannerLib.V1.FetchOptions), global::Google.Cloud.SpannerLib.V1.FetchOptions.Parser, new[]{ "NumRows", "Encoding" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.SpannerLib.V1.ExecuteRequest), global::Google.Cloud.SpannerLib.V1.ExecuteRequest.Parser, new[]{ "Connection", "ExecuteSqlRequest", "FetchOptions" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.SpannerLib.V1.ExecuteBatchRequest), global::Google.Cloud.SpannerLib.V1.ExecuteBatchRequest.Parser, new[]{ "Connection", "ExecuteBatchDmlRequest" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.SpannerLib.V1.BeginTransactionRequest), global::Google.Cloud.SpannerLib.V1.BeginTransactionRequest.Parser, new[]{ "Connection", "TransactionOptions" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.SpannerLib.V1.WriteMutationsRequest), global::Google.Cloud.SpannerLib.V1.WriteMutationsRequest.Parser, new[]{ "Connection", "Mutations" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.SpannerLib.V1.Pool), global::Google.Cloud.SpannerLib.V1.Pool.Parser, new[]{ "Id" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.SpannerLib.V1.Connection), global::Google.Cloud.SpannerLib.V1.Connection.Parser, new[]{ "Pool", "Id" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.SpannerLib.V1.Rows), global::Google.Cloud.SpannerLib.V1.Rows.Parser, new[]{ "Connection", "Id" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.SpannerLib.V1.NextRequest), global::Google.Cloud.SpannerLib.V1.NextRequest.Parser, new[]{ "Rows", "NumRows", "Encoding" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.SpannerLib.V1.NextRequest), global::Google.Cloud.SpannerLib.V1.NextRequest.Parser, new[]{ "Rows", "FetchOptions" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.SpannerLib.V1.RowData), global::Google.Cloud.SpannerLib.V1.RowData.Parser, new[]{ "Rows", "Metadata", "Data", "Stats", "HasMoreResults" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.SpannerLib.V1.MetadataRequest), global::Google.Cloud.SpannerLib.V1.MetadataRequest.Parser, new[]{ "Rows" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.SpannerLib.V1.ResultSetStatsRequest), global::Google.Cloud.SpannerLib.V1.ResultSetStatsRequest.Parser, new[]{ "Rows" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.SpannerLib.V1.ConnectionStreamRequest), global::Google.Cloud.SpannerLib.V1.ConnectionStreamRequest.Parser, new[]{ "ExecuteRequest" }, new[]{ "Request" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.SpannerLib.V1.ConnectionStreamResponse), global::Google.Cloud.SpannerLib.V1.ConnectionStreamResponse.Parser, new[]{ "Row" }, new[]{ "Response" }, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.SpannerLib.V1.ConnectionStreamRequest), global::Google.Cloud.SpannerLib.V1.ConnectionStreamRequest.Parser, new[]{ "ExecuteRequest", "ExecuteBatchRequest", "BeginTransactionRequest", "CommitRequest", "RollbackRequest", "WriteMutationsRequest" }, new[]{ "Request" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.SpannerLib.V1.ExecuteResponse), global::Google.Cloud.SpannerLib.V1.ExecuteResponse.Parser, new[]{ "Rows", "ResultSets", "Status", "HasMoreResults" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.SpannerLib.V1.ConnectionStreamResponse), global::Google.Cloud.SpannerLib.V1.ConnectionStreamResponse.Parser, new[]{ "Status", "ExecuteResponse", "ExecuteBatchResponse", "BeginTransactionResponse", "CommitResponse", "RollbackResponse", "WriteMutationsResponse" }, new[]{ "Response" }, null, null, null) })); } #endregion @@ -897,6 +925,241 @@ public void MergeFrom(pb::CodedInputStream input) { } + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class FetchOptions : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new FetchOptions()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Google.Cloud.SpannerLib.V1.SpannerlibReflection.Descriptor.MessageTypes[4]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public FetchOptions() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public FetchOptions(FetchOptions other) : this() { + numRows_ = other.numRows_; + encoding_ = other.encoding_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public FetchOptions Clone() { + return new FetchOptions(this); + } + + /// Field number for the "num_rows" field. + public const int NumRowsFieldNumber = 1; + private long numRows_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long NumRows { + get { return numRows_; } + set { + numRows_ = value; + } + } + + /// Field number for the "encoding" field. + public const int EncodingFieldNumber = 2; + private long encoding_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long Encoding { + get { return encoding_; } + set { + encoding_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as FetchOptions); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(FetchOptions other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (NumRows != other.NumRows) return false; + if (Encoding != other.Encoding) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (NumRows != 0L) hash ^= NumRows.GetHashCode(); + if (Encoding != 0L) hash ^= Encoding.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (NumRows != 0L) { + output.WriteRawTag(8); + output.WriteInt64(NumRows); + } + if (Encoding != 0L) { + output.WriteRawTag(16); + output.WriteInt64(Encoding); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (NumRows != 0L) { + output.WriteRawTag(8); + output.WriteInt64(NumRows); + } + if (Encoding != 0L) { + output.WriteRawTag(16); + output.WriteInt64(Encoding); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (NumRows != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(NumRows); + } + if (Encoding != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(Encoding); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(FetchOptions other) { + if (other == null) { + return; + } + if (other.NumRows != 0L) { + NumRows = other.NumRows; + } + if (other.Encoding != 0L) { + Encoding = other.Encoding; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + NumRows = input.ReadInt64(); + break; + } + case 16: { + Encoding = input.ReadInt64(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + NumRows = input.ReadInt64(); + break; + } + case 16: { + Encoding = input.ReadInt64(); + break; + } + } + } + } + #endif + + } + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] public sealed partial class ExecuteRequest : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE @@ -912,7 +1175,7 @@ public sealed partial class ExecuteRequest : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Cloud.SpannerLib.V1.SpannerlibReflection.Descriptor.MessageTypes[4]; } + get { return global::Google.Cloud.SpannerLib.V1.SpannerlibReflection.Descriptor.MessageTypes[5]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -934,6 +1197,7 @@ public ExecuteRequest() { public ExecuteRequest(ExecuteRequest other) : this() { connection_ = other.connection_ != null ? other.connection_.Clone() : null; executeSqlRequest_ = other.executeSqlRequest_ != null ? other.executeSqlRequest_.Clone() : null; + fetchOptions_ = other.fetchOptions_ != null ? other.fetchOptions_.Clone() : null; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } @@ -967,6 +1231,18 @@ public ExecuteRequest Clone() { } } + /// Field number for the "fetch_options" field. + public const int FetchOptionsFieldNumber = 3; + private global::Google.Cloud.SpannerLib.V1.FetchOptions fetchOptions_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Google.Cloud.SpannerLib.V1.FetchOptions FetchOptions { + get { return fetchOptions_; } + set { + fetchOptions_ = value; + } + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { @@ -984,6 +1260,7 @@ public bool Equals(ExecuteRequest other) { } if (!object.Equals(Connection, other.Connection)) return false; if (!object.Equals(ExecuteSqlRequest, other.ExecuteSqlRequest)) return false; + if (!object.Equals(FetchOptions, other.FetchOptions)) return false; return Equals(_unknownFields, other._unknownFields); } @@ -993,6 +1270,7 @@ public override int GetHashCode() { int hash = 1; if (connection_ != null) hash ^= Connection.GetHashCode(); if (executeSqlRequest_ != null) hash ^= ExecuteSqlRequest.GetHashCode(); + if (fetchOptions_ != null) hash ^= FetchOptions.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -1019,6 +1297,10 @@ public void WriteTo(pb::CodedOutputStream output) { output.WriteRawTag(18); output.WriteMessage(ExecuteSqlRequest); } + if (fetchOptions_ != null) { + output.WriteRawTag(26); + output.WriteMessage(FetchOptions); + } if (_unknownFields != null) { _unknownFields.WriteTo(output); } @@ -1037,6 +1319,10 @@ public void WriteTo(pb::CodedOutputStream output) { output.WriteRawTag(18); output.WriteMessage(ExecuteSqlRequest); } + if (fetchOptions_ != null) { + output.WriteRawTag(26); + output.WriteMessage(FetchOptions); + } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } @@ -1053,6 +1339,9 @@ public int CalculateSize() { if (executeSqlRequest_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(ExecuteSqlRequest); } + if (fetchOptions_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(FetchOptions); + } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -1077,6 +1366,12 @@ public void MergeFrom(ExecuteRequest other) { } ExecuteSqlRequest.MergeFrom(other.ExecuteSqlRequest); } + if (other.fetchOptions_ != null) { + if (fetchOptions_ == null) { + FetchOptions = new global::Google.Cloud.SpannerLib.V1.FetchOptions(); + } + FetchOptions.MergeFrom(other.FetchOptions); + } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -1110,6 +1405,13 @@ public void MergeFrom(pb::CodedInputStream input) { input.ReadMessage(ExecuteSqlRequest); break; } + case 26: { + if (fetchOptions_ == null) { + FetchOptions = new global::Google.Cloud.SpannerLib.V1.FetchOptions(); + } + input.ReadMessage(FetchOptions); + break; + } } } #endif @@ -1143,6 +1445,13 @@ public void MergeFrom(pb::CodedInputStream input) { input.ReadMessage(ExecuteSqlRequest); break; } + case 26: { + if (fetchOptions_ == null) { + FetchOptions = new global::Google.Cloud.SpannerLib.V1.FetchOptions(); + } + input.ReadMessage(FetchOptions); + break; + } } } } @@ -1165,7 +1474,7 @@ public sealed partial class ExecuteBatchRequest : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Cloud.SpannerLib.V1.SpannerlibReflection.Descriptor.MessageTypes[8]; } + get { return global::Google.Cloud.SpannerLib.V1.SpannerlibReflection.Descriptor.MessageTypes[9]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2122,7 +2431,7 @@ public sealed partial class Connection : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Cloud.SpannerLib.V1.SpannerlibReflection.Descriptor.MessageTypes[9]; } + get { return global::Google.Cloud.SpannerLib.V1.SpannerlibReflection.Descriptor.MessageTypes[10]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2366,7 +2675,7 @@ public sealed partial class Rows : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Cloud.SpannerLib.V1.SpannerlibReflection.Descriptor.MessageTypes[10]; } + get { return global::Google.Cloud.SpannerLib.V1.SpannerlibReflection.Descriptor.MessageTypes[11]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2610,7 +2919,7 @@ public sealed partial class NextRequest : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Cloud.SpannerLib.V1.SpannerlibReflection.Descriptor.MessageTypes[11]; } + get { return global::Google.Cloud.SpannerLib.V1.SpannerlibReflection.Descriptor.MessageTypes[12]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2631,8 +2940,7 @@ public NextRequest() { [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public NextRequest(NextRequest other) : this() { rows_ = other.rows_ != null ? other.rows_.Clone() : null; - numRows_ = other.numRows_; - encoding_ = other.encoding_; + fetchOptions_ = other.fetchOptions_ != null ? other.fetchOptions_.Clone() : null; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } @@ -2654,27 +2962,15 @@ public NextRequest Clone() { } } - /// Field number for the "num_rows" field. - public const int NumRowsFieldNumber = 2; - private long numRows_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public long NumRows { - get { return numRows_; } - set { - numRows_ = value; - } - } - - /// Field number for the "encoding" field. - public const int EncodingFieldNumber = 3; - private long encoding_; + /// Field number for the "fetch_options" field. + public const int FetchOptionsFieldNumber = 2; + private global::Google.Cloud.SpannerLib.V1.FetchOptions fetchOptions_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public long Encoding { - get { return encoding_; } + public global::Google.Cloud.SpannerLib.V1.FetchOptions FetchOptions { + get { return fetchOptions_; } set { - encoding_ = value; + fetchOptions_ = value; } } @@ -2694,8 +2990,7 @@ public bool Equals(NextRequest other) { return true; } if (!object.Equals(Rows, other.Rows)) return false; - if (NumRows != other.NumRows) return false; - if (Encoding != other.Encoding) return false; + if (!object.Equals(FetchOptions, other.FetchOptions)) return false; return Equals(_unknownFields, other._unknownFields); } @@ -2704,8 +2999,7 @@ public bool Equals(NextRequest other) { public override int GetHashCode() { int hash = 1; if (rows_ != null) hash ^= Rows.GetHashCode(); - if (NumRows != 0L) hash ^= NumRows.GetHashCode(); - if (Encoding != 0L) hash ^= Encoding.GetHashCode(); + if (fetchOptions_ != null) hash ^= FetchOptions.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -2728,13 +3022,9 @@ public void WriteTo(pb::CodedOutputStream output) { output.WriteRawTag(10); output.WriteMessage(Rows); } - if (NumRows != 0L) { - output.WriteRawTag(16); - output.WriteInt64(NumRows); - } - if (Encoding != 0L) { - output.WriteRawTag(24); - output.WriteInt64(Encoding); + if (fetchOptions_ != null) { + output.WriteRawTag(18); + output.WriteMessage(FetchOptions); } if (_unknownFields != null) { _unknownFields.WriteTo(output); @@ -2750,13 +3040,9 @@ public void WriteTo(pb::CodedOutputStream output) { output.WriteRawTag(10); output.WriteMessage(Rows); } - if (NumRows != 0L) { - output.WriteRawTag(16); - output.WriteInt64(NumRows); - } - if (Encoding != 0L) { - output.WriteRawTag(24); - output.WriteInt64(Encoding); + if (fetchOptions_ != null) { + output.WriteRawTag(18); + output.WriteMessage(FetchOptions); } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); @@ -2771,11 +3057,8 @@ public int CalculateSize() { if (rows_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(Rows); } - if (NumRows != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(NumRows); - } - if (Encoding != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(Encoding); + if (fetchOptions_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(FetchOptions); } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); @@ -2795,11 +3078,11 @@ public void MergeFrom(NextRequest other) { } Rows.MergeFrom(other.Rows); } - if (other.NumRows != 0L) { - NumRows = other.NumRows; - } - if (other.Encoding != 0L) { - Encoding = other.Encoding; + if (other.fetchOptions_ != null) { + if (fetchOptions_ == null) { + FetchOptions = new global::Google.Cloud.SpannerLib.V1.FetchOptions(); + } + FetchOptions.MergeFrom(other.FetchOptions); } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -2827,12 +3110,11 @@ public void MergeFrom(pb::CodedInputStream input) { input.ReadMessage(Rows); break; } - case 16: { - NumRows = input.ReadInt64(); - break; - } - case 24: { - Encoding = input.ReadInt64(); + case 18: { + if (fetchOptions_ == null) { + FetchOptions = new global::Google.Cloud.SpannerLib.V1.FetchOptions(); + } + input.ReadMessage(FetchOptions); break; } } @@ -2861,12 +3143,11 @@ public void MergeFrom(pb::CodedInputStream input) { input.ReadMessage(Rows); break; } - case 16: { - NumRows = input.ReadInt64(); - break; - } - case 24: { - Encoding = input.ReadInt64(); + case 18: { + if (fetchOptions_ == null) { + FetchOptions = new global::Google.Cloud.SpannerLib.V1.FetchOptions(); + } + input.ReadMessage(FetchOptions); break; } } @@ -2891,7 +3172,7 @@ public sealed partial class RowData : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Cloud.SpannerLib.V1.SpannerlibReflection.Descriptor.MessageTypes[12]; } + get { return global::Google.Cloud.SpannerLib.V1.SpannerlibReflection.Descriptor.MessageTypes[13]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3253,7 +3534,7 @@ public sealed partial class MetadataRequest : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Cloud.SpannerLib.V1.SpannerlibReflection.Descriptor.MessageTypes[13]; } + get { return global::Google.Cloud.SpannerLib.V1.SpannerlibReflection.Descriptor.MessageTypes[14]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3460,7 +3741,7 @@ public sealed partial class ResultSetStatsRequest : pb::IMessage + /// ConnectionStreamRequest is used by a client to send a request to the server using a + /// bi-directional gRPC stream. Such a stream is opened by calling the ConnectionStream RPC. + /// [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] public sealed partial class ConnectionStreamRequest : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE @@ -3667,7 +3952,7 @@ public sealed partial class ConnectionStreamRequest : pb::IMessageField number for the "execute_batch_request" field. + public const int ExecuteBatchRequestFieldNumber = 2; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Google.Cloud.SpannerLib.V1.ExecuteBatchRequest ExecuteBatchRequest { + get { return requestCase_ == RequestOneofCase.ExecuteBatchRequest ? (global::Google.Cloud.SpannerLib.V1.ExecuteBatchRequest) request_ : null; } + set { + request_ = value; + requestCase_ = value == null ? RequestOneofCase.None : RequestOneofCase.ExecuteBatchRequest; + } + } + + /// Field number for the "begin_transaction_request" field. + public const int BeginTransactionRequestFieldNumber = 3; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Google.Cloud.SpannerLib.V1.BeginTransactionRequest BeginTransactionRequest { + get { return requestCase_ == RequestOneofCase.BeginTransactionRequest ? (global::Google.Cloud.SpannerLib.V1.BeginTransactionRequest) request_ : null; } + set { + request_ = value; + requestCase_ = value == null ? RequestOneofCase.None : RequestOneofCase.BeginTransactionRequest; + } + } + + /// Field number for the "commit_request" field. + public const int CommitRequestFieldNumber = 4; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Google.Cloud.SpannerLib.V1.Connection CommitRequest { + get { return requestCase_ == RequestOneofCase.CommitRequest ? (global::Google.Cloud.SpannerLib.V1.Connection) request_ : null; } + set { + request_ = value; + requestCase_ = value == null ? RequestOneofCase.None : RequestOneofCase.CommitRequest; + } + } + + /// Field number for the "rollback_request" field. + public const int RollbackRequestFieldNumber = 5; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Google.Cloud.SpannerLib.V1.Connection RollbackRequest { + get { return requestCase_ == RequestOneofCase.RollbackRequest ? (global::Google.Cloud.SpannerLib.V1.Connection) request_ : null; } + set { + request_ = value; + requestCase_ = value == null ? RequestOneofCase.None : RequestOneofCase.RollbackRequest; + } + } + + /// Field number for the "write_mutations_request" field. + public const int WriteMutationsRequestFieldNumber = 6; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Google.Cloud.SpannerLib.V1.WriteMutationsRequest WriteMutationsRequest { + get { return requestCase_ == RequestOneofCase.WriteMutationsRequest ? (global::Google.Cloud.SpannerLib.V1.WriteMutationsRequest) request_ : null; } + set { + request_ = value; + requestCase_ = value == null ? RequestOneofCase.None : RequestOneofCase.WriteMutationsRequest; + } + } + private object request_; /// Enum of possible cases for the "request" oneof. public enum RequestOneofCase { None = 0, ExecuteRequest = 1, + ExecuteBatchRequest = 2, + BeginTransactionRequest = 3, + CommitRequest = 4, + RollbackRequest = 5, + WriteMutationsRequest = 6, } private RequestOneofCase requestCase_ = RequestOneofCase.None; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3750,6 +4115,11 @@ public bool Equals(ConnectionStreamRequest other) { return true; } if (!object.Equals(ExecuteRequest, other.ExecuteRequest)) return false; + if (!object.Equals(ExecuteBatchRequest, other.ExecuteBatchRequest)) return false; + if (!object.Equals(BeginTransactionRequest, other.BeginTransactionRequest)) return false; + if (!object.Equals(CommitRequest, other.CommitRequest)) return false; + if (!object.Equals(RollbackRequest, other.RollbackRequest)) return false; + if (!object.Equals(WriteMutationsRequest, other.WriteMutationsRequest)) return false; if (RequestCase != other.RequestCase) return false; return Equals(_unknownFields, other._unknownFields); } @@ -3759,6 +4129,11 @@ public bool Equals(ConnectionStreamRequest other) { public override int GetHashCode() { int hash = 1; if (requestCase_ == RequestOneofCase.ExecuteRequest) hash ^= ExecuteRequest.GetHashCode(); + if (requestCase_ == RequestOneofCase.ExecuteBatchRequest) hash ^= ExecuteBatchRequest.GetHashCode(); + if (requestCase_ == RequestOneofCase.BeginTransactionRequest) hash ^= BeginTransactionRequest.GetHashCode(); + if (requestCase_ == RequestOneofCase.CommitRequest) hash ^= CommitRequest.GetHashCode(); + if (requestCase_ == RequestOneofCase.RollbackRequest) hash ^= RollbackRequest.GetHashCode(); + if (requestCase_ == RequestOneofCase.WriteMutationsRequest) hash ^= WriteMutationsRequest.GetHashCode(); hash ^= (int) requestCase_; if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); @@ -3782,6 +4157,26 @@ public void WriteTo(pb::CodedOutputStream output) { output.WriteRawTag(10); output.WriteMessage(ExecuteRequest); } + if (requestCase_ == RequestOneofCase.ExecuteBatchRequest) { + output.WriteRawTag(18); + output.WriteMessage(ExecuteBatchRequest); + } + if (requestCase_ == RequestOneofCase.BeginTransactionRequest) { + output.WriteRawTag(26); + output.WriteMessage(BeginTransactionRequest); + } + if (requestCase_ == RequestOneofCase.CommitRequest) { + output.WriteRawTag(34); + output.WriteMessage(CommitRequest); + } + if (requestCase_ == RequestOneofCase.RollbackRequest) { + output.WriteRawTag(42); + output.WriteMessage(RollbackRequest); + } + if (requestCase_ == RequestOneofCase.WriteMutationsRequest) { + output.WriteRawTag(50); + output.WriteMessage(WriteMutationsRequest); + } if (_unknownFields != null) { _unknownFields.WriteTo(output); } @@ -3796,6 +4191,26 @@ public void WriteTo(pb::CodedOutputStream output) { output.WriteRawTag(10); output.WriteMessage(ExecuteRequest); } + if (requestCase_ == RequestOneofCase.ExecuteBatchRequest) { + output.WriteRawTag(18); + output.WriteMessage(ExecuteBatchRequest); + } + if (requestCase_ == RequestOneofCase.BeginTransactionRequest) { + output.WriteRawTag(26); + output.WriteMessage(BeginTransactionRequest); + } + if (requestCase_ == RequestOneofCase.CommitRequest) { + output.WriteRawTag(34); + output.WriteMessage(CommitRequest); + } + if (requestCase_ == RequestOneofCase.RollbackRequest) { + output.WriteRawTag(42); + output.WriteMessage(RollbackRequest); + } + if (requestCase_ == RequestOneofCase.WriteMutationsRequest) { + output.WriteRawTag(50); + output.WriteMessage(WriteMutationsRequest); + } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } @@ -3809,6 +4224,21 @@ public int CalculateSize() { if (requestCase_ == RequestOneofCase.ExecuteRequest) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(ExecuteRequest); } + if (requestCase_ == RequestOneofCase.ExecuteBatchRequest) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ExecuteBatchRequest); + } + if (requestCase_ == RequestOneofCase.BeginTransactionRequest) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(BeginTransactionRequest); + } + if (requestCase_ == RequestOneofCase.CommitRequest) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(CommitRequest); + } + if (requestCase_ == RequestOneofCase.RollbackRequest) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(RollbackRequest); + } + if (requestCase_ == RequestOneofCase.WriteMutationsRequest) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(WriteMutationsRequest); + } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -3828,6 +4258,36 @@ public void MergeFrom(ConnectionStreamRequest other) { } ExecuteRequest.MergeFrom(other.ExecuteRequest); break; + case RequestOneofCase.ExecuteBatchRequest: + if (ExecuteBatchRequest == null) { + ExecuteBatchRequest = new global::Google.Cloud.SpannerLib.V1.ExecuteBatchRequest(); + } + ExecuteBatchRequest.MergeFrom(other.ExecuteBatchRequest); + break; + case RequestOneofCase.BeginTransactionRequest: + if (BeginTransactionRequest == null) { + BeginTransactionRequest = new global::Google.Cloud.SpannerLib.V1.BeginTransactionRequest(); + } + BeginTransactionRequest.MergeFrom(other.BeginTransactionRequest); + break; + case RequestOneofCase.CommitRequest: + if (CommitRequest == null) { + CommitRequest = new global::Google.Cloud.SpannerLib.V1.Connection(); + } + CommitRequest.MergeFrom(other.CommitRequest); + break; + case RequestOneofCase.RollbackRequest: + if (RollbackRequest == null) { + RollbackRequest = new global::Google.Cloud.SpannerLib.V1.Connection(); + } + RollbackRequest.MergeFrom(other.RollbackRequest); + break; + case RequestOneofCase.WriteMutationsRequest: + if (WriteMutationsRequest == null) { + WriteMutationsRequest = new global::Google.Cloud.SpannerLib.V1.WriteMutationsRequest(); + } + WriteMutationsRequest.MergeFrom(other.WriteMutationsRequest); + break; } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); @@ -3858,6 +4318,51 @@ public void MergeFrom(pb::CodedInputStream input) { ExecuteRequest = subBuilder; break; } + case 18: { + global::Google.Cloud.SpannerLib.V1.ExecuteBatchRequest subBuilder = new global::Google.Cloud.SpannerLib.V1.ExecuteBatchRequest(); + if (requestCase_ == RequestOneofCase.ExecuteBatchRequest) { + subBuilder.MergeFrom(ExecuteBatchRequest); + } + input.ReadMessage(subBuilder); + ExecuteBatchRequest = subBuilder; + break; + } + case 26: { + global::Google.Cloud.SpannerLib.V1.BeginTransactionRequest subBuilder = new global::Google.Cloud.SpannerLib.V1.BeginTransactionRequest(); + if (requestCase_ == RequestOneofCase.BeginTransactionRequest) { + subBuilder.MergeFrom(BeginTransactionRequest); + } + input.ReadMessage(subBuilder); + BeginTransactionRequest = subBuilder; + break; + } + case 34: { + global::Google.Cloud.SpannerLib.V1.Connection subBuilder = new global::Google.Cloud.SpannerLib.V1.Connection(); + if (requestCase_ == RequestOneofCase.CommitRequest) { + subBuilder.MergeFrom(CommitRequest); + } + input.ReadMessage(subBuilder); + CommitRequest = subBuilder; + break; + } + case 42: { + global::Google.Cloud.SpannerLib.V1.Connection subBuilder = new global::Google.Cloud.SpannerLib.V1.Connection(); + if (requestCase_ == RequestOneofCase.RollbackRequest) { + subBuilder.MergeFrom(RollbackRequest); + } + input.ReadMessage(subBuilder); + RollbackRequest = subBuilder; + break; + } + case 50: { + global::Google.Cloud.SpannerLib.V1.WriteMutationsRequest subBuilder = new global::Google.Cloud.SpannerLib.V1.WriteMutationsRequest(); + if (requestCase_ == RequestOneofCase.WriteMutationsRequest) { + subBuilder.MergeFrom(WriteMutationsRequest); + } + input.ReadMessage(subBuilder); + WriteMutationsRequest = subBuilder; + break; + } } } #endif @@ -3886,6 +4391,51 @@ public void MergeFrom(pb::CodedInputStream input) { ExecuteRequest = subBuilder; break; } + case 18: { + global::Google.Cloud.SpannerLib.V1.ExecuteBatchRequest subBuilder = new global::Google.Cloud.SpannerLib.V1.ExecuteBatchRequest(); + if (requestCase_ == RequestOneofCase.ExecuteBatchRequest) { + subBuilder.MergeFrom(ExecuteBatchRequest); + } + input.ReadMessage(subBuilder); + ExecuteBatchRequest = subBuilder; + break; + } + case 26: { + global::Google.Cloud.SpannerLib.V1.BeginTransactionRequest subBuilder = new global::Google.Cloud.SpannerLib.V1.BeginTransactionRequest(); + if (requestCase_ == RequestOneofCase.BeginTransactionRequest) { + subBuilder.MergeFrom(BeginTransactionRequest); + } + input.ReadMessage(subBuilder); + BeginTransactionRequest = subBuilder; + break; + } + case 34: { + global::Google.Cloud.SpannerLib.V1.Connection subBuilder = new global::Google.Cloud.SpannerLib.V1.Connection(); + if (requestCase_ == RequestOneofCase.CommitRequest) { + subBuilder.MergeFrom(CommitRequest); + } + input.ReadMessage(subBuilder); + CommitRequest = subBuilder; + break; + } + case 42: { + global::Google.Cloud.SpannerLib.V1.Connection subBuilder = new global::Google.Cloud.SpannerLib.V1.Connection(); + if (requestCase_ == RequestOneofCase.RollbackRequest) { + subBuilder.MergeFrom(RollbackRequest); + } + input.ReadMessage(subBuilder); + RollbackRequest = subBuilder; + break; + } + case 50: { + global::Google.Cloud.SpannerLib.V1.WriteMutationsRequest subBuilder = new global::Google.Cloud.SpannerLib.V1.WriteMutationsRequest(); + if (requestCase_ == RequestOneofCase.WriteMutationsRequest) { + subBuilder.MergeFrom(WriteMutationsRequest); + } + input.ReadMessage(subBuilder); + WriteMutationsRequest = subBuilder; + break; + } } } } @@ -3893,22 +4443,32 @@ public void MergeFrom(pb::CodedInputStream input) { } + /// + /// ExecuteResponse is returned by the server when it receives an ExecuteRequest on a bi-directional + /// ConnectionStream. The response contains the first N rows, the metadata, and an indication whether + /// the result contains more data than in the initial response. The client should fetch the remaining + /// data by calling the ContinueStreaming RPC. This will start a separate server stream with the + /// remaining results. The client can continue to send additional requests on the ConnectionStream + /// while the additional server stream is open. + /// + /// The initial response also contains the ResultSetStats if there is no more data to be returned. + /// [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] - public sealed partial class ConnectionStreamResponse : pb::IMessage + public sealed partial class ExecuteResponse : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ConnectionStreamResponse()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ExecuteResponse()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Cloud.SpannerLib.V1.SpannerlibReflection.Descriptor.MessageTypes[16]; } + get { return global::Google.Cloud.SpannerLib.V1.SpannerlibReflection.Descriptor.MessageTypes[17]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3919,7 +4479,7 @@ public sealed partial class ConnectionStreamResponse : pb::IMessageField number for the "row" field. - public const int RowFieldNumber = 1; + /// Field number for the "rows" field. + public const int RowsFieldNumber = 1; + private global::Google.Cloud.SpannerLib.V1.Rows rows_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public global::Google.Cloud.Spanner.V1.PartialResultSet Row { - get { return responseCase_ == ResponseOneofCase.Row ? (global::Google.Cloud.Spanner.V1.PartialResultSet) response_ : null; } + public global::Google.Cloud.SpannerLib.V1.Rows Rows { + get { return rows_; } set { - response_ = value; - responseCase_ = value == null ? ResponseOneofCase.None : ResponseOneofCase.Row; + rows_ = value; } } - private object response_; - /// Enum of possible cases for the "response" oneof. - public enum ResponseOneofCase { - None = 0, - Row = 1, + /// Field number for the "result_sets" field. + public const int ResultSetsFieldNumber = 2; + private static readonly pb::FieldCodec _repeated_resultSets_codec + = pb::FieldCodec.ForMessage(18, global::Google.Cloud.Spanner.V1.ResultSet.Parser); + private readonly pbc::RepeatedField resultSets_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField ResultSets { + get { return resultSets_; } } - private ResponseOneofCase responseCase_ = ResponseOneofCase.None; + + /// Field number for the "status" field. + public const int StatusFieldNumber = 3; + private global::Google.Rpc.Status status_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public ResponseOneofCase ResponseCase { - get { return responseCase_; } + public global::Google.Rpc.Status Status { + get { return status_; } + set { + status_ = value; + } } + /// Field number for the "has_more_results" field. + public const int HasMoreResultsFieldNumber = 4; + private bool hasMoreResults_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void ClearResponse() { - responseCase_ = ResponseOneofCase.None; - response_ = null; + public bool HasMoreResults { + get { return hasMoreResults_; } + set { + hasMoreResults_ = value; + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { - return Equals(other as ConnectionStreamResponse); + return Equals(other as ExecuteResponse); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Equals(ConnectionStreamResponse other) { + public bool Equals(ExecuteResponse other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } - if (!object.Equals(Row, other.Row)) return false; - if (ResponseCase != other.ResponseCase) return false; + if (!object.Equals(Rows, other.Rows)) return false; + if(!resultSets_.Equals(other.resultSets_)) return false; + if (!object.Equals(Status, other.Status)) return false; + if (HasMoreResults != other.HasMoreResults) return false; return Equals(_unknownFields, other._unknownFields); } @@ -3999,8 +4574,10 @@ public bool Equals(ConnectionStreamResponse other) { [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; - if (responseCase_ == ResponseOneofCase.Row) hash ^= Row.GetHashCode(); - hash ^= (int) responseCase_; + if (rows_ != null) hash ^= Rows.GetHashCode(); + hash ^= resultSets_.GetHashCode(); + if (status_ != null) hash ^= Status.GetHashCode(); + if (HasMoreResults != false) hash ^= HasMoreResults.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -4019,9 +4596,18 @@ public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else - if (responseCase_ == ResponseOneofCase.Row) { + if (rows_ != null) { output.WriteRawTag(10); - output.WriteMessage(Row); + output.WriteMessage(Rows); + } + resultSets_.WriteTo(output, _repeated_resultSets_codec); + if (status_ != null) { + output.WriteRawTag(26); + output.WriteMessage(Status); + } + if (HasMoreResults != false) { + output.WriteRawTag(32); + output.WriteBool(HasMoreResults); } if (_unknownFields != null) { _unknownFields.WriteTo(output); @@ -4033,9 +4619,18 @@ public void WriteTo(pb::CodedOutputStream output) { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (responseCase_ == ResponseOneofCase.Row) { + if (rows_ != null) { output.WriteRawTag(10); - output.WriteMessage(Row); + output.WriteMessage(Rows); + } + resultSets_.WriteTo(ref output, _repeated_resultSets_codec); + if (status_ != null) { + output.WriteRawTag(26); + output.WriteMessage(Status); + } + if (HasMoreResults != false) { + output.WriteRawTag(32); + output.WriteBool(HasMoreResults); } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); @@ -4047,8 +4642,15 @@ public void WriteTo(pb::CodedOutputStream output) { [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; - if (responseCase_ == ResponseOneofCase.Row) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Row); + if (rows_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Rows); + } + size += resultSets_.CalculateSize(_repeated_resultSets_codec); + if (status_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Status); + } + if (HasMoreResults != false) { + size += 1 + 1; } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); @@ -4058,16 +4660,510 @@ public int CalculateSize() { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(ConnectionStreamResponse other) { + public void MergeFrom(ExecuteResponse other) { if (other == null) { return; } + if (other.rows_ != null) { + if (rows_ == null) { + Rows = new global::Google.Cloud.SpannerLib.V1.Rows(); + } + Rows.MergeFrom(other.Rows); + } + resultSets_.Add(other.resultSets_); + if (other.status_ != null) { + if (status_ == null) { + Status = new global::Google.Rpc.Status(); + } + Status.MergeFrom(other.Status); + } + if (other.HasMoreResults != false) { + HasMoreResults = other.HasMoreResults; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (rows_ == null) { + Rows = new global::Google.Cloud.SpannerLib.V1.Rows(); + } + input.ReadMessage(Rows); + break; + } + case 18: { + resultSets_.AddEntriesFrom(input, _repeated_resultSets_codec); + break; + } + case 26: { + if (status_ == null) { + Status = new global::Google.Rpc.Status(); + } + input.ReadMessage(Status); + break; + } + case 32: { + HasMoreResults = input.ReadBool(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (rows_ == null) { + Rows = new global::Google.Cloud.SpannerLib.V1.Rows(); + } + input.ReadMessage(Rows); + break; + } + case 18: { + resultSets_.AddEntriesFrom(ref input, _repeated_resultSets_codec); + break; + } + case 26: { + if (status_ == null) { + Status = new global::Google.Rpc.Status(); + } + input.ReadMessage(Status); + break; + } + case 32: { + HasMoreResults = input.ReadBool(); + break; + } + } + } + } + #endif + + } + + /// + /// ConnectionStreamResponse is returned by the server when it receives a ConnectionStreamRequest. + /// The contents of the response depends on the request that the client sent. + /// + /// The response contains a Status that indicates whether the request succeeded or not. The stream + /// itself normally does not return an error if a request fails. + /// The stream only returns an error and is discontinued in case of a network error or other + /// unexpected internal errors. + /// + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class ConnectionStreamResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ConnectionStreamResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Google.Cloud.SpannerLib.V1.SpannerlibReflection.Descriptor.MessageTypes[18]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ConnectionStreamResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ConnectionStreamResponse(ConnectionStreamResponse other) : this() { + status_ = other.status_ != null ? other.status_.Clone() : null; + switch (other.ResponseCase) { + case ResponseOneofCase.ExecuteResponse: + ExecuteResponse = other.ExecuteResponse.Clone(); + break; + case ResponseOneofCase.ExecuteBatchResponse: + ExecuteBatchResponse = other.ExecuteBatchResponse.Clone(); + break; + case ResponseOneofCase.BeginTransactionResponse: + BeginTransactionResponse = other.BeginTransactionResponse.Clone(); + break; + case ResponseOneofCase.CommitResponse: + CommitResponse = other.CommitResponse.Clone(); + break; + case ResponseOneofCase.RollbackResponse: + RollbackResponse = other.RollbackResponse.Clone(); + break; + case ResponseOneofCase.WriteMutationsResponse: + WriteMutationsResponse = other.WriteMutationsResponse.Clone(); + break; + } + + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ConnectionStreamResponse Clone() { + return new ConnectionStreamResponse(this); + } + + /// Field number for the "status" field. + public const int StatusFieldNumber = 1; + private global::Google.Rpc.Status status_; + /// + /// Status indicates whether the request succeeded or failed. The response field only contains + /// a value if the status code is OK. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Google.Rpc.Status Status { + get { return status_; } + set { + status_ = value; + } + } + + /// Field number for the "execute_response" field. + public const int ExecuteResponseFieldNumber = 2; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Google.Cloud.SpannerLib.V1.ExecuteResponse ExecuteResponse { + get { return responseCase_ == ResponseOneofCase.ExecuteResponse ? (global::Google.Cloud.SpannerLib.V1.ExecuteResponse) response_ : null; } + set { + response_ = value; + responseCase_ = value == null ? ResponseOneofCase.None : ResponseOneofCase.ExecuteResponse; + } + } + + /// Field number for the "execute_batch_response" field. + public const int ExecuteBatchResponseFieldNumber = 3; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Google.Cloud.Spanner.V1.ExecuteBatchDmlResponse ExecuteBatchResponse { + get { return responseCase_ == ResponseOneofCase.ExecuteBatchResponse ? (global::Google.Cloud.Spanner.V1.ExecuteBatchDmlResponse) response_ : null; } + set { + response_ = value; + responseCase_ = value == null ? ResponseOneofCase.None : ResponseOneofCase.ExecuteBatchResponse; + } + } + + /// Field number for the "begin_transaction_response" field. + public const int BeginTransactionResponseFieldNumber = 4; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Google.Protobuf.WellKnownTypes.Empty BeginTransactionResponse { + get { return responseCase_ == ResponseOneofCase.BeginTransactionResponse ? (global::Google.Protobuf.WellKnownTypes.Empty) response_ : null; } + set { + response_ = value; + responseCase_ = value == null ? ResponseOneofCase.None : ResponseOneofCase.BeginTransactionResponse; + } + } + + /// Field number for the "commit_response" field. + public const int CommitResponseFieldNumber = 5; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Google.Cloud.Spanner.V1.CommitResponse CommitResponse { + get { return responseCase_ == ResponseOneofCase.CommitResponse ? (global::Google.Cloud.Spanner.V1.CommitResponse) response_ : null; } + set { + response_ = value; + responseCase_ = value == null ? ResponseOneofCase.None : ResponseOneofCase.CommitResponse; + } + } + + /// Field number for the "rollback_response" field. + public const int RollbackResponseFieldNumber = 6; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Google.Protobuf.WellKnownTypes.Empty RollbackResponse { + get { return responseCase_ == ResponseOneofCase.RollbackResponse ? (global::Google.Protobuf.WellKnownTypes.Empty) response_ : null; } + set { + response_ = value; + responseCase_ = value == null ? ResponseOneofCase.None : ResponseOneofCase.RollbackResponse; + } + } + + /// Field number for the "write_mutations_response" field. + public const int WriteMutationsResponseFieldNumber = 7; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Google.Cloud.Spanner.V1.CommitResponse WriteMutationsResponse { + get { return responseCase_ == ResponseOneofCase.WriteMutationsResponse ? (global::Google.Cloud.Spanner.V1.CommitResponse) response_ : null; } + set { + response_ = value; + responseCase_ = value == null ? ResponseOneofCase.None : ResponseOneofCase.WriteMutationsResponse; + } + } + + private object response_; + /// Enum of possible cases for the "response" oneof. + public enum ResponseOneofCase { + None = 0, + ExecuteResponse = 2, + ExecuteBatchResponse = 3, + BeginTransactionResponse = 4, + CommitResponse = 5, + RollbackResponse = 6, + WriteMutationsResponse = 7, + } + private ResponseOneofCase responseCase_ = ResponseOneofCase.None; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ResponseOneofCase ResponseCase { + get { return responseCase_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void ClearResponse() { + responseCase_ = ResponseOneofCase.None; + response_ = null; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as ConnectionStreamResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(ConnectionStreamResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(Status, other.Status)) return false; + if (!object.Equals(ExecuteResponse, other.ExecuteResponse)) return false; + if (!object.Equals(ExecuteBatchResponse, other.ExecuteBatchResponse)) return false; + if (!object.Equals(BeginTransactionResponse, other.BeginTransactionResponse)) return false; + if (!object.Equals(CommitResponse, other.CommitResponse)) return false; + if (!object.Equals(RollbackResponse, other.RollbackResponse)) return false; + if (!object.Equals(WriteMutationsResponse, other.WriteMutationsResponse)) return false; + if (ResponseCase != other.ResponseCase) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (status_ != null) hash ^= Status.GetHashCode(); + if (responseCase_ == ResponseOneofCase.ExecuteResponse) hash ^= ExecuteResponse.GetHashCode(); + if (responseCase_ == ResponseOneofCase.ExecuteBatchResponse) hash ^= ExecuteBatchResponse.GetHashCode(); + if (responseCase_ == ResponseOneofCase.BeginTransactionResponse) hash ^= BeginTransactionResponse.GetHashCode(); + if (responseCase_ == ResponseOneofCase.CommitResponse) hash ^= CommitResponse.GetHashCode(); + if (responseCase_ == ResponseOneofCase.RollbackResponse) hash ^= RollbackResponse.GetHashCode(); + if (responseCase_ == ResponseOneofCase.WriteMutationsResponse) hash ^= WriteMutationsResponse.GetHashCode(); + hash ^= (int) responseCase_; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (status_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Status); + } + if (responseCase_ == ResponseOneofCase.ExecuteResponse) { + output.WriteRawTag(18); + output.WriteMessage(ExecuteResponse); + } + if (responseCase_ == ResponseOneofCase.ExecuteBatchResponse) { + output.WriteRawTag(26); + output.WriteMessage(ExecuteBatchResponse); + } + if (responseCase_ == ResponseOneofCase.BeginTransactionResponse) { + output.WriteRawTag(34); + output.WriteMessage(BeginTransactionResponse); + } + if (responseCase_ == ResponseOneofCase.CommitResponse) { + output.WriteRawTag(42); + output.WriteMessage(CommitResponse); + } + if (responseCase_ == ResponseOneofCase.RollbackResponse) { + output.WriteRawTag(50); + output.WriteMessage(RollbackResponse); + } + if (responseCase_ == ResponseOneofCase.WriteMutationsResponse) { + output.WriteRawTag(58); + output.WriteMessage(WriteMutationsResponse); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (status_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Status); + } + if (responseCase_ == ResponseOneofCase.ExecuteResponse) { + output.WriteRawTag(18); + output.WriteMessage(ExecuteResponse); + } + if (responseCase_ == ResponseOneofCase.ExecuteBatchResponse) { + output.WriteRawTag(26); + output.WriteMessage(ExecuteBatchResponse); + } + if (responseCase_ == ResponseOneofCase.BeginTransactionResponse) { + output.WriteRawTag(34); + output.WriteMessage(BeginTransactionResponse); + } + if (responseCase_ == ResponseOneofCase.CommitResponse) { + output.WriteRawTag(42); + output.WriteMessage(CommitResponse); + } + if (responseCase_ == ResponseOneofCase.RollbackResponse) { + output.WriteRawTag(50); + output.WriteMessage(RollbackResponse); + } + if (responseCase_ == ResponseOneofCase.WriteMutationsResponse) { + output.WriteRawTag(58); + output.WriteMessage(WriteMutationsResponse); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (status_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Status); + } + if (responseCase_ == ResponseOneofCase.ExecuteResponse) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ExecuteResponse); + } + if (responseCase_ == ResponseOneofCase.ExecuteBatchResponse) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ExecuteBatchResponse); + } + if (responseCase_ == ResponseOneofCase.BeginTransactionResponse) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(BeginTransactionResponse); + } + if (responseCase_ == ResponseOneofCase.CommitResponse) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(CommitResponse); + } + if (responseCase_ == ResponseOneofCase.RollbackResponse) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(RollbackResponse); + } + if (responseCase_ == ResponseOneofCase.WriteMutationsResponse) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(WriteMutationsResponse); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(ConnectionStreamResponse other) { + if (other == null) { + return; + } + if (other.status_ != null) { + if (status_ == null) { + Status = new global::Google.Rpc.Status(); + } + Status.MergeFrom(other.Status); + } switch (other.ResponseCase) { - case ResponseOneofCase.Row: - if (Row == null) { - Row = new global::Google.Cloud.Spanner.V1.PartialResultSet(); + case ResponseOneofCase.ExecuteResponse: + if (ExecuteResponse == null) { + ExecuteResponse = new global::Google.Cloud.SpannerLib.V1.ExecuteResponse(); + } + ExecuteResponse.MergeFrom(other.ExecuteResponse); + break; + case ResponseOneofCase.ExecuteBatchResponse: + if (ExecuteBatchResponse == null) { + ExecuteBatchResponse = new global::Google.Cloud.Spanner.V1.ExecuteBatchDmlResponse(); } - Row.MergeFrom(other.Row); + ExecuteBatchResponse.MergeFrom(other.ExecuteBatchResponse); + break; + case ResponseOneofCase.BeginTransactionResponse: + if (BeginTransactionResponse == null) { + BeginTransactionResponse = new global::Google.Protobuf.WellKnownTypes.Empty(); + } + BeginTransactionResponse.MergeFrom(other.BeginTransactionResponse); + break; + case ResponseOneofCase.CommitResponse: + if (CommitResponse == null) { + CommitResponse = new global::Google.Cloud.Spanner.V1.CommitResponse(); + } + CommitResponse.MergeFrom(other.CommitResponse); + break; + case ResponseOneofCase.RollbackResponse: + if (RollbackResponse == null) { + RollbackResponse = new global::Google.Protobuf.WellKnownTypes.Empty(); + } + RollbackResponse.MergeFrom(other.RollbackResponse); + break; + case ResponseOneofCase.WriteMutationsResponse: + if (WriteMutationsResponse == null) { + WriteMutationsResponse = new global::Google.Cloud.Spanner.V1.CommitResponse(); + } + WriteMutationsResponse.MergeFrom(other.WriteMutationsResponse); break; } @@ -4091,12 +5187,64 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { - global::Google.Cloud.Spanner.V1.PartialResultSet subBuilder = new global::Google.Cloud.Spanner.V1.PartialResultSet(); - if (responseCase_ == ResponseOneofCase.Row) { - subBuilder.MergeFrom(Row); + if (status_ == null) { + Status = new global::Google.Rpc.Status(); + } + input.ReadMessage(Status); + break; + } + case 18: { + global::Google.Cloud.SpannerLib.V1.ExecuteResponse subBuilder = new global::Google.Cloud.SpannerLib.V1.ExecuteResponse(); + if (responseCase_ == ResponseOneofCase.ExecuteResponse) { + subBuilder.MergeFrom(ExecuteResponse); } input.ReadMessage(subBuilder); - Row = subBuilder; + ExecuteResponse = subBuilder; + break; + } + case 26: { + global::Google.Cloud.Spanner.V1.ExecuteBatchDmlResponse subBuilder = new global::Google.Cloud.Spanner.V1.ExecuteBatchDmlResponse(); + if (responseCase_ == ResponseOneofCase.ExecuteBatchResponse) { + subBuilder.MergeFrom(ExecuteBatchResponse); + } + input.ReadMessage(subBuilder); + ExecuteBatchResponse = subBuilder; + break; + } + case 34: { + global::Google.Protobuf.WellKnownTypes.Empty subBuilder = new global::Google.Protobuf.WellKnownTypes.Empty(); + if (responseCase_ == ResponseOneofCase.BeginTransactionResponse) { + subBuilder.MergeFrom(BeginTransactionResponse); + } + input.ReadMessage(subBuilder); + BeginTransactionResponse = subBuilder; + break; + } + case 42: { + global::Google.Cloud.Spanner.V1.CommitResponse subBuilder = new global::Google.Cloud.Spanner.V1.CommitResponse(); + if (responseCase_ == ResponseOneofCase.CommitResponse) { + subBuilder.MergeFrom(CommitResponse); + } + input.ReadMessage(subBuilder); + CommitResponse = subBuilder; + break; + } + case 50: { + global::Google.Protobuf.WellKnownTypes.Empty subBuilder = new global::Google.Protobuf.WellKnownTypes.Empty(); + if (responseCase_ == ResponseOneofCase.RollbackResponse) { + subBuilder.MergeFrom(RollbackResponse); + } + input.ReadMessage(subBuilder); + RollbackResponse = subBuilder; + break; + } + case 58: { + global::Google.Cloud.Spanner.V1.CommitResponse subBuilder = new global::Google.Cloud.Spanner.V1.CommitResponse(); + if (responseCase_ == ResponseOneofCase.WriteMutationsResponse) { + subBuilder.MergeFrom(WriteMutationsResponse); + } + input.ReadMessage(subBuilder); + WriteMutationsResponse = subBuilder; break; } } @@ -4119,12 +5267,64 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 10: { - global::Google.Cloud.Spanner.V1.PartialResultSet subBuilder = new global::Google.Cloud.Spanner.V1.PartialResultSet(); - if (responseCase_ == ResponseOneofCase.Row) { - subBuilder.MergeFrom(Row); + if (status_ == null) { + Status = new global::Google.Rpc.Status(); + } + input.ReadMessage(Status); + break; + } + case 18: { + global::Google.Cloud.SpannerLib.V1.ExecuteResponse subBuilder = new global::Google.Cloud.SpannerLib.V1.ExecuteResponse(); + if (responseCase_ == ResponseOneofCase.ExecuteResponse) { + subBuilder.MergeFrom(ExecuteResponse); + } + input.ReadMessage(subBuilder); + ExecuteResponse = subBuilder; + break; + } + case 26: { + global::Google.Cloud.Spanner.V1.ExecuteBatchDmlResponse subBuilder = new global::Google.Cloud.Spanner.V1.ExecuteBatchDmlResponse(); + if (responseCase_ == ResponseOneofCase.ExecuteBatchResponse) { + subBuilder.MergeFrom(ExecuteBatchResponse); + } + input.ReadMessage(subBuilder); + ExecuteBatchResponse = subBuilder; + break; + } + case 34: { + global::Google.Protobuf.WellKnownTypes.Empty subBuilder = new global::Google.Protobuf.WellKnownTypes.Empty(); + if (responseCase_ == ResponseOneofCase.BeginTransactionResponse) { + subBuilder.MergeFrom(BeginTransactionResponse); + } + input.ReadMessage(subBuilder); + BeginTransactionResponse = subBuilder; + break; + } + case 42: { + global::Google.Cloud.Spanner.V1.CommitResponse subBuilder = new global::Google.Cloud.Spanner.V1.CommitResponse(); + if (responseCase_ == ResponseOneofCase.CommitResponse) { + subBuilder.MergeFrom(CommitResponse); + } + input.ReadMessage(subBuilder); + CommitResponse = subBuilder; + break; + } + case 50: { + global::Google.Protobuf.WellKnownTypes.Empty subBuilder = new global::Google.Protobuf.WellKnownTypes.Empty(); + if (responseCase_ == ResponseOneofCase.RollbackResponse) { + subBuilder.MergeFrom(RollbackResponse); + } + input.ReadMessage(subBuilder); + RollbackResponse = subBuilder; + break; + } + case 58: { + global::Google.Cloud.Spanner.V1.CommitResponse subBuilder = new global::Google.Cloud.Spanner.V1.CommitResponse(); + if (responseCase_ == ResponseOneofCase.WriteMutationsResponse) { + subBuilder.MergeFrom(WriteMutationsResponse); } input.ReadMessage(subBuilder); - Row = subBuilder; + WriteMutationsResponse = subBuilder; break; } } diff --git a/spannerlib/wrappers/spannerlib-dotnet/spannerlib-dotnet-grpc-v1/SpannerlibGrpc.cs b/spannerlib/wrappers/spannerlib-dotnet/spannerlib-dotnet-grpc-v1/SpannerlibGrpc.cs index 6814c717..0ac5edae 100644 --- a/spannerlib/wrappers/spannerlib-dotnet/spannerlib-dotnet-grpc-v1/SpannerlibGrpc.cs +++ b/spannerlib/wrappers/spannerlib-dotnet/spannerlib-dotnet-grpc-v1/SpannerlibGrpc.cs @@ -232,6 +232,14 @@ static T __Helper_DeserializeMessage(grpc::DeserializationContext context, gl __Marshaller_google_spannerlib_v1_ConnectionStreamRequest, __Marshaller_google_spannerlib_v1_ConnectionStreamResponse); + [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)] + static readonly grpc::Method __Method_ContinueStreaming = new grpc::Method( + grpc::MethodType.ServerStreaming, + __ServiceName, + "ContinueStreaming", + __Marshaller_google_spannerlib_v1_Rows, + __Marshaller_google_spannerlib_v1_RowData); + /// Service descriptor public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor { @@ -595,16 +603,62 @@ protected SpannerLibClient(ClientBaseConfiguration configuration) : base(configu { return CallInvoker.AsyncUnaryCall(__Method_WriteMutations, null, options, request); } + /// + /// ConnectionStream opens a bi-directional gRPC stream between the client and the server. + /// This stream can be re-used by the client for multiple requests, and normally gives the + /// lowest possible latency, at the cost of a slightly more complex API. + /// + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The call object. [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)] public virtual grpc::AsyncDuplexStreamingCall ConnectionStream(grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) { return ConnectionStream(new grpc::CallOptions(headers, deadline, cancellationToken)); } + /// + /// ConnectionStream opens a bi-directional gRPC stream between the client and the server. + /// This stream can be re-used by the client for multiple requests, and normally gives the + /// lowest possible latency, at the cost of a slightly more complex API. + /// + /// The options for the call. + /// The call object. [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)] public virtual grpc::AsyncDuplexStreamingCall ConnectionStream(grpc::CallOptions options) { return CallInvoker.AsyncDuplexStreamingCall(__Method_ConnectionStream, null, options); } + /// + /// ContinueStreaming returns a server stream that returns the remaining rows of a SQL statement + /// that has previously been executed using a ConnectionStreamRequest on a bi-directional + /// ConnectionStream. The client is responsible for calling this RPC if the has_more_data flag + /// of the ExecuteResponse was true. + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The call object. + [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)] + public virtual grpc::AsyncServerStreamingCall ContinueStreaming(global::Google.Cloud.SpannerLib.V1.Rows request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return ContinueStreaming(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// ContinueStreaming returns a server stream that returns the remaining rows of a SQL statement + /// that has previously been executed using a ConnectionStreamRequest on a bi-directional + /// ConnectionStream. The client is responsible for calling this RPC if the has_more_data flag + /// of the ExecuteResponse was true. + /// + /// The request to send to the server. + /// The options for the call. + /// The call object. + [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)] + public virtual grpc::AsyncServerStreamingCall ContinueStreaming(global::Google.Cloud.SpannerLib.V1.Rows request, grpc::CallOptions options) + { + return CallInvoker.AsyncServerStreamingCall(__Method_ContinueStreaming, null, options, request); + } /// Creates a new instance of client from given ClientBaseConfiguration. [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)] protected override SpannerLibClient NewInstance(ClientBaseConfiguration configuration) diff --git a/spannerlib/wrappers/spannerlib-dotnet/spannerlib-dotnet-native-impl/SharedLibSpanner.cs b/spannerlib/wrappers/spannerlib-dotnet/spannerlib-dotnet-native-impl/SharedLibSpanner.cs index 0bfef295..0883c910 100644 --- a/spannerlib/wrappers/spannerlib-dotnet/spannerlib-dotnet-native-impl/SharedLibSpanner.cs +++ b/spannerlib/wrappers/spannerlib-dotnet/spannerlib-dotnet-native-impl/SharedLibSpanner.cs @@ -111,7 +111,7 @@ public void CloseConnection(Connection connection) return await Task.Run(() => WriteMutations(connection, mutations), cancellationToken).ConfigureAwait(false); } - public Rows Execute(Connection connection, ExecuteSqlRequest statement) + public Rows Execute(Connection connection, ExecuteSqlRequest statement, int prefetchRows = 0) { using var handler = ExecuteLibraryFunction(() => { @@ -122,7 +122,7 @@ public Rows Execute(Connection connection, ExecuteSqlRequest statement) return new Rows(connection, handler.ObjectId()); } - public async Task ExecuteAsync(Connection connection, ExecuteSqlRequest statement, CancellationToken cancellationToken) + public async Task ExecuteAsync(Connection connection, ExecuteSqlRequest statement, int prefetchRows = 0, CancellationToken cancellationToken = default) { return await Task.Run(() => Execute(connection, statement), cancellationToken).ConfigureAwait(false); } @@ -225,6 +225,12 @@ public void BeginTransaction(Connection connection, TransactionOptions transacti }); } + public Task BeginTransactionAsync(Connection connection, TransactionOptions transactionOptions, + CancellationToken cancellationToken = default) + { + return Task.Run(() => BeginTransaction(connection, transactionOptions), cancellationToken); + } + public CommitResponse? Commit(Connection connection) { using var handler = ExecuteLibraryFunction(() => SpannerLib.Commit(connection.Pool.Id, connection.Id)); diff --git a/spannerlib/wrappers/spannerlib-dotnet/spannerlib-dotnet-tests/AbstractMockServerTests.cs b/spannerlib/wrappers/spannerlib-dotnet/spannerlib-dotnet-tests/AbstractMockServerTests.cs index a98b679b..adae4949 100644 --- a/spannerlib/wrappers/spannerlib-dotnet/spannerlib-dotnet-tests/AbstractMockServerTests.cs +++ b/spannerlib/wrappers/spannerlib-dotnet/spannerlib-dotnet-tests/AbstractMockServerTests.cs @@ -26,12 +26,16 @@ public enum LibType Shared, Grpc, GrpcTcp, + GrpcBidi, } protected readonly Dictionary SpannerLibDictionary = new([ - new KeyValuePair(LibType.Shared, new SharedLibSpanner()), - new KeyValuePair(LibType.Grpc, new GrpcLibSpanner()), - new KeyValuePair(LibType.GrpcTcp, new GrpcLibSpanner(addressType: Server.AddressType.Tcp)), + (Environment.GetEnvironmentVariable("SKIP_SHARED_LIB_TESTS") ?? "").Equals("true") + ? new KeyValuePair(LibType.Shared, new GrpcLibSpanner()) + : new KeyValuePair(LibType.Shared, new SharedLibSpanner()), + new KeyValuePair(LibType.Grpc, new GrpcLibSpanner(communicationStyle: GrpcLibSpanner.CommunicationStyle.ServerStreaming)), + new KeyValuePair(LibType.GrpcTcp, new GrpcLibSpanner(communicationStyle: GrpcLibSpanner.CommunicationStyle.ServerStreaming, addressType: Server.AddressType.Tcp)), + new KeyValuePair(LibType.GrpcBidi, new GrpcLibSpanner(communicationStyle: GrpcLibSpanner.CommunicationStyle.BidiStreaming)), ]); protected SpannerMockServerFixture Fixture; diff --git a/spannerlib/wrappers/spannerlib-dotnet/spannerlib-dotnet-tests/RowsTests.cs b/spannerlib/wrappers/spannerlib-dotnet/spannerlib-dotnet-tests/RowsTests.cs index d7222722..d5411ee9 100644 --- a/spannerlib/wrappers/spannerlib-dotnet/spannerlib-dotnet-tests/RowsTests.cs +++ b/spannerlib/wrappers/spannerlib-dotnet/spannerlib-dotnet-tests/RowsTests.cs @@ -61,7 +61,7 @@ public void TestEmptyResults([Values] LibType libType) } [Test] - public void TestRandomResults([Values] LibType libType, [Values(0, 1, 10)] int numRows) + public void TestRandomResults([Values] LibType libType, [Values(0, 1, 10)] int numRows, [Values(0, 1, 5, 9, 10, 11)] int prefetchRows) { var rowType = RandomResultSetGenerator.GenerateAllTypesRowType(); var results = RandomResultSetGenerator.Generate(rowType, numRows); @@ -69,7 +69,7 @@ public void TestRandomResults([Values] LibType libType, [Values(0, 1, 10)] int n using var pool = Pool.Create(SpannerLibDictionary[libType], ConnectionString); using var connection = pool.CreateConnection(); - using var rows = connection.Execute(new ExecuteSqlRequest { Sql = "select * from random" }); + using var rows = connection.Execute(new ExecuteSqlRequest { Sql = "select * from random" }, prefetchRows); var rowCount = 0; while (rows.Next() is { } row) @@ -107,7 +107,7 @@ public void TestLargeStringValue([Values] LibType libType) } [Test] - public void TestStopHalfway([Values] LibType libType, [Values(2, 10)] int numRows) + public void TestStopHalfway([Values] LibType libType, [Values(2, 10)] int numRows, [Values(0, 1, 2, 3, 5, 9, 10, 11)] int prefetchRows) { var rowType = RandomResultSetGenerator.GenerateAllTypesRowType(); var results = RandomResultSetGenerator.Generate(rowType, numRows); @@ -116,7 +116,7 @@ public void TestStopHalfway([Values] LibType libType, [Values(2, 10)] int numRow using var pool = Pool.Create(SpannerLibDictionary[libType], ConnectionString); using var connection = pool.CreateConnection(); - using var rows = connection.Execute(new ExecuteSqlRequest { Sql = "select * from random" }); + using var rows = connection.Execute(new ExecuteSqlRequest { Sql = "select * from random" }, prefetchRows); Assert.That(rows.Metadata, Is.Not.Null); Assert.That(rows.Metadata.RowType.Fields.Count, Is.EqualTo(rowType.Fields.Count)); @@ -137,7 +137,7 @@ public void TestStopHalfway([Values] LibType libType, [Values(2, 10)] int numRow } [Test] - public void TestStopHalfwayTwoQueries([Values] LibType libType) + public void TestStopHalfwayTwoQueries([Values] LibType libType, [Values(0, 1, 2, 3)] int prefetchRows) { const string sql = "select c from my_table"; Fixture.SpannerMock.AddOrUpdateStatementResult(sql, StatementResult.CreateResultSet( @@ -148,7 +148,7 @@ public void TestStopHalfwayTwoQueries([Values] LibType libType) for (var i = 0; i < 2; i++) { - using var rows = connection.Execute(new ExecuteSqlRequest { Sql = sql }); + using var rows = connection.Execute(new ExecuteSqlRequest { Sql = sql }, prefetchRows); Assert.That(rows.Metadata, Is.Not.Null); Assert.That(rows.Metadata.RowType.Fields.Count, Is.EqualTo(1)); var row = rows.Next(); @@ -164,6 +164,7 @@ public void TestStopHalfwayTwoQueries([Values] LibType libType) public void TestStopHalfwayMultipleQueries( [Values] LibType libType, [Values(2, 10)] int numRows, + [Values(0, 1, 2, 3, 5, 9, 10, 11)] int prefetchRows, [Values(1, 2, 3)] int numQueries) { const string query = "select * from random"; @@ -183,7 +184,7 @@ public void TestStopHalfwayMultipleQueries( var sql = string.Join(";", queries); using var pool = Pool.Create(SpannerLibDictionary[libType], ConnectionString); using var connection = pool.CreateConnection(); - using var rows = connection.Execute(new ExecuteSqlRequest { Sql = sql }); + using var rows = connection.Execute(new ExecuteSqlRequest { Sql = sql } ,prefetchRows); Assert.That(rows.Metadata, Is.Not.Null); Assert.That(rows.Metadata.RowType.Fields.Count, Is.EqualTo(rowType.Fields.Count)); @@ -242,14 +243,14 @@ public void TestCloseConnectionWithOpenRows([Values] LibType libType) } [Test] - public void TestExecuteDml([Values] LibType libType) + public void TestExecuteDml([Values] LibType libType, [Values(0, 1, 2)] int prefetchRows) { var sql = "update my_table set value=1 where id=2"; Fixture.SpannerMock.AddOrUpdateStatementResult(sql, StatementResult.CreateUpdateCount(1L)); using var pool = Pool.Create(SpannerLibDictionary[libType], ConnectionString); using var connection = pool.CreateConnection(); - using var rows = connection.Execute(new ExecuteSqlRequest { Sql = sql }); + using var rows = connection.Execute(new ExecuteSqlRequest { Sql = sql }, prefetchRows); Assert.That(rows.Next(), Is.Null); Assert.That(rows.UpdateCount, Is.EqualTo(1L)); @@ -337,7 +338,7 @@ public async Task TestMultipleQueries([Values] LibType libType, [Values] bool as } [Test] - public async Task TestMultipleMixedStatements([Values] LibType libType, [Values(2, 10)] int numRows, [Values] bool async) + public async Task TestMultipleMixedStatements([Values] LibType libType, [Values(2, 10)] int numRows, [Values(0, 1, 2, 3, 5, 9, 10, 11)] int prefetchRows, [Values] bool async) { var updateCount = 3L; var dml = "update my_table set value=1 where id in (1,2,3)"; @@ -354,9 +355,9 @@ public async Task TestMultipleMixedStatements([Values] LibType libType, [Values( await using var pool = Pool.Create(SpannerLibDictionary[libType], ConnectionString); await using var connection = pool.CreateConnection(); await using var rows = async - ? await connection.ExecuteAsync(new ExecuteSqlRequest { Sql = sql }) + ? await connection.ExecuteAsync(new ExecuteSqlRequest { Sql = sql }, prefetchRows) // ReSharper disable once MethodHasAsyncOverload - : connection.Execute(new ExecuteSqlRequest { Sql = sql }); + : connection.Execute(new ExecuteSqlRequest { Sql = sql }, prefetchRows); var numResultSets = 0; var totalRows = 0; @@ -388,6 +389,7 @@ public async Task TestMultipleMixedStatements([Values] LibType libType, [Values( public async Task TestMultipleMixedStatementsWithErrors( [Values] LibType libType, [Values(2, 10)] int numRows, + [Values(0, 1, 2, 3, 5, 9, 10, 11)] int prefetchRows, [Values(0, 1, 2, 3, 4, 5)] int errorIndex, [Values] bool async) { @@ -431,19 +433,19 @@ public async Task TestMultipleMixedStatementsWithErrors( { if (async) { - Assert.ThrowsAsync(() => connection.ExecuteAsync(new ExecuteSqlRequest { Sql = sql })); + Assert.ThrowsAsync(() => connection.ExecuteAsync(new ExecuteSqlRequest { Sql = sql }, prefetchRows)); } else { - Assert.Throws(() => connection.Execute(new ExecuteSqlRequest { Sql = sql })); + Assert.Throws(() => connection.Execute(new ExecuteSqlRequest { Sql = sql }, prefetchRows)); } } else { await using var rows = async - ? await connection.ExecuteAsync(new ExecuteSqlRequest { Sql = sql }) + ? await connection.ExecuteAsync(new ExecuteSqlRequest { Sql = sql }, prefetchRows) // ReSharper disable once MethodHasAsyncOverload - : connection.Execute(new ExecuteSqlRequest { Sql = sql }); + : connection.Execute(new ExecuteSqlRequest { Sql = sql }, prefetchRows); var statementIndex = 0; while (statementIndex < numStatements) diff --git a/spannerlib/wrappers/spannerlib-dotnet/spannerlib-dotnet/Connection.cs b/spannerlib/wrappers/spannerlib-dotnet/spannerlib-dotnet/Connection.cs index 8c5aea3b..3a78d13b 100644 --- a/spannerlib/wrappers/spannerlib-dotnet/spannerlib-dotnet/Connection.cs +++ b/spannerlib/wrappers/spannerlib-dotnet/spannerlib-dotnet/Connection.cs @@ -38,10 +38,26 @@ public class Connection(Pool pool, long id) : AbstractLibObject(pool.Spanner, id /// The transaction options that will be used to create the transaction. The default is a read/write transaction. /// Explicitly set the ReadOnly transaction option to start a read-only transaction. /// - public void BeginTransaction(TransactionOptions transactionOptions) + public virtual void BeginTransaction(TransactionOptions transactionOptions) { Spanner.BeginTransaction(this, transactionOptions); } + + /// + /// Begins a new transaction on this connection. A connection can have at most one active transaction at any time. + /// Calling this method does not immediately start the transaction on Spanner. Instead, the transaction is only + /// registered on the connection, and the BeginTransaction option will be inlined with the first statement in the + /// transaction. + /// + /// + /// The transaction options that will be used to create the transaction. The default is a read/write transaction. + /// Explicitly set the ReadOnly transaction option to start a read-only transaction. + /// + /// The cancellation token + public virtual Task BeginTransactionAsync(TransactionOptions transactionOptions, CancellationToken cancellationToken = default) + { + return Spanner.BeginTransactionAsync(this, transactionOptions, cancellationToken); + } /// /// Commits the current transaction on this connection and returns the CommitResponse (if any). Both read/write and @@ -50,12 +66,12 @@ public void BeginTransaction(TransactionOptions transactionOptions) /// is committed. /// /// The CommitResponse for this transaction, or null for read-only transactions - public CommitResponse? Commit() + public virtual CommitResponse? Commit() { return Spanner.Commit(this); } - public Task CommitAsync(CancellationToken cancellationToken = default) + public virtual Task CommitAsync(CancellationToken cancellationToken = default) { return Spanner.CommitAsync(this, cancellationToken); } @@ -63,12 +79,12 @@ public void BeginTransaction(TransactionOptions transactionOptions) /// /// Rollbacks the current transaction. /// - public void Rollback() + public virtual void Rollback() { Spanner.Rollback(this); } - public Task RollbackAsync(CancellationToken cancellationToken = default) + public virtual Task RollbackAsync(CancellationToken cancellationToken = default) { return Spanner.RollbackAsync(this, cancellationToken); } @@ -84,7 +100,7 @@ public Task RollbackAsync(CancellationToken cancellationToken = default) /// The CommitResponse that is returned by Spanner, or null if the mutations were only buffered in the current /// transaction. /// - public CommitResponse? WriteMutations(BatchWriteRequest.Types.MutationGroup mutations) + public virtual CommitResponse? WriteMutations(BatchWriteRequest.Types.MutationGroup mutations) { return Spanner.WriteMutations(this, mutations); } @@ -101,7 +117,7 @@ public Task RollbackAsync(CancellationToken cancellationToken = default) /// The CommitResponse that is returned by Spanner, or null if the mutations were only buffered in the current /// transaction. /// - public Task WriteMutationsAsync(BatchWriteRequest.Types.MutationGroup mutations, + public virtual Task WriteMutationsAsync(BatchWriteRequest.Types.MutationGroup mutations, CancellationToken cancellationToken = default) { return Spanner.WriteMutationsAsync(this, mutations, cancellationToken); @@ -112,10 +128,11 @@ public Task RollbackAsync(CancellationToken cancellationToken = default) /// connection. The contents of the returned Rows object depends on the type of SQL statement. /// /// The SQL statement that should be executed + /// The number of rows to prefetch and include in the initial result /// A Rows object with the statement result - public Rows Execute(ExecuteSqlRequest statement) + public virtual Rows Execute(ExecuteSqlRequest statement, int prefetchRows = 0) { - return Spanner.Execute(this, statement); + return Spanner.Execute(this, statement, prefetchRows); } /// @@ -123,10 +140,12 @@ public Rows Execute(ExecuteSqlRequest statement) /// connection. The contents of the returned Rows object depends on the type of SQL statement. /// /// The SQL statement that should be executed + /// The number of rows to prefetch and include in the initial result + /// The cancellation token /// A Rows object with the statement result - public Task ExecuteAsync(ExecuteSqlRequest statement) + public virtual Task ExecuteAsync(ExecuteSqlRequest statement, int prefetchRows = 0, CancellationToken cancellationToken = default) { - return Spanner.ExecuteAsync(this, statement); + return Spanner.ExecuteAsync(this, statement, prefetchRows, cancellationToken); } /// @@ -136,7 +155,7 @@ public Task ExecuteAsync(ExecuteSqlRequest statement) /// /// The DML or DDL statements to execute /// The update count per statement. The update count for a DDL statement is -1. - public long[] ExecuteBatch(IEnumerable statements) + public virtual long[] ExecuteBatch(List statements) { var request = new ExecuteBatchDmlRequest { @@ -151,14 +170,15 @@ public long[] ExecuteBatch(IEnumerable s /// transaction is not supported. /// /// The DML or DDL statements to execute + /// The cancellation token /// The update count per statement. The update count for a DDL statement is -1. - public Task ExecuteBatchAsync(List statements) + public virtual Task ExecuteBatchAsync(List statements, CancellationToken cancellationToken = default) { var request = new ExecuteBatchDmlRequest { Statements = { statements } }; - return Spanner.ExecuteBatchAsync(this, request); + return Spanner.ExecuteBatchAsync(this, request, cancellationToken); } /// diff --git a/spannerlib/wrappers/spannerlib-dotnet/spannerlib-dotnet/ISpannerLib.cs b/spannerlib/wrappers/spannerlib-dotnet/spannerlib-dotnet/ISpannerLib.cs index 445cffbc..dc480bef 100644 --- a/spannerlib/wrappers/spannerlib-dotnet/spannerlib-dotnet/ISpannerLib.cs +++ b/spannerlib/wrappers/spannerlib-dotnet/spannerlib-dotnet/ISpannerLib.cs @@ -111,23 +111,25 @@ public enum RowEncoding /// /// The connection to use to execute the SQL statement /// The statement to execute + /// The number of rows to prefetch and include in the initial result /// /// A Rows object with the results of the statement. The contents of the Rows object depends on the type of SQL /// statement. /// - public Rows Execute(Connection connection, ExecuteSqlRequest statement); + public Rows Execute(Connection connection, ExecuteSqlRequest statement, int prefetchRows = 0); /// /// Executes a SQL statement of any type on the given connection. /// /// The connection to use to execute the SQL statement /// The statement to execute + /// The number of rows to prefetch and include in the initial result /// The cancellation token /// /// A Rows object with the results of the statement. The contents of the Rows object depends on the type of SQL /// statement. /// - public Task ExecuteAsync(Connection connection, ExecuteSqlRequest statement, CancellationToken cancellationToken = default); + public Task ExecuteAsync(Connection connection, ExecuteSqlRequest statement, int prefetchRows = 0, CancellationToken cancellationToken = default); /// /// Executes a batch of DML or DDL statements on Spanner. The batch may not contain a mix of DML and DDL statements. @@ -146,6 +148,32 @@ public enum RowEncoding /// The update count per statement. The update count for a DDL statement is -1. public Task ExecuteBatchAsync(Connection connection, ExecuteBatchDmlRequest statements, CancellationToken cancellationToken = default); + /// + /// Converts an ExecuteBatchDmlResponse to an array of update counts. + /// + /// The response to convert + /// An array of update counts extracted from the given response + public static long[] ToUpdateCounts(ExecuteBatchDmlResponse response) + { + var result = new long[response.ResultSets.Count]; + for (var i = 0; i < result.Length; i++) + { + if (response.ResultSets[i].Stats.HasRowCountExact) + { + result[i] = response.ResultSets[i].Stats.RowCountExact; + } + else if (response.ResultSets[i].Stats.HasRowCountLowerBound) + { + result[i] = response.ResultSets[i].Stats.RowCountLowerBound; + } + else + { + result[i] = -1; + } + } + return result; + } + /// /// Returns the ResultSetMetadata of a Rows object. This can be used to inspect the type of data that a Rows object /// contains. @@ -236,7 +264,19 @@ public enum RowEncoding /// to create a read-only transaction. /// public void BeginTransaction(Connection connection, TransactionOptions transactionOptions); - + + /// + /// Starts a new transaction on this connection. A connection can have at most one transaction at any time. All + /// transactions, including read-only transactions, must be either committed or rolled back. + /// + /// The connection to use to start the transaction + /// + /// The options for the new transaction. The default is to create a read/write transaction. Set the ReadOnly option + /// to create a read-only transaction. + /// + /// The cancellation token + public Task BeginTransactionAsync(Connection connection, TransactionOptions transactionOptions, CancellationToken cancellationToken = default); + /// /// Commits the current transaction on this connection. /// diff --git a/spannerlib/wrappers/spannerlib-java/src/main/java/com/google/cloud/spannerlib/GrpcSpannerLibraryImpl.java b/spannerlib/wrappers/spannerlib-java/src/main/java/com/google/cloud/spannerlib/GrpcSpannerLibraryImpl.java index 0ba6f005..7df883a4 100644 --- a/spannerlib/wrappers/spannerlib-java/src/main/java/com/google/cloud/spannerlib/GrpcSpannerLibraryImpl.java +++ b/spannerlib/wrappers/spannerlib-java/src/main/java/com/google/cloud/spannerlib/GrpcSpannerLibraryImpl.java @@ -16,7 +16,6 @@ package com.google.cloud.spannerlib; -import com.google.cloud.spannerlib.Rows.Encoding; import com.google.cloud.spannerlib.v1.BeginTransactionRequest; import com.google.cloud.spannerlib.v1.CreateConnectionRequest; import com.google.cloud.spannerlib.v1.CreatePoolRequest; @@ -260,13 +259,7 @@ public ResultSetMetadata getMetadata(Rows rows) { @Override public ListValue next(Rows rows) { try { - ListValue values = - stub.next( - NextRequest.newBuilder() - .setRows(toProto(rows)) - .setNumRows(1) - .setEncoding(Encoding.PROTOBUF.ordinal()) - .build()); + ListValue values = stub.next(NextRequest.newBuilder().setRows(toProto(rows)).build()); if (values.getValuesList().isEmpty()) { return null; } diff --git a/spannerlib/wrappers/spannerlib-java/src/main/java/com/google/cloud/spannerlib/v1/ConnectionStreamRequest.java b/spannerlib/wrappers/spannerlib-java/src/main/java/com/google/cloud/spannerlib/v1/ConnectionStreamRequest.java index d5e213d2..51413c77 100644 --- a/spannerlib/wrappers/spannerlib-java/src/main/java/com/google/cloud/spannerlib/v1/ConnectionStreamRequest.java +++ b/spannerlib/wrappers/spannerlib-java/src/main/java/com/google/cloud/spannerlib/v1/ConnectionStreamRequest.java @@ -6,6 +6,11 @@ package com.google.cloud.spannerlib.v1; /** + *
+ * ConnectionStreamRequest is used by a client to send a request to the server using a
+ * bi-directional gRPC stream. Such a stream is opened by calling the ConnectionStream RPC.
+ * 
+ * * Protobuf type {@code google.spannerlib.v1.ConnectionStreamRequest} */ @com.google.protobuf.Generated @@ -50,6 +55,11 @@ public enum RequestCase implements com.google.protobuf.Internal.EnumLite, com.google.protobuf.AbstractMessage.InternalOneOfEnum { EXECUTE_REQUEST(1), + EXECUTE_BATCH_REQUEST(2), + BEGIN_TRANSACTION_REQUEST(3), + COMMIT_REQUEST(4), + ROLLBACK_REQUEST(5), + WRITE_MUTATIONS_REQUEST(6), REQUEST_NOT_SET(0); private final int value; private RequestCase(int value) { @@ -68,6 +78,11 @@ public static RequestCase valueOf(int value) { public static RequestCase forNumber(int value) { switch (value) { case 1: return EXECUTE_REQUEST; + case 2: return EXECUTE_BATCH_REQUEST; + case 3: return BEGIN_TRANSACTION_REQUEST; + case 4: return COMMIT_REQUEST; + case 5: return ROLLBACK_REQUEST; + case 6: return WRITE_MUTATIONS_REQUEST; case 0: return REQUEST_NOT_SET; default: return null; } @@ -114,6 +129,161 @@ public com.google.cloud.spannerlib.v1.ExecuteRequestOrBuilder getExecuteRequestO return com.google.cloud.spannerlib.v1.ExecuteRequest.getDefaultInstance(); } + public static final int EXECUTE_BATCH_REQUEST_FIELD_NUMBER = 2; + /** + * .google.spannerlib.v1.ExecuteBatchRequest execute_batch_request = 2; + * @return Whether the executeBatchRequest field is set. + */ + @java.lang.Override + public boolean hasExecuteBatchRequest() { + return requestCase_ == 2; + } + /** + * .google.spannerlib.v1.ExecuteBatchRequest execute_batch_request = 2; + * @return The executeBatchRequest. + */ + @java.lang.Override + public com.google.cloud.spannerlib.v1.ExecuteBatchRequest getExecuteBatchRequest() { + if (requestCase_ == 2) { + return (com.google.cloud.spannerlib.v1.ExecuteBatchRequest) request_; + } + return com.google.cloud.spannerlib.v1.ExecuteBatchRequest.getDefaultInstance(); + } + /** + * .google.spannerlib.v1.ExecuteBatchRequest execute_batch_request = 2; + */ + @java.lang.Override + public com.google.cloud.spannerlib.v1.ExecuteBatchRequestOrBuilder getExecuteBatchRequestOrBuilder() { + if (requestCase_ == 2) { + return (com.google.cloud.spannerlib.v1.ExecuteBatchRequest) request_; + } + return com.google.cloud.spannerlib.v1.ExecuteBatchRequest.getDefaultInstance(); + } + + public static final int BEGIN_TRANSACTION_REQUEST_FIELD_NUMBER = 3; + /** + * .google.spannerlib.v1.BeginTransactionRequest begin_transaction_request = 3; + * @return Whether the beginTransactionRequest field is set. + */ + @java.lang.Override + public boolean hasBeginTransactionRequest() { + return requestCase_ == 3; + } + /** + * .google.spannerlib.v1.BeginTransactionRequest begin_transaction_request = 3; + * @return The beginTransactionRequest. + */ + @java.lang.Override + public com.google.cloud.spannerlib.v1.BeginTransactionRequest getBeginTransactionRequest() { + if (requestCase_ == 3) { + return (com.google.cloud.spannerlib.v1.BeginTransactionRequest) request_; + } + return com.google.cloud.spannerlib.v1.BeginTransactionRequest.getDefaultInstance(); + } + /** + * .google.spannerlib.v1.BeginTransactionRequest begin_transaction_request = 3; + */ + @java.lang.Override + public com.google.cloud.spannerlib.v1.BeginTransactionRequestOrBuilder getBeginTransactionRequestOrBuilder() { + if (requestCase_ == 3) { + return (com.google.cloud.spannerlib.v1.BeginTransactionRequest) request_; + } + return com.google.cloud.spannerlib.v1.BeginTransactionRequest.getDefaultInstance(); + } + + public static final int COMMIT_REQUEST_FIELD_NUMBER = 4; + /** + * .google.spannerlib.v1.Connection commit_request = 4; + * @return Whether the commitRequest field is set. + */ + @java.lang.Override + public boolean hasCommitRequest() { + return requestCase_ == 4; + } + /** + * .google.spannerlib.v1.Connection commit_request = 4; + * @return The commitRequest. + */ + @java.lang.Override + public com.google.cloud.spannerlib.v1.Connection getCommitRequest() { + if (requestCase_ == 4) { + return (com.google.cloud.spannerlib.v1.Connection) request_; + } + return com.google.cloud.spannerlib.v1.Connection.getDefaultInstance(); + } + /** + * .google.spannerlib.v1.Connection commit_request = 4; + */ + @java.lang.Override + public com.google.cloud.spannerlib.v1.ConnectionOrBuilder getCommitRequestOrBuilder() { + if (requestCase_ == 4) { + return (com.google.cloud.spannerlib.v1.Connection) request_; + } + return com.google.cloud.spannerlib.v1.Connection.getDefaultInstance(); + } + + public static final int ROLLBACK_REQUEST_FIELD_NUMBER = 5; + /** + * .google.spannerlib.v1.Connection rollback_request = 5; + * @return Whether the rollbackRequest field is set. + */ + @java.lang.Override + public boolean hasRollbackRequest() { + return requestCase_ == 5; + } + /** + * .google.spannerlib.v1.Connection rollback_request = 5; + * @return The rollbackRequest. + */ + @java.lang.Override + public com.google.cloud.spannerlib.v1.Connection getRollbackRequest() { + if (requestCase_ == 5) { + return (com.google.cloud.spannerlib.v1.Connection) request_; + } + return com.google.cloud.spannerlib.v1.Connection.getDefaultInstance(); + } + /** + * .google.spannerlib.v1.Connection rollback_request = 5; + */ + @java.lang.Override + public com.google.cloud.spannerlib.v1.ConnectionOrBuilder getRollbackRequestOrBuilder() { + if (requestCase_ == 5) { + return (com.google.cloud.spannerlib.v1.Connection) request_; + } + return com.google.cloud.spannerlib.v1.Connection.getDefaultInstance(); + } + + public static final int WRITE_MUTATIONS_REQUEST_FIELD_NUMBER = 6; + /** + * .google.spannerlib.v1.WriteMutationsRequest write_mutations_request = 6; + * @return Whether the writeMutationsRequest field is set. + */ + @java.lang.Override + public boolean hasWriteMutationsRequest() { + return requestCase_ == 6; + } + /** + * .google.spannerlib.v1.WriteMutationsRequest write_mutations_request = 6; + * @return The writeMutationsRequest. + */ + @java.lang.Override + public com.google.cloud.spannerlib.v1.WriteMutationsRequest getWriteMutationsRequest() { + if (requestCase_ == 6) { + return (com.google.cloud.spannerlib.v1.WriteMutationsRequest) request_; + } + return com.google.cloud.spannerlib.v1.WriteMutationsRequest.getDefaultInstance(); + } + /** + * .google.spannerlib.v1.WriteMutationsRequest write_mutations_request = 6; + */ + @java.lang.Override + public com.google.cloud.spannerlib.v1.WriteMutationsRequestOrBuilder getWriteMutationsRequestOrBuilder() { + if (requestCase_ == 6) { + return (com.google.cloud.spannerlib.v1.WriteMutationsRequest) request_; + } + return com.google.cloud.spannerlib.v1.WriteMutationsRequest.getDefaultInstance(); + } + private byte memoizedIsInitialized = -1; @java.lang.Override public final boolean isInitialized() { @@ -131,6 +301,21 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) if (requestCase_ == 1) { output.writeMessage(1, (com.google.cloud.spannerlib.v1.ExecuteRequest) request_); } + if (requestCase_ == 2) { + output.writeMessage(2, (com.google.cloud.spannerlib.v1.ExecuteBatchRequest) request_); + } + if (requestCase_ == 3) { + output.writeMessage(3, (com.google.cloud.spannerlib.v1.BeginTransactionRequest) request_); + } + if (requestCase_ == 4) { + output.writeMessage(4, (com.google.cloud.spannerlib.v1.Connection) request_); + } + if (requestCase_ == 5) { + output.writeMessage(5, (com.google.cloud.spannerlib.v1.Connection) request_); + } + if (requestCase_ == 6) { + output.writeMessage(6, (com.google.cloud.spannerlib.v1.WriteMutationsRequest) request_); + } getUnknownFields().writeTo(output); } @@ -144,6 +329,26 @@ public int getSerializedSize() { size += com.google.protobuf.CodedOutputStream .computeMessageSize(1, (com.google.cloud.spannerlib.v1.ExecuteRequest) request_); } + if (requestCase_ == 2) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, (com.google.cloud.spannerlib.v1.ExecuteBatchRequest) request_); + } + if (requestCase_ == 3) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, (com.google.cloud.spannerlib.v1.BeginTransactionRequest) request_); + } + if (requestCase_ == 4) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(4, (com.google.cloud.spannerlib.v1.Connection) request_); + } + if (requestCase_ == 5) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(5, (com.google.cloud.spannerlib.v1.Connection) request_); + } + if (requestCase_ == 6) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(6, (com.google.cloud.spannerlib.v1.WriteMutationsRequest) request_); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -165,6 +370,26 @@ public boolean equals(final java.lang.Object obj) { if (!getExecuteRequest() .equals(other.getExecuteRequest())) return false; break; + case 2: + if (!getExecuteBatchRequest() + .equals(other.getExecuteBatchRequest())) return false; + break; + case 3: + if (!getBeginTransactionRequest() + .equals(other.getBeginTransactionRequest())) return false; + break; + case 4: + if (!getCommitRequest() + .equals(other.getCommitRequest())) return false; + break; + case 5: + if (!getRollbackRequest() + .equals(other.getRollbackRequest())) return false; + break; + case 6: + if (!getWriteMutationsRequest() + .equals(other.getWriteMutationsRequest())) return false; + break; case 0: default: } @@ -184,6 +409,26 @@ public int hashCode() { hash = (37 * hash) + EXECUTE_REQUEST_FIELD_NUMBER; hash = (53 * hash) + getExecuteRequest().hashCode(); break; + case 2: + hash = (37 * hash) + EXECUTE_BATCH_REQUEST_FIELD_NUMBER; + hash = (53 * hash) + getExecuteBatchRequest().hashCode(); + break; + case 3: + hash = (37 * hash) + BEGIN_TRANSACTION_REQUEST_FIELD_NUMBER; + hash = (53 * hash) + getBeginTransactionRequest().hashCode(); + break; + case 4: + hash = (37 * hash) + COMMIT_REQUEST_FIELD_NUMBER; + hash = (53 * hash) + getCommitRequest().hashCode(); + break; + case 5: + hash = (37 * hash) + ROLLBACK_REQUEST_FIELD_NUMBER; + hash = (53 * hash) + getRollbackRequest().hashCode(); + break; + case 6: + hash = (37 * hash) + WRITE_MUTATIONS_REQUEST_FIELD_NUMBER; + hash = (53 * hash) + getWriteMutationsRequest().hashCode(); + break; case 0: default: } @@ -285,6 +530,11 @@ protected Builder newBuilderForType( return builder; } /** + *
+   * ConnectionStreamRequest is used by a client to send a request to the server using a
+   * bi-directional gRPC stream. Such a stream is opened by calling the ConnectionStream RPC.
+   * 
+ * * Protobuf type {@code google.spannerlib.v1.ConnectionStreamRequest} */ public static final class Builder extends @@ -321,6 +571,21 @@ public Builder clear() { if (executeRequestBuilder_ != null) { executeRequestBuilder_.clear(); } + if (executeBatchRequestBuilder_ != null) { + executeBatchRequestBuilder_.clear(); + } + if (beginTransactionRequestBuilder_ != null) { + beginTransactionRequestBuilder_.clear(); + } + if (commitRequestBuilder_ != null) { + commitRequestBuilder_.clear(); + } + if (rollbackRequestBuilder_ != null) { + rollbackRequestBuilder_.clear(); + } + if (writeMutationsRequestBuilder_ != null) { + writeMutationsRequestBuilder_.clear(); + } requestCase_ = 0; request_ = null; return this; @@ -366,6 +631,26 @@ private void buildPartialOneofs(com.google.cloud.spannerlib.v1.ConnectionStreamR executeRequestBuilder_ != null) { result.request_ = executeRequestBuilder_.build(); } + if (requestCase_ == 2 && + executeBatchRequestBuilder_ != null) { + result.request_ = executeBatchRequestBuilder_.build(); + } + if (requestCase_ == 3 && + beginTransactionRequestBuilder_ != null) { + result.request_ = beginTransactionRequestBuilder_.build(); + } + if (requestCase_ == 4 && + commitRequestBuilder_ != null) { + result.request_ = commitRequestBuilder_.build(); + } + if (requestCase_ == 5 && + rollbackRequestBuilder_ != null) { + result.request_ = rollbackRequestBuilder_.build(); + } + if (requestCase_ == 6 && + writeMutationsRequestBuilder_ != null) { + result.request_ = writeMutationsRequestBuilder_.build(); + } } @java.lang.Override @@ -385,6 +670,26 @@ public Builder mergeFrom(com.google.cloud.spannerlib.v1.ConnectionStreamRequest mergeExecuteRequest(other.getExecuteRequest()); break; } + case EXECUTE_BATCH_REQUEST: { + mergeExecuteBatchRequest(other.getExecuteBatchRequest()); + break; + } + case BEGIN_TRANSACTION_REQUEST: { + mergeBeginTransactionRequest(other.getBeginTransactionRequest()); + break; + } + case COMMIT_REQUEST: { + mergeCommitRequest(other.getCommitRequest()); + break; + } + case ROLLBACK_REQUEST: { + mergeRollbackRequest(other.getRollbackRequest()); + break; + } + case WRITE_MUTATIONS_REQUEST: { + mergeWriteMutationsRequest(other.getWriteMutationsRequest()); + break; + } case REQUEST_NOT_SET: { break; } @@ -422,6 +727,41 @@ public Builder mergeFrom( requestCase_ = 1; break; } // case 10 + case 18: { + input.readMessage( + internalGetExecuteBatchRequestFieldBuilder().getBuilder(), + extensionRegistry); + requestCase_ = 2; + break; + } // case 18 + case 26: { + input.readMessage( + internalGetBeginTransactionRequestFieldBuilder().getBuilder(), + extensionRegistry); + requestCase_ = 3; + break; + } // case 26 + case 34: { + input.readMessage( + internalGetCommitRequestFieldBuilder().getBuilder(), + extensionRegistry); + requestCase_ = 4; + break; + } // case 34 + case 42: { + input.readMessage( + internalGetRollbackRequestFieldBuilder().getBuilder(), + extensionRegistry); + requestCase_ = 5; + break; + } // case 42 + case 50: { + input.readMessage( + internalGetWriteMutationsRequestFieldBuilder().getBuilder(), + extensionRegistry); + requestCase_ = 6; + break; + } // case 50 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { done = true; // was an endgroup tag @@ -596,6 +936,716 @@ public com.google.cloud.spannerlib.v1.ExecuteRequestOrBuilder getExecuteRequestO return executeRequestBuilder_; } + private com.google.protobuf.SingleFieldBuilder< + com.google.cloud.spannerlib.v1.ExecuteBatchRequest, com.google.cloud.spannerlib.v1.ExecuteBatchRequest.Builder, com.google.cloud.spannerlib.v1.ExecuteBatchRequestOrBuilder> executeBatchRequestBuilder_; + /** + * .google.spannerlib.v1.ExecuteBatchRequest execute_batch_request = 2; + * @return Whether the executeBatchRequest field is set. + */ + @java.lang.Override + public boolean hasExecuteBatchRequest() { + return requestCase_ == 2; + } + /** + * .google.spannerlib.v1.ExecuteBatchRequest execute_batch_request = 2; + * @return The executeBatchRequest. + */ + @java.lang.Override + public com.google.cloud.spannerlib.v1.ExecuteBatchRequest getExecuteBatchRequest() { + if (executeBatchRequestBuilder_ == null) { + if (requestCase_ == 2) { + return (com.google.cloud.spannerlib.v1.ExecuteBatchRequest) request_; + } + return com.google.cloud.spannerlib.v1.ExecuteBatchRequest.getDefaultInstance(); + } else { + if (requestCase_ == 2) { + return executeBatchRequestBuilder_.getMessage(); + } + return com.google.cloud.spannerlib.v1.ExecuteBatchRequest.getDefaultInstance(); + } + } + /** + * .google.spannerlib.v1.ExecuteBatchRequest execute_batch_request = 2; + */ + public Builder setExecuteBatchRequest(com.google.cloud.spannerlib.v1.ExecuteBatchRequest value) { + if (executeBatchRequestBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + request_ = value; + onChanged(); + } else { + executeBatchRequestBuilder_.setMessage(value); + } + requestCase_ = 2; + return this; + } + /** + * .google.spannerlib.v1.ExecuteBatchRequest execute_batch_request = 2; + */ + public Builder setExecuteBatchRequest( + com.google.cloud.spannerlib.v1.ExecuteBatchRequest.Builder builderForValue) { + if (executeBatchRequestBuilder_ == null) { + request_ = builderForValue.build(); + onChanged(); + } else { + executeBatchRequestBuilder_.setMessage(builderForValue.build()); + } + requestCase_ = 2; + return this; + } + /** + * .google.spannerlib.v1.ExecuteBatchRequest execute_batch_request = 2; + */ + public Builder mergeExecuteBatchRequest(com.google.cloud.spannerlib.v1.ExecuteBatchRequest value) { + if (executeBatchRequestBuilder_ == null) { + if (requestCase_ == 2 && + request_ != com.google.cloud.spannerlib.v1.ExecuteBatchRequest.getDefaultInstance()) { + request_ = com.google.cloud.spannerlib.v1.ExecuteBatchRequest.newBuilder((com.google.cloud.spannerlib.v1.ExecuteBatchRequest) request_) + .mergeFrom(value).buildPartial(); + } else { + request_ = value; + } + onChanged(); + } else { + if (requestCase_ == 2) { + executeBatchRequestBuilder_.mergeFrom(value); + } else { + executeBatchRequestBuilder_.setMessage(value); + } + } + requestCase_ = 2; + return this; + } + /** + * .google.spannerlib.v1.ExecuteBatchRequest execute_batch_request = 2; + */ + public Builder clearExecuteBatchRequest() { + if (executeBatchRequestBuilder_ == null) { + if (requestCase_ == 2) { + requestCase_ = 0; + request_ = null; + onChanged(); + } + } else { + if (requestCase_ == 2) { + requestCase_ = 0; + request_ = null; + } + executeBatchRequestBuilder_.clear(); + } + return this; + } + /** + * .google.spannerlib.v1.ExecuteBatchRequest execute_batch_request = 2; + */ + public com.google.cloud.spannerlib.v1.ExecuteBatchRequest.Builder getExecuteBatchRequestBuilder() { + return internalGetExecuteBatchRequestFieldBuilder().getBuilder(); + } + /** + * .google.spannerlib.v1.ExecuteBatchRequest execute_batch_request = 2; + */ + @java.lang.Override + public com.google.cloud.spannerlib.v1.ExecuteBatchRequestOrBuilder getExecuteBatchRequestOrBuilder() { + if ((requestCase_ == 2) && (executeBatchRequestBuilder_ != null)) { + return executeBatchRequestBuilder_.getMessageOrBuilder(); + } else { + if (requestCase_ == 2) { + return (com.google.cloud.spannerlib.v1.ExecuteBatchRequest) request_; + } + return com.google.cloud.spannerlib.v1.ExecuteBatchRequest.getDefaultInstance(); + } + } + /** + * .google.spannerlib.v1.ExecuteBatchRequest execute_batch_request = 2; + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.cloud.spannerlib.v1.ExecuteBatchRequest, com.google.cloud.spannerlib.v1.ExecuteBatchRequest.Builder, com.google.cloud.spannerlib.v1.ExecuteBatchRequestOrBuilder> + internalGetExecuteBatchRequestFieldBuilder() { + if (executeBatchRequestBuilder_ == null) { + if (!(requestCase_ == 2)) { + request_ = com.google.cloud.spannerlib.v1.ExecuteBatchRequest.getDefaultInstance(); + } + executeBatchRequestBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.google.cloud.spannerlib.v1.ExecuteBatchRequest, com.google.cloud.spannerlib.v1.ExecuteBatchRequest.Builder, com.google.cloud.spannerlib.v1.ExecuteBatchRequestOrBuilder>( + (com.google.cloud.spannerlib.v1.ExecuteBatchRequest) request_, + getParentForChildren(), + isClean()); + request_ = null; + } + requestCase_ = 2; + onChanged(); + return executeBatchRequestBuilder_; + } + + private com.google.protobuf.SingleFieldBuilder< + com.google.cloud.spannerlib.v1.BeginTransactionRequest, com.google.cloud.spannerlib.v1.BeginTransactionRequest.Builder, com.google.cloud.spannerlib.v1.BeginTransactionRequestOrBuilder> beginTransactionRequestBuilder_; + /** + * .google.spannerlib.v1.BeginTransactionRequest begin_transaction_request = 3; + * @return Whether the beginTransactionRequest field is set. + */ + @java.lang.Override + public boolean hasBeginTransactionRequest() { + return requestCase_ == 3; + } + /** + * .google.spannerlib.v1.BeginTransactionRequest begin_transaction_request = 3; + * @return The beginTransactionRequest. + */ + @java.lang.Override + public com.google.cloud.spannerlib.v1.BeginTransactionRequest getBeginTransactionRequest() { + if (beginTransactionRequestBuilder_ == null) { + if (requestCase_ == 3) { + return (com.google.cloud.spannerlib.v1.BeginTransactionRequest) request_; + } + return com.google.cloud.spannerlib.v1.BeginTransactionRequest.getDefaultInstance(); + } else { + if (requestCase_ == 3) { + return beginTransactionRequestBuilder_.getMessage(); + } + return com.google.cloud.spannerlib.v1.BeginTransactionRequest.getDefaultInstance(); + } + } + /** + * .google.spannerlib.v1.BeginTransactionRequest begin_transaction_request = 3; + */ + public Builder setBeginTransactionRequest(com.google.cloud.spannerlib.v1.BeginTransactionRequest value) { + if (beginTransactionRequestBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + request_ = value; + onChanged(); + } else { + beginTransactionRequestBuilder_.setMessage(value); + } + requestCase_ = 3; + return this; + } + /** + * .google.spannerlib.v1.BeginTransactionRequest begin_transaction_request = 3; + */ + public Builder setBeginTransactionRequest( + com.google.cloud.spannerlib.v1.BeginTransactionRequest.Builder builderForValue) { + if (beginTransactionRequestBuilder_ == null) { + request_ = builderForValue.build(); + onChanged(); + } else { + beginTransactionRequestBuilder_.setMessage(builderForValue.build()); + } + requestCase_ = 3; + return this; + } + /** + * .google.spannerlib.v1.BeginTransactionRequest begin_transaction_request = 3; + */ + public Builder mergeBeginTransactionRequest(com.google.cloud.spannerlib.v1.BeginTransactionRequest value) { + if (beginTransactionRequestBuilder_ == null) { + if (requestCase_ == 3 && + request_ != com.google.cloud.spannerlib.v1.BeginTransactionRequest.getDefaultInstance()) { + request_ = com.google.cloud.spannerlib.v1.BeginTransactionRequest.newBuilder((com.google.cloud.spannerlib.v1.BeginTransactionRequest) request_) + .mergeFrom(value).buildPartial(); + } else { + request_ = value; + } + onChanged(); + } else { + if (requestCase_ == 3) { + beginTransactionRequestBuilder_.mergeFrom(value); + } else { + beginTransactionRequestBuilder_.setMessage(value); + } + } + requestCase_ = 3; + return this; + } + /** + * .google.spannerlib.v1.BeginTransactionRequest begin_transaction_request = 3; + */ + public Builder clearBeginTransactionRequest() { + if (beginTransactionRequestBuilder_ == null) { + if (requestCase_ == 3) { + requestCase_ = 0; + request_ = null; + onChanged(); + } + } else { + if (requestCase_ == 3) { + requestCase_ = 0; + request_ = null; + } + beginTransactionRequestBuilder_.clear(); + } + return this; + } + /** + * .google.spannerlib.v1.BeginTransactionRequest begin_transaction_request = 3; + */ + public com.google.cloud.spannerlib.v1.BeginTransactionRequest.Builder getBeginTransactionRequestBuilder() { + return internalGetBeginTransactionRequestFieldBuilder().getBuilder(); + } + /** + * .google.spannerlib.v1.BeginTransactionRequest begin_transaction_request = 3; + */ + @java.lang.Override + public com.google.cloud.spannerlib.v1.BeginTransactionRequestOrBuilder getBeginTransactionRequestOrBuilder() { + if ((requestCase_ == 3) && (beginTransactionRequestBuilder_ != null)) { + return beginTransactionRequestBuilder_.getMessageOrBuilder(); + } else { + if (requestCase_ == 3) { + return (com.google.cloud.spannerlib.v1.BeginTransactionRequest) request_; + } + return com.google.cloud.spannerlib.v1.BeginTransactionRequest.getDefaultInstance(); + } + } + /** + * .google.spannerlib.v1.BeginTransactionRequest begin_transaction_request = 3; + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.cloud.spannerlib.v1.BeginTransactionRequest, com.google.cloud.spannerlib.v1.BeginTransactionRequest.Builder, com.google.cloud.spannerlib.v1.BeginTransactionRequestOrBuilder> + internalGetBeginTransactionRequestFieldBuilder() { + if (beginTransactionRequestBuilder_ == null) { + if (!(requestCase_ == 3)) { + request_ = com.google.cloud.spannerlib.v1.BeginTransactionRequest.getDefaultInstance(); + } + beginTransactionRequestBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.google.cloud.spannerlib.v1.BeginTransactionRequest, com.google.cloud.spannerlib.v1.BeginTransactionRequest.Builder, com.google.cloud.spannerlib.v1.BeginTransactionRequestOrBuilder>( + (com.google.cloud.spannerlib.v1.BeginTransactionRequest) request_, + getParentForChildren(), + isClean()); + request_ = null; + } + requestCase_ = 3; + onChanged(); + return beginTransactionRequestBuilder_; + } + + private com.google.protobuf.SingleFieldBuilder< + com.google.cloud.spannerlib.v1.Connection, com.google.cloud.spannerlib.v1.Connection.Builder, com.google.cloud.spannerlib.v1.ConnectionOrBuilder> commitRequestBuilder_; + /** + * .google.spannerlib.v1.Connection commit_request = 4; + * @return Whether the commitRequest field is set. + */ + @java.lang.Override + public boolean hasCommitRequest() { + return requestCase_ == 4; + } + /** + * .google.spannerlib.v1.Connection commit_request = 4; + * @return The commitRequest. + */ + @java.lang.Override + public com.google.cloud.spannerlib.v1.Connection getCommitRequest() { + if (commitRequestBuilder_ == null) { + if (requestCase_ == 4) { + return (com.google.cloud.spannerlib.v1.Connection) request_; + } + return com.google.cloud.spannerlib.v1.Connection.getDefaultInstance(); + } else { + if (requestCase_ == 4) { + return commitRequestBuilder_.getMessage(); + } + return com.google.cloud.spannerlib.v1.Connection.getDefaultInstance(); + } + } + /** + * .google.spannerlib.v1.Connection commit_request = 4; + */ + public Builder setCommitRequest(com.google.cloud.spannerlib.v1.Connection value) { + if (commitRequestBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + request_ = value; + onChanged(); + } else { + commitRequestBuilder_.setMessage(value); + } + requestCase_ = 4; + return this; + } + /** + * .google.spannerlib.v1.Connection commit_request = 4; + */ + public Builder setCommitRequest( + com.google.cloud.spannerlib.v1.Connection.Builder builderForValue) { + if (commitRequestBuilder_ == null) { + request_ = builderForValue.build(); + onChanged(); + } else { + commitRequestBuilder_.setMessage(builderForValue.build()); + } + requestCase_ = 4; + return this; + } + /** + * .google.spannerlib.v1.Connection commit_request = 4; + */ + public Builder mergeCommitRequest(com.google.cloud.spannerlib.v1.Connection value) { + if (commitRequestBuilder_ == null) { + if (requestCase_ == 4 && + request_ != com.google.cloud.spannerlib.v1.Connection.getDefaultInstance()) { + request_ = com.google.cloud.spannerlib.v1.Connection.newBuilder((com.google.cloud.spannerlib.v1.Connection) request_) + .mergeFrom(value).buildPartial(); + } else { + request_ = value; + } + onChanged(); + } else { + if (requestCase_ == 4) { + commitRequestBuilder_.mergeFrom(value); + } else { + commitRequestBuilder_.setMessage(value); + } + } + requestCase_ = 4; + return this; + } + /** + * .google.spannerlib.v1.Connection commit_request = 4; + */ + public Builder clearCommitRequest() { + if (commitRequestBuilder_ == null) { + if (requestCase_ == 4) { + requestCase_ = 0; + request_ = null; + onChanged(); + } + } else { + if (requestCase_ == 4) { + requestCase_ = 0; + request_ = null; + } + commitRequestBuilder_.clear(); + } + return this; + } + /** + * .google.spannerlib.v1.Connection commit_request = 4; + */ + public com.google.cloud.spannerlib.v1.Connection.Builder getCommitRequestBuilder() { + return internalGetCommitRequestFieldBuilder().getBuilder(); + } + /** + * .google.spannerlib.v1.Connection commit_request = 4; + */ + @java.lang.Override + public com.google.cloud.spannerlib.v1.ConnectionOrBuilder getCommitRequestOrBuilder() { + if ((requestCase_ == 4) && (commitRequestBuilder_ != null)) { + return commitRequestBuilder_.getMessageOrBuilder(); + } else { + if (requestCase_ == 4) { + return (com.google.cloud.spannerlib.v1.Connection) request_; + } + return com.google.cloud.spannerlib.v1.Connection.getDefaultInstance(); + } + } + /** + * .google.spannerlib.v1.Connection commit_request = 4; + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.cloud.spannerlib.v1.Connection, com.google.cloud.spannerlib.v1.Connection.Builder, com.google.cloud.spannerlib.v1.ConnectionOrBuilder> + internalGetCommitRequestFieldBuilder() { + if (commitRequestBuilder_ == null) { + if (!(requestCase_ == 4)) { + request_ = com.google.cloud.spannerlib.v1.Connection.getDefaultInstance(); + } + commitRequestBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.google.cloud.spannerlib.v1.Connection, com.google.cloud.spannerlib.v1.Connection.Builder, com.google.cloud.spannerlib.v1.ConnectionOrBuilder>( + (com.google.cloud.spannerlib.v1.Connection) request_, + getParentForChildren(), + isClean()); + request_ = null; + } + requestCase_ = 4; + onChanged(); + return commitRequestBuilder_; + } + + private com.google.protobuf.SingleFieldBuilder< + com.google.cloud.spannerlib.v1.Connection, com.google.cloud.spannerlib.v1.Connection.Builder, com.google.cloud.spannerlib.v1.ConnectionOrBuilder> rollbackRequestBuilder_; + /** + * .google.spannerlib.v1.Connection rollback_request = 5; + * @return Whether the rollbackRequest field is set. + */ + @java.lang.Override + public boolean hasRollbackRequest() { + return requestCase_ == 5; + } + /** + * .google.spannerlib.v1.Connection rollback_request = 5; + * @return The rollbackRequest. + */ + @java.lang.Override + public com.google.cloud.spannerlib.v1.Connection getRollbackRequest() { + if (rollbackRequestBuilder_ == null) { + if (requestCase_ == 5) { + return (com.google.cloud.spannerlib.v1.Connection) request_; + } + return com.google.cloud.spannerlib.v1.Connection.getDefaultInstance(); + } else { + if (requestCase_ == 5) { + return rollbackRequestBuilder_.getMessage(); + } + return com.google.cloud.spannerlib.v1.Connection.getDefaultInstance(); + } + } + /** + * .google.spannerlib.v1.Connection rollback_request = 5; + */ + public Builder setRollbackRequest(com.google.cloud.spannerlib.v1.Connection value) { + if (rollbackRequestBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + request_ = value; + onChanged(); + } else { + rollbackRequestBuilder_.setMessage(value); + } + requestCase_ = 5; + return this; + } + /** + * .google.spannerlib.v1.Connection rollback_request = 5; + */ + public Builder setRollbackRequest( + com.google.cloud.spannerlib.v1.Connection.Builder builderForValue) { + if (rollbackRequestBuilder_ == null) { + request_ = builderForValue.build(); + onChanged(); + } else { + rollbackRequestBuilder_.setMessage(builderForValue.build()); + } + requestCase_ = 5; + return this; + } + /** + * .google.spannerlib.v1.Connection rollback_request = 5; + */ + public Builder mergeRollbackRequest(com.google.cloud.spannerlib.v1.Connection value) { + if (rollbackRequestBuilder_ == null) { + if (requestCase_ == 5 && + request_ != com.google.cloud.spannerlib.v1.Connection.getDefaultInstance()) { + request_ = com.google.cloud.spannerlib.v1.Connection.newBuilder((com.google.cloud.spannerlib.v1.Connection) request_) + .mergeFrom(value).buildPartial(); + } else { + request_ = value; + } + onChanged(); + } else { + if (requestCase_ == 5) { + rollbackRequestBuilder_.mergeFrom(value); + } else { + rollbackRequestBuilder_.setMessage(value); + } + } + requestCase_ = 5; + return this; + } + /** + * .google.spannerlib.v1.Connection rollback_request = 5; + */ + public Builder clearRollbackRequest() { + if (rollbackRequestBuilder_ == null) { + if (requestCase_ == 5) { + requestCase_ = 0; + request_ = null; + onChanged(); + } + } else { + if (requestCase_ == 5) { + requestCase_ = 0; + request_ = null; + } + rollbackRequestBuilder_.clear(); + } + return this; + } + /** + * .google.spannerlib.v1.Connection rollback_request = 5; + */ + public com.google.cloud.spannerlib.v1.Connection.Builder getRollbackRequestBuilder() { + return internalGetRollbackRequestFieldBuilder().getBuilder(); + } + /** + * .google.spannerlib.v1.Connection rollback_request = 5; + */ + @java.lang.Override + public com.google.cloud.spannerlib.v1.ConnectionOrBuilder getRollbackRequestOrBuilder() { + if ((requestCase_ == 5) && (rollbackRequestBuilder_ != null)) { + return rollbackRequestBuilder_.getMessageOrBuilder(); + } else { + if (requestCase_ == 5) { + return (com.google.cloud.spannerlib.v1.Connection) request_; + } + return com.google.cloud.spannerlib.v1.Connection.getDefaultInstance(); + } + } + /** + * .google.spannerlib.v1.Connection rollback_request = 5; + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.cloud.spannerlib.v1.Connection, com.google.cloud.spannerlib.v1.Connection.Builder, com.google.cloud.spannerlib.v1.ConnectionOrBuilder> + internalGetRollbackRequestFieldBuilder() { + if (rollbackRequestBuilder_ == null) { + if (!(requestCase_ == 5)) { + request_ = com.google.cloud.spannerlib.v1.Connection.getDefaultInstance(); + } + rollbackRequestBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.google.cloud.spannerlib.v1.Connection, com.google.cloud.spannerlib.v1.Connection.Builder, com.google.cloud.spannerlib.v1.ConnectionOrBuilder>( + (com.google.cloud.spannerlib.v1.Connection) request_, + getParentForChildren(), + isClean()); + request_ = null; + } + requestCase_ = 5; + onChanged(); + return rollbackRequestBuilder_; + } + + private com.google.protobuf.SingleFieldBuilder< + com.google.cloud.spannerlib.v1.WriteMutationsRequest, com.google.cloud.spannerlib.v1.WriteMutationsRequest.Builder, com.google.cloud.spannerlib.v1.WriteMutationsRequestOrBuilder> writeMutationsRequestBuilder_; + /** + * .google.spannerlib.v1.WriteMutationsRequest write_mutations_request = 6; + * @return Whether the writeMutationsRequest field is set. + */ + @java.lang.Override + public boolean hasWriteMutationsRequest() { + return requestCase_ == 6; + } + /** + * .google.spannerlib.v1.WriteMutationsRequest write_mutations_request = 6; + * @return The writeMutationsRequest. + */ + @java.lang.Override + public com.google.cloud.spannerlib.v1.WriteMutationsRequest getWriteMutationsRequest() { + if (writeMutationsRequestBuilder_ == null) { + if (requestCase_ == 6) { + return (com.google.cloud.spannerlib.v1.WriteMutationsRequest) request_; + } + return com.google.cloud.spannerlib.v1.WriteMutationsRequest.getDefaultInstance(); + } else { + if (requestCase_ == 6) { + return writeMutationsRequestBuilder_.getMessage(); + } + return com.google.cloud.spannerlib.v1.WriteMutationsRequest.getDefaultInstance(); + } + } + /** + * .google.spannerlib.v1.WriteMutationsRequest write_mutations_request = 6; + */ + public Builder setWriteMutationsRequest(com.google.cloud.spannerlib.v1.WriteMutationsRequest value) { + if (writeMutationsRequestBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + request_ = value; + onChanged(); + } else { + writeMutationsRequestBuilder_.setMessage(value); + } + requestCase_ = 6; + return this; + } + /** + * .google.spannerlib.v1.WriteMutationsRequest write_mutations_request = 6; + */ + public Builder setWriteMutationsRequest( + com.google.cloud.spannerlib.v1.WriteMutationsRequest.Builder builderForValue) { + if (writeMutationsRequestBuilder_ == null) { + request_ = builderForValue.build(); + onChanged(); + } else { + writeMutationsRequestBuilder_.setMessage(builderForValue.build()); + } + requestCase_ = 6; + return this; + } + /** + * .google.spannerlib.v1.WriteMutationsRequest write_mutations_request = 6; + */ + public Builder mergeWriteMutationsRequest(com.google.cloud.spannerlib.v1.WriteMutationsRequest value) { + if (writeMutationsRequestBuilder_ == null) { + if (requestCase_ == 6 && + request_ != com.google.cloud.spannerlib.v1.WriteMutationsRequest.getDefaultInstance()) { + request_ = com.google.cloud.spannerlib.v1.WriteMutationsRequest.newBuilder((com.google.cloud.spannerlib.v1.WriteMutationsRequest) request_) + .mergeFrom(value).buildPartial(); + } else { + request_ = value; + } + onChanged(); + } else { + if (requestCase_ == 6) { + writeMutationsRequestBuilder_.mergeFrom(value); + } else { + writeMutationsRequestBuilder_.setMessage(value); + } + } + requestCase_ = 6; + return this; + } + /** + * .google.spannerlib.v1.WriteMutationsRequest write_mutations_request = 6; + */ + public Builder clearWriteMutationsRequest() { + if (writeMutationsRequestBuilder_ == null) { + if (requestCase_ == 6) { + requestCase_ = 0; + request_ = null; + onChanged(); + } + } else { + if (requestCase_ == 6) { + requestCase_ = 0; + request_ = null; + } + writeMutationsRequestBuilder_.clear(); + } + return this; + } + /** + * .google.spannerlib.v1.WriteMutationsRequest write_mutations_request = 6; + */ + public com.google.cloud.spannerlib.v1.WriteMutationsRequest.Builder getWriteMutationsRequestBuilder() { + return internalGetWriteMutationsRequestFieldBuilder().getBuilder(); + } + /** + * .google.spannerlib.v1.WriteMutationsRequest write_mutations_request = 6; + */ + @java.lang.Override + public com.google.cloud.spannerlib.v1.WriteMutationsRequestOrBuilder getWriteMutationsRequestOrBuilder() { + if ((requestCase_ == 6) && (writeMutationsRequestBuilder_ != null)) { + return writeMutationsRequestBuilder_.getMessageOrBuilder(); + } else { + if (requestCase_ == 6) { + return (com.google.cloud.spannerlib.v1.WriteMutationsRequest) request_; + } + return com.google.cloud.spannerlib.v1.WriteMutationsRequest.getDefaultInstance(); + } + } + /** + * .google.spannerlib.v1.WriteMutationsRequest write_mutations_request = 6; + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.cloud.spannerlib.v1.WriteMutationsRequest, com.google.cloud.spannerlib.v1.WriteMutationsRequest.Builder, com.google.cloud.spannerlib.v1.WriteMutationsRequestOrBuilder> + internalGetWriteMutationsRequestFieldBuilder() { + if (writeMutationsRequestBuilder_ == null) { + if (!(requestCase_ == 6)) { + request_ = com.google.cloud.spannerlib.v1.WriteMutationsRequest.getDefaultInstance(); + } + writeMutationsRequestBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.google.cloud.spannerlib.v1.WriteMutationsRequest, com.google.cloud.spannerlib.v1.WriteMutationsRequest.Builder, com.google.cloud.spannerlib.v1.WriteMutationsRequestOrBuilder>( + (com.google.cloud.spannerlib.v1.WriteMutationsRequest) request_, + getParentForChildren(), + isClean()); + request_ = null; + } + requestCase_ = 6; + onChanged(); + return writeMutationsRequestBuilder_; + } + // @@protoc_insertion_point(builder_scope:google.spannerlib.v1.ConnectionStreamRequest) } diff --git a/spannerlib/wrappers/spannerlib-java/src/main/java/com/google/cloud/spannerlib/v1/ConnectionStreamRequestOrBuilder.java b/spannerlib/wrappers/spannerlib-java/src/main/java/com/google/cloud/spannerlib/v1/ConnectionStreamRequestOrBuilder.java index cc414685..dd36c31f 100644 --- a/spannerlib/wrappers/spannerlib-java/src/main/java/com/google/cloud/spannerlib/v1/ConnectionStreamRequestOrBuilder.java +++ b/spannerlib/wrappers/spannerlib-java/src/main/java/com/google/cloud/spannerlib/v1/ConnectionStreamRequestOrBuilder.java @@ -25,5 +25,80 @@ public interface ConnectionStreamRequestOrBuilder extends */ com.google.cloud.spannerlib.v1.ExecuteRequestOrBuilder getExecuteRequestOrBuilder(); + /** + * .google.spannerlib.v1.ExecuteBatchRequest execute_batch_request = 2; + * @return Whether the executeBatchRequest field is set. + */ + boolean hasExecuteBatchRequest(); + /** + * .google.spannerlib.v1.ExecuteBatchRequest execute_batch_request = 2; + * @return The executeBatchRequest. + */ + com.google.cloud.spannerlib.v1.ExecuteBatchRequest getExecuteBatchRequest(); + /** + * .google.spannerlib.v1.ExecuteBatchRequest execute_batch_request = 2; + */ + com.google.cloud.spannerlib.v1.ExecuteBatchRequestOrBuilder getExecuteBatchRequestOrBuilder(); + + /** + * .google.spannerlib.v1.BeginTransactionRequest begin_transaction_request = 3; + * @return Whether the beginTransactionRequest field is set. + */ + boolean hasBeginTransactionRequest(); + /** + * .google.spannerlib.v1.BeginTransactionRequest begin_transaction_request = 3; + * @return The beginTransactionRequest. + */ + com.google.cloud.spannerlib.v1.BeginTransactionRequest getBeginTransactionRequest(); + /** + * .google.spannerlib.v1.BeginTransactionRequest begin_transaction_request = 3; + */ + com.google.cloud.spannerlib.v1.BeginTransactionRequestOrBuilder getBeginTransactionRequestOrBuilder(); + + /** + * .google.spannerlib.v1.Connection commit_request = 4; + * @return Whether the commitRequest field is set. + */ + boolean hasCommitRequest(); + /** + * .google.spannerlib.v1.Connection commit_request = 4; + * @return The commitRequest. + */ + com.google.cloud.spannerlib.v1.Connection getCommitRequest(); + /** + * .google.spannerlib.v1.Connection commit_request = 4; + */ + com.google.cloud.spannerlib.v1.ConnectionOrBuilder getCommitRequestOrBuilder(); + + /** + * .google.spannerlib.v1.Connection rollback_request = 5; + * @return Whether the rollbackRequest field is set. + */ + boolean hasRollbackRequest(); + /** + * .google.spannerlib.v1.Connection rollback_request = 5; + * @return The rollbackRequest. + */ + com.google.cloud.spannerlib.v1.Connection getRollbackRequest(); + /** + * .google.spannerlib.v1.Connection rollback_request = 5; + */ + com.google.cloud.spannerlib.v1.ConnectionOrBuilder getRollbackRequestOrBuilder(); + + /** + * .google.spannerlib.v1.WriteMutationsRequest write_mutations_request = 6; + * @return Whether the writeMutationsRequest field is set. + */ + boolean hasWriteMutationsRequest(); + /** + * .google.spannerlib.v1.WriteMutationsRequest write_mutations_request = 6; + * @return The writeMutationsRequest. + */ + com.google.cloud.spannerlib.v1.WriteMutationsRequest getWriteMutationsRequest(); + /** + * .google.spannerlib.v1.WriteMutationsRequest write_mutations_request = 6; + */ + com.google.cloud.spannerlib.v1.WriteMutationsRequestOrBuilder getWriteMutationsRequestOrBuilder(); + com.google.cloud.spannerlib.v1.ConnectionStreamRequest.RequestCase getRequestCase(); } diff --git a/spannerlib/wrappers/spannerlib-java/src/main/java/com/google/cloud/spannerlib/v1/ConnectionStreamResponse.java b/spannerlib/wrappers/spannerlib-java/src/main/java/com/google/cloud/spannerlib/v1/ConnectionStreamResponse.java index b12f8f27..4165465b 100644 --- a/spannerlib/wrappers/spannerlib-java/src/main/java/com/google/cloud/spannerlib/v1/ConnectionStreamResponse.java +++ b/spannerlib/wrappers/spannerlib-java/src/main/java/com/google/cloud/spannerlib/v1/ConnectionStreamResponse.java @@ -6,6 +6,16 @@ package com.google.cloud.spannerlib.v1; /** + *
+ * ConnectionStreamResponse is returned by the server when it receives a ConnectionStreamRequest.
+ * The contents of the response depends on the request that the client sent.
+ *
+ * The response contains a Status that indicates whether the request succeeded or not. The stream
+ * itself normally does not return an error if a request fails.
+ * The stream only returns an error and is discontinued in case of a network error or other
+ * unexpected internal errors.
+ * 
+ * * Protobuf type {@code google.spannerlib.v1.ConnectionStreamResponse} */ @com.google.protobuf.Generated @@ -43,13 +53,19 @@ private ConnectionStreamResponse() { com.google.cloud.spannerlib.v1.ConnectionStreamResponse.class, com.google.cloud.spannerlib.v1.ConnectionStreamResponse.Builder.class); } + private int bitField0_; private int responseCase_ = 0; @SuppressWarnings("serial") private java.lang.Object response_; public enum ResponseCase implements com.google.protobuf.Internal.EnumLite, com.google.protobuf.AbstractMessage.InternalOneOfEnum { - ROW(1), + EXECUTE_RESPONSE(2), + EXECUTE_BATCH_RESPONSE(3), + BEGIN_TRANSACTION_RESPONSE(4), + COMMIT_RESPONSE(5), + ROLLBACK_RESPONSE(6), + WRITE_MUTATIONS_RESPONSE(7), RESPONSE_NOT_SET(0); private final int value; private ResponseCase(int value) { @@ -67,7 +83,12 @@ public static ResponseCase valueOf(int value) { public static ResponseCase forNumber(int value) { switch (value) { - case 1: return ROW; + case 2: return EXECUTE_RESPONSE; + case 3: return EXECUTE_BATCH_RESPONSE; + case 4: return BEGIN_TRANSACTION_RESPONSE; + case 5: return COMMIT_RESPONSE; + case 6: return ROLLBACK_RESPONSE; + case 7: return WRITE_MUTATIONS_RESPONSE; case 0: return RESPONSE_NOT_SET; default: return null; } @@ -83,35 +104,231 @@ public int getNumber() { responseCase_); } - public static final int ROW_FIELD_NUMBER = 1; + public static final int STATUS_FIELD_NUMBER = 1; + private com.google.rpc.Status status_; /** - * .google.spanner.v1.PartialResultSet row = 1; - * @return Whether the row field is set. + *
+   * Status indicates whether the request succeeded or failed. The response field only contains
+   * a value if the status code is OK.
+   * 
+ * + * .google.rpc.Status status = 1; + * @return Whether the status field is set. */ @java.lang.Override - public boolean hasRow() { - return responseCase_ == 1; + public boolean hasStatus() { + return ((bitField0_ & 0x00000001) != 0); } /** - * .google.spanner.v1.PartialResultSet row = 1; - * @return The row. + *
+   * Status indicates whether the request succeeded or failed. The response field only contains
+   * a value if the status code is OK.
+   * 
+ * + * .google.rpc.Status status = 1; + * @return The status. */ @java.lang.Override - public com.google.spanner.v1.PartialResultSet getRow() { - if (responseCase_ == 1) { - return (com.google.spanner.v1.PartialResultSet) response_; + public com.google.rpc.Status getStatus() { + return status_ == null ? com.google.rpc.Status.getDefaultInstance() : status_; + } + /** + *
+   * Status indicates whether the request succeeded or failed. The response field only contains
+   * a value if the status code is OK.
+   * 
+ * + * .google.rpc.Status status = 1; + */ + @java.lang.Override + public com.google.rpc.StatusOrBuilder getStatusOrBuilder() { + return status_ == null ? com.google.rpc.Status.getDefaultInstance() : status_; + } + + public static final int EXECUTE_RESPONSE_FIELD_NUMBER = 2; + /** + * .google.spannerlib.v1.ExecuteResponse execute_response = 2; + * @return Whether the executeResponse field is set. + */ + @java.lang.Override + public boolean hasExecuteResponse() { + return responseCase_ == 2; + } + /** + * .google.spannerlib.v1.ExecuteResponse execute_response = 2; + * @return The executeResponse. + */ + @java.lang.Override + public com.google.cloud.spannerlib.v1.ExecuteResponse getExecuteResponse() { + if (responseCase_ == 2) { + return (com.google.cloud.spannerlib.v1.ExecuteResponse) response_; + } + return com.google.cloud.spannerlib.v1.ExecuteResponse.getDefaultInstance(); + } + /** + * .google.spannerlib.v1.ExecuteResponse execute_response = 2; + */ + @java.lang.Override + public com.google.cloud.spannerlib.v1.ExecuteResponseOrBuilder getExecuteResponseOrBuilder() { + if (responseCase_ == 2) { + return (com.google.cloud.spannerlib.v1.ExecuteResponse) response_; + } + return com.google.cloud.spannerlib.v1.ExecuteResponse.getDefaultInstance(); + } + + public static final int EXECUTE_BATCH_RESPONSE_FIELD_NUMBER = 3; + /** + * .google.spanner.v1.ExecuteBatchDmlResponse execute_batch_response = 3; + * @return Whether the executeBatchResponse field is set. + */ + @java.lang.Override + public boolean hasExecuteBatchResponse() { + return responseCase_ == 3; + } + /** + * .google.spanner.v1.ExecuteBatchDmlResponse execute_batch_response = 3; + * @return The executeBatchResponse. + */ + @java.lang.Override + public com.google.spanner.v1.ExecuteBatchDmlResponse getExecuteBatchResponse() { + if (responseCase_ == 3) { + return (com.google.spanner.v1.ExecuteBatchDmlResponse) response_; + } + return com.google.spanner.v1.ExecuteBatchDmlResponse.getDefaultInstance(); + } + /** + * .google.spanner.v1.ExecuteBatchDmlResponse execute_batch_response = 3; + */ + @java.lang.Override + public com.google.spanner.v1.ExecuteBatchDmlResponseOrBuilder getExecuteBatchResponseOrBuilder() { + if (responseCase_ == 3) { + return (com.google.spanner.v1.ExecuteBatchDmlResponse) response_; + } + return com.google.spanner.v1.ExecuteBatchDmlResponse.getDefaultInstance(); + } + + public static final int BEGIN_TRANSACTION_RESPONSE_FIELD_NUMBER = 4; + /** + * .google.protobuf.Empty begin_transaction_response = 4; + * @return Whether the beginTransactionResponse field is set. + */ + @java.lang.Override + public boolean hasBeginTransactionResponse() { + return responseCase_ == 4; + } + /** + * .google.protobuf.Empty begin_transaction_response = 4; + * @return The beginTransactionResponse. + */ + @java.lang.Override + public com.google.protobuf.Empty getBeginTransactionResponse() { + if (responseCase_ == 4) { + return (com.google.protobuf.Empty) response_; + } + return com.google.protobuf.Empty.getDefaultInstance(); + } + /** + * .google.protobuf.Empty begin_transaction_response = 4; + */ + @java.lang.Override + public com.google.protobuf.EmptyOrBuilder getBeginTransactionResponseOrBuilder() { + if (responseCase_ == 4) { + return (com.google.protobuf.Empty) response_; + } + return com.google.protobuf.Empty.getDefaultInstance(); + } + + public static final int COMMIT_RESPONSE_FIELD_NUMBER = 5; + /** + * .google.spanner.v1.CommitResponse commit_response = 5; + * @return Whether the commitResponse field is set. + */ + @java.lang.Override + public boolean hasCommitResponse() { + return responseCase_ == 5; + } + /** + * .google.spanner.v1.CommitResponse commit_response = 5; + * @return The commitResponse. + */ + @java.lang.Override + public com.google.spanner.v1.CommitResponse getCommitResponse() { + if (responseCase_ == 5) { + return (com.google.spanner.v1.CommitResponse) response_; + } + return com.google.spanner.v1.CommitResponse.getDefaultInstance(); + } + /** + * .google.spanner.v1.CommitResponse commit_response = 5; + */ + @java.lang.Override + public com.google.spanner.v1.CommitResponseOrBuilder getCommitResponseOrBuilder() { + if (responseCase_ == 5) { + return (com.google.spanner.v1.CommitResponse) response_; + } + return com.google.spanner.v1.CommitResponse.getDefaultInstance(); + } + + public static final int ROLLBACK_RESPONSE_FIELD_NUMBER = 6; + /** + * .google.protobuf.Empty rollback_response = 6; + * @return Whether the rollbackResponse field is set. + */ + @java.lang.Override + public boolean hasRollbackResponse() { + return responseCase_ == 6; + } + /** + * .google.protobuf.Empty rollback_response = 6; + * @return The rollbackResponse. + */ + @java.lang.Override + public com.google.protobuf.Empty getRollbackResponse() { + if (responseCase_ == 6) { + return (com.google.protobuf.Empty) response_; + } + return com.google.protobuf.Empty.getDefaultInstance(); + } + /** + * .google.protobuf.Empty rollback_response = 6; + */ + @java.lang.Override + public com.google.protobuf.EmptyOrBuilder getRollbackResponseOrBuilder() { + if (responseCase_ == 6) { + return (com.google.protobuf.Empty) response_; + } + return com.google.protobuf.Empty.getDefaultInstance(); + } + + public static final int WRITE_MUTATIONS_RESPONSE_FIELD_NUMBER = 7; + /** + * .google.spanner.v1.CommitResponse write_mutations_response = 7; + * @return Whether the writeMutationsResponse field is set. + */ + @java.lang.Override + public boolean hasWriteMutationsResponse() { + return responseCase_ == 7; + } + /** + * .google.spanner.v1.CommitResponse write_mutations_response = 7; + * @return The writeMutationsResponse. + */ + @java.lang.Override + public com.google.spanner.v1.CommitResponse getWriteMutationsResponse() { + if (responseCase_ == 7) { + return (com.google.spanner.v1.CommitResponse) response_; } - return com.google.spanner.v1.PartialResultSet.getDefaultInstance(); + return com.google.spanner.v1.CommitResponse.getDefaultInstance(); } /** - * .google.spanner.v1.PartialResultSet row = 1; + * .google.spanner.v1.CommitResponse write_mutations_response = 7; */ @java.lang.Override - public com.google.spanner.v1.PartialResultSetOrBuilder getRowOrBuilder() { - if (responseCase_ == 1) { - return (com.google.spanner.v1.PartialResultSet) response_; + public com.google.spanner.v1.CommitResponseOrBuilder getWriteMutationsResponseOrBuilder() { + if (responseCase_ == 7) { + return (com.google.spanner.v1.CommitResponse) response_; } - return com.google.spanner.v1.PartialResultSet.getDefaultInstance(); + return com.google.spanner.v1.CommitResponse.getDefaultInstance(); } private byte memoizedIsInitialized = -1; @@ -128,8 +345,26 @@ public final boolean isInitialized() { @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (responseCase_ == 1) { - output.writeMessage(1, (com.google.spanner.v1.PartialResultSet) response_); + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(1, getStatus()); + } + if (responseCase_ == 2) { + output.writeMessage(2, (com.google.cloud.spannerlib.v1.ExecuteResponse) response_); + } + if (responseCase_ == 3) { + output.writeMessage(3, (com.google.spanner.v1.ExecuteBatchDmlResponse) response_); + } + if (responseCase_ == 4) { + output.writeMessage(4, (com.google.protobuf.Empty) response_); + } + if (responseCase_ == 5) { + output.writeMessage(5, (com.google.spanner.v1.CommitResponse) response_); + } + if (responseCase_ == 6) { + output.writeMessage(6, (com.google.protobuf.Empty) response_); + } + if (responseCase_ == 7) { + output.writeMessage(7, (com.google.spanner.v1.CommitResponse) response_); } getUnknownFields().writeTo(output); } @@ -140,9 +375,33 @@ public int getSerializedSize() { if (size != -1) return size; size = 0; - if (responseCase_ == 1) { + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, getStatus()); + } + if (responseCase_ == 2) { size += com.google.protobuf.CodedOutputStream - .computeMessageSize(1, (com.google.spanner.v1.PartialResultSet) response_); + .computeMessageSize(2, (com.google.cloud.spannerlib.v1.ExecuteResponse) response_); + } + if (responseCase_ == 3) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, (com.google.spanner.v1.ExecuteBatchDmlResponse) response_); + } + if (responseCase_ == 4) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(4, (com.google.protobuf.Empty) response_); + } + if (responseCase_ == 5) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(5, (com.google.spanner.v1.CommitResponse) response_); + } + if (responseCase_ == 6) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(6, (com.google.protobuf.Empty) response_); + } + if (responseCase_ == 7) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(7, (com.google.spanner.v1.CommitResponse) response_); } size += getUnknownFields().getSerializedSize(); memoizedSize = size; @@ -159,11 +418,36 @@ public boolean equals(final java.lang.Object obj) { } com.google.cloud.spannerlib.v1.ConnectionStreamResponse other = (com.google.cloud.spannerlib.v1.ConnectionStreamResponse) obj; + if (hasStatus() != other.hasStatus()) return false; + if (hasStatus()) { + if (!getStatus() + .equals(other.getStatus())) return false; + } if (!getResponseCase().equals(other.getResponseCase())) return false; switch (responseCase_) { - case 1: - if (!getRow() - .equals(other.getRow())) return false; + case 2: + if (!getExecuteResponse() + .equals(other.getExecuteResponse())) return false; + break; + case 3: + if (!getExecuteBatchResponse() + .equals(other.getExecuteBatchResponse())) return false; + break; + case 4: + if (!getBeginTransactionResponse() + .equals(other.getBeginTransactionResponse())) return false; + break; + case 5: + if (!getCommitResponse() + .equals(other.getCommitResponse())) return false; + break; + case 6: + if (!getRollbackResponse() + .equals(other.getRollbackResponse())) return false; + break; + case 7: + if (!getWriteMutationsResponse() + .equals(other.getWriteMutationsResponse())) return false; break; case 0: default: @@ -179,10 +463,34 @@ public int hashCode() { } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); + if (hasStatus()) { + hash = (37 * hash) + STATUS_FIELD_NUMBER; + hash = (53 * hash) + getStatus().hashCode(); + } switch (responseCase_) { - case 1: - hash = (37 * hash) + ROW_FIELD_NUMBER; - hash = (53 * hash) + getRow().hashCode(); + case 2: + hash = (37 * hash) + EXECUTE_RESPONSE_FIELD_NUMBER; + hash = (53 * hash) + getExecuteResponse().hashCode(); + break; + case 3: + hash = (37 * hash) + EXECUTE_BATCH_RESPONSE_FIELD_NUMBER; + hash = (53 * hash) + getExecuteBatchResponse().hashCode(); + break; + case 4: + hash = (37 * hash) + BEGIN_TRANSACTION_RESPONSE_FIELD_NUMBER; + hash = (53 * hash) + getBeginTransactionResponse().hashCode(); + break; + case 5: + hash = (37 * hash) + COMMIT_RESPONSE_FIELD_NUMBER; + hash = (53 * hash) + getCommitResponse().hashCode(); + break; + case 6: + hash = (37 * hash) + ROLLBACK_RESPONSE_FIELD_NUMBER; + hash = (53 * hash) + getRollbackResponse().hashCode(); + break; + case 7: + hash = (37 * hash) + WRITE_MUTATIONS_RESPONSE_FIELD_NUMBER; + hash = (53 * hash) + getWriteMutationsResponse().hashCode(); break; case 0: default: @@ -285,6 +593,16 @@ protected Builder newBuilderForType( return builder; } /** + *
+   * ConnectionStreamResponse is returned by the server when it receives a ConnectionStreamRequest.
+   * The contents of the response depends on the request that the client sent.
+   *
+   * The response contains a Status that indicates whether the request succeeded or not. The stream
+   * itself normally does not return an error if a request fails.
+   * The stream only returns an error and is discontinued in case of a network error or other
+   * unexpected internal errors.
+   * 
+ * * Protobuf type {@code google.spannerlib.v1.ConnectionStreamResponse} */ public static final class Builder extends @@ -306,20 +624,46 @@ public static final class Builder extends // Construct using com.google.cloud.spannerlib.v1.ConnectionStreamResponse.newBuilder() private Builder() { - + maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); - + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage + .alwaysUseFieldBuilders) { + internalGetStatusFieldBuilder(); + } } @java.lang.Override public Builder clear() { super.clear(); bitField0_ = 0; - if (rowBuilder_ != null) { - rowBuilder_.clear(); + status_ = null; + if (statusBuilder_ != null) { + statusBuilder_.dispose(); + statusBuilder_ = null; + } + if (executeResponseBuilder_ != null) { + executeResponseBuilder_.clear(); + } + if (executeBatchResponseBuilder_ != null) { + executeBatchResponseBuilder_.clear(); + } + if (beginTransactionResponseBuilder_ != null) { + beginTransactionResponseBuilder_.clear(); + } + if (commitResponseBuilder_ != null) { + commitResponseBuilder_.clear(); + } + if (rollbackResponseBuilder_ != null) { + rollbackResponseBuilder_.clear(); + } + if (writeMutationsResponseBuilder_ != null) { + writeMutationsResponseBuilder_.clear(); } responseCase_ = 0; response_ = null; @@ -357,14 +701,42 @@ public com.google.cloud.spannerlib.v1.ConnectionStreamResponse buildPartial() { private void buildPartial0(com.google.cloud.spannerlib.v1.ConnectionStreamResponse result) { int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.status_ = statusBuilder_ == null + ? status_ + : statusBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + result.bitField0_ |= to_bitField0_; } private void buildPartialOneofs(com.google.cloud.spannerlib.v1.ConnectionStreamResponse result) { result.responseCase_ = responseCase_; result.response_ = this.response_; - if (responseCase_ == 1 && - rowBuilder_ != null) { - result.response_ = rowBuilder_.build(); + if (responseCase_ == 2 && + executeResponseBuilder_ != null) { + result.response_ = executeResponseBuilder_.build(); + } + if (responseCase_ == 3 && + executeBatchResponseBuilder_ != null) { + result.response_ = executeBatchResponseBuilder_.build(); + } + if (responseCase_ == 4 && + beginTransactionResponseBuilder_ != null) { + result.response_ = beginTransactionResponseBuilder_.build(); + } + if (responseCase_ == 5 && + commitResponseBuilder_ != null) { + result.response_ = commitResponseBuilder_.build(); + } + if (responseCase_ == 6 && + rollbackResponseBuilder_ != null) { + result.response_ = rollbackResponseBuilder_.build(); + } + if (responseCase_ == 7 && + writeMutationsResponseBuilder_ != null) { + result.response_ = writeMutationsResponseBuilder_.build(); } } @@ -380,9 +752,32 @@ public Builder mergeFrom(com.google.protobuf.Message other) { public Builder mergeFrom(com.google.cloud.spannerlib.v1.ConnectionStreamResponse other) { if (other == com.google.cloud.spannerlib.v1.ConnectionStreamResponse.getDefaultInstance()) return this; + if (other.hasStatus()) { + mergeStatus(other.getStatus()); + } switch (other.getResponseCase()) { - case ROW: { - mergeRow(other.getRow()); + case EXECUTE_RESPONSE: { + mergeExecuteResponse(other.getExecuteResponse()); + break; + } + case EXECUTE_BATCH_RESPONSE: { + mergeExecuteBatchResponse(other.getExecuteBatchResponse()); + break; + } + case BEGIN_TRANSACTION_RESPONSE: { + mergeBeginTransactionResponse(other.getBeginTransactionResponse()); + break; + } + case COMMIT_RESPONSE: { + mergeCommitResponse(other.getCommitResponse()); + break; + } + case ROLLBACK_RESPONSE: { + mergeRollbackResponse(other.getRollbackResponse()); + break; + } + case WRITE_MUTATIONS_RESPONSE: { + mergeWriteMutationsResponse(other.getWriteMutationsResponse()); break; } case RESPONSE_NOT_SET: { @@ -417,11 +812,53 @@ public Builder mergeFrom( break; case 10: { input.readMessage( - internalGetRowFieldBuilder().getBuilder(), + internalGetStatusFieldBuilder().getBuilder(), extensionRegistry); - responseCase_ = 1; + bitField0_ |= 0x00000001; break; } // case 10 + case 18: { + input.readMessage( + internalGetExecuteResponseFieldBuilder().getBuilder(), + extensionRegistry); + responseCase_ = 2; + break; + } // case 18 + case 26: { + input.readMessage( + internalGetExecuteBatchResponseFieldBuilder().getBuilder(), + extensionRegistry); + responseCase_ = 3; + break; + } // case 26 + case 34: { + input.readMessage( + internalGetBeginTransactionResponseFieldBuilder().getBuilder(), + extensionRegistry); + responseCase_ = 4; + break; + } // case 34 + case 42: { + input.readMessage( + internalGetCommitResponseFieldBuilder().getBuilder(), + extensionRegistry); + responseCase_ = 5; + break; + } // case 42 + case 50: { + input.readMessage( + internalGetRollbackResponseFieldBuilder().getBuilder(), + extensionRegistry); + responseCase_ = 6; + break; + } // case 50 + case 58: { + input.readMessage( + internalGetWriteMutationsResponseFieldBuilder().getBuilder(), + extensionRegistry); + responseCase_ = 7; + break; + } // case 58 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { done = true; // was an endgroup tag @@ -454,146 +891,1022 @@ public Builder clearResponse() { private int bitField0_; + private com.google.rpc.Status status_; + private com.google.protobuf.SingleFieldBuilder< + com.google.rpc.Status, com.google.rpc.Status.Builder, com.google.rpc.StatusOrBuilder> statusBuilder_; + /** + *
+     * Status indicates whether the request succeeded or failed. The response field only contains
+     * a value if the status code is OK.
+     * 
+ * + * .google.rpc.Status status = 1; + * @return Whether the status field is set. + */ + public boolean hasStatus() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + *
+     * Status indicates whether the request succeeded or failed. The response field only contains
+     * a value if the status code is OK.
+     * 
+ * + * .google.rpc.Status status = 1; + * @return The status. + */ + public com.google.rpc.Status getStatus() { + if (statusBuilder_ == null) { + return status_ == null ? com.google.rpc.Status.getDefaultInstance() : status_; + } else { + return statusBuilder_.getMessage(); + } + } + /** + *
+     * Status indicates whether the request succeeded or failed. The response field only contains
+     * a value if the status code is OK.
+     * 
+ * + * .google.rpc.Status status = 1; + */ + public Builder setStatus(com.google.rpc.Status value) { + if (statusBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + status_ = value; + } else { + statusBuilder_.setMessage(value); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * Status indicates whether the request succeeded or failed. The response field only contains
+     * a value if the status code is OK.
+     * 
+ * + * .google.rpc.Status status = 1; + */ + public Builder setStatus( + com.google.rpc.Status.Builder builderForValue) { + if (statusBuilder_ == null) { + status_ = builderForValue.build(); + } else { + statusBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * Status indicates whether the request succeeded or failed. The response field only contains
+     * a value if the status code is OK.
+     * 
+ * + * .google.rpc.Status status = 1; + */ + public Builder mergeStatus(com.google.rpc.Status value) { + if (statusBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0) && + status_ != null && + status_ != com.google.rpc.Status.getDefaultInstance()) { + getStatusBuilder().mergeFrom(value); + } else { + status_ = value; + } + } else { + statusBuilder_.mergeFrom(value); + } + if (status_ != null) { + bitField0_ |= 0x00000001; + onChanged(); + } + return this; + } + /** + *
+     * Status indicates whether the request succeeded or failed. The response field only contains
+     * a value if the status code is OK.
+     * 
+ * + * .google.rpc.Status status = 1; + */ + public Builder clearStatus() { + bitField0_ = (bitField0_ & ~0x00000001); + status_ = null; + if (statusBuilder_ != null) { + statusBuilder_.dispose(); + statusBuilder_ = null; + } + onChanged(); + return this; + } + /** + *
+     * Status indicates whether the request succeeded or failed. The response field only contains
+     * a value if the status code is OK.
+     * 
+ * + * .google.rpc.Status status = 1; + */ + public com.google.rpc.Status.Builder getStatusBuilder() { + bitField0_ |= 0x00000001; + onChanged(); + return internalGetStatusFieldBuilder().getBuilder(); + } + /** + *
+     * Status indicates whether the request succeeded or failed. The response field only contains
+     * a value if the status code is OK.
+     * 
+ * + * .google.rpc.Status status = 1; + */ + public com.google.rpc.StatusOrBuilder getStatusOrBuilder() { + if (statusBuilder_ != null) { + return statusBuilder_.getMessageOrBuilder(); + } else { + return status_ == null ? + com.google.rpc.Status.getDefaultInstance() : status_; + } + } + /** + *
+     * Status indicates whether the request succeeded or failed. The response field only contains
+     * a value if the status code is OK.
+     * 
+ * + * .google.rpc.Status status = 1; + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.rpc.Status, com.google.rpc.Status.Builder, com.google.rpc.StatusOrBuilder> + internalGetStatusFieldBuilder() { + if (statusBuilder_ == null) { + statusBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.google.rpc.Status, com.google.rpc.Status.Builder, com.google.rpc.StatusOrBuilder>( + getStatus(), + getParentForChildren(), + isClean()); + status_ = null; + } + return statusBuilder_; + } + private com.google.protobuf.SingleFieldBuilder< - com.google.spanner.v1.PartialResultSet, com.google.spanner.v1.PartialResultSet.Builder, com.google.spanner.v1.PartialResultSetOrBuilder> rowBuilder_; + com.google.cloud.spannerlib.v1.ExecuteResponse, com.google.cloud.spannerlib.v1.ExecuteResponse.Builder, com.google.cloud.spannerlib.v1.ExecuteResponseOrBuilder> executeResponseBuilder_; /** - * .google.spanner.v1.PartialResultSet row = 1; - * @return Whether the row field is set. + * .google.spannerlib.v1.ExecuteResponse execute_response = 2; + * @return Whether the executeResponse field is set. */ @java.lang.Override - public boolean hasRow() { - return responseCase_ == 1; + public boolean hasExecuteResponse() { + return responseCase_ == 2; } /** - * .google.spanner.v1.PartialResultSet row = 1; - * @return The row. + * .google.spannerlib.v1.ExecuteResponse execute_response = 2; + * @return The executeResponse. */ @java.lang.Override - public com.google.spanner.v1.PartialResultSet getRow() { - if (rowBuilder_ == null) { - if (responseCase_ == 1) { - return (com.google.spanner.v1.PartialResultSet) response_; + public com.google.cloud.spannerlib.v1.ExecuteResponse getExecuteResponse() { + if (executeResponseBuilder_ == null) { + if (responseCase_ == 2) { + return (com.google.cloud.spannerlib.v1.ExecuteResponse) response_; } - return com.google.spanner.v1.PartialResultSet.getDefaultInstance(); + return com.google.cloud.spannerlib.v1.ExecuteResponse.getDefaultInstance(); } else { - if (responseCase_ == 1) { - return rowBuilder_.getMessage(); + if (responseCase_ == 2) { + return executeResponseBuilder_.getMessage(); } - return com.google.spanner.v1.PartialResultSet.getDefaultInstance(); + return com.google.cloud.spannerlib.v1.ExecuteResponse.getDefaultInstance(); } } /** - * .google.spanner.v1.PartialResultSet row = 1; + * .google.spannerlib.v1.ExecuteResponse execute_response = 2; */ - public Builder setRow(com.google.spanner.v1.PartialResultSet value) { - if (rowBuilder_ == null) { + public Builder setExecuteResponse(com.google.cloud.spannerlib.v1.ExecuteResponse value) { + if (executeResponseBuilder_ == null) { if (value == null) { throw new NullPointerException(); } response_ = value; onChanged(); } else { - rowBuilder_.setMessage(value); + executeResponseBuilder_.setMessage(value); } - responseCase_ = 1; + responseCase_ = 2; return this; } /** - * .google.spanner.v1.PartialResultSet row = 1; + * .google.spannerlib.v1.ExecuteResponse execute_response = 2; */ - public Builder setRow( - com.google.spanner.v1.PartialResultSet.Builder builderForValue) { - if (rowBuilder_ == null) { + public Builder setExecuteResponse( + com.google.cloud.spannerlib.v1.ExecuteResponse.Builder builderForValue) { + if (executeResponseBuilder_ == null) { response_ = builderForValue.build(); onChanged(); } else { - rowBuilder_.setMessage(builderForValue.build()); + executeResponseBuilder_.setMessage(builderForValue.build()); } - responseCase_ = 1; + responseCase_ = 2; return this; } /** - * .google.spanner.v1.PartialResultSet row = 1; + * .google.spannerlib.v1.ExecuteResponse execute_response = 2; */ - public Builder mergeRow(com.google.spanner.v1.PartialResultSet value) { - if (rowBuilder_ == null) { - if (responseCase_ == 1 && - response_ != com.google.spanner.v1.PartialResultSet.getDefaultInstance()) { - response_ = com.google.spanner.v1.PartialResultSet.newBuilder((com.google.spanner.v1.PartialResultSet) response_) + public Builder mergeExecuteResponse(com.google.cloud.spannerlib.v1.ExecuteResponse value) { + if (executeResponseBuilder_ == null) { + if (responseCase_ == 2 && + response_ != com.google.cloud.spannerlib.v1.ExecuteResponse.getDefaultInstance()) { + response_ = com.google.cloud.spannerlib.v1.ExecuteResponse.newBuilder((com.google.cloud.spannerlib.v1.ExecuteResponse) response_) .mergeFrom(value).buildPartial(); } else { response_ = value; } onChanged(); } else { - if (responseCase_ == 1) { - rowBuilder_.mergeFrom(value); + if (responseCase_ == 2) { + executeResponseBuilder_.mergeFrom(value); } else { - rowBuilder_.setMessage(value); + executeResponseBuilder_.setMessage(value); } } - responseCase_ = 1; + responseCase_ = 2; return this; } /** - * .google.spanner.v1.PartialResultSet row = 1; + * .google.spannerlib.v1.ExecuteResponse execute_response = 2; */ - public Builder clearRow() { - if (rowBuilder_ == null) { - if (responseCase_ == 1) { + public Builder clearExecuteResponse() { + if (executeResponseBuilder_ == null) { + if (responseCase_ == 2) { responseCase_ = 0; response_ = null; onChanged(); } } else { - if (responseCase_ == 1) { + if (responseCase_ == 2) { responseCase_ = 0; response_ = null; } - rowBuilder_.clear(); + executeResponseBuilder_.clear(); } return this; } /** - * .google.spanner.v1.PartialResultSet row = 1; + * .google.spannerlib.v1.ExecuteResponse execute_response = 2; */ - public com.google.spanner.v1.PartialResultSet.Builder getRowBuilder() { - return internalGetRowFieldBuilder().getBuilder(); + public com.google.cloud.spannerlib.v1.ExecuteResponse.Builder getExecuteResponseBuilder() { + return internalGetExecuteResponseFieldBuilder().getBuilder(); } /** - * .google.spanner.v1.PartialResultSet row = 1; + * .google.spannerlib.v1.ExecuteResponse execute_response = 2; */ @java.lang.Override - public com.google.spanner.v1.PartialResultSetOrBuilder getRowOrBuilder() { - if ((responseCase_ == 1) && (rowBuilder_ != null)) { - return rowBuilder_.getMessageOrBuilder(); + public com.google.cloud.spannerlib.v1.ExecuteResponseOrBuilder getExecuteResponseOrBuilder() { + if ((responseCase_ == 2) && (executeResponseBuilder_ != null)) { + return executeResponseBuilder_.getMessageOrBuilder(); } else { - if (responseCase_ == 1) { - return (com.google.spanner.v1.PartialResultSet) response_; + if (responseCase_ == 2) { + return (com.google.cloud.spannerlib.v1.ExecuteResponse) response_; } - return com.google.spanner.v1.PartialResultSet.getDefaultInstance(); + return com.google.cloud.spannerlib.v1.ExecuteResponse.getDefaultInstance(); } } /** - * .google.spanner.v1.PartialResultSet row = 1; + * .google.spannerlib.v1.ExecuteResponse execute_response = 2; */ private com.google.protobuf.SingleFieldBuilder< - com.google.spanner.v1.PartialResultSet, com.google.spanner.v1.PartialResultSet.Builder, com.google.spanner.v1.PartialResultSetOrBuilder> - internalGetRowFieldBuilder() { - if (rowBuilder_ == null) { - if (!(responseCase_ == 1)) { - response_ = com.google.spanner.v1.PartialResultSet.getDefaultInstance(); - } - rowBuilder_ = new com.google.protobuf.SingleFieldBuilder< - com.google.spanner.v1.PartialResultSet, com.google.spanner.v1.PartialResultSet.Builder, com.google.spanner.v1.PartialResultSetOrBuilder>( - (com.google.spanner.v1.PartialResultSet) response_, + com.google.cloud.spannerlib.v1.ExecuteResponse, com.google.cloud.spannerlib.v1.ExecuteResponse.Builder, com.google.cloud.spannerlib.v1.ExecuteResponseOrBuilder> + internalGetExecuteResponseFieldBuilder() { + if (executeResponseBuilder_ == null) { + if (!(responseCase_ == 2)) { + response_ = com.google.cloud.spannerlib.v1.ExecuteResponse.getDefaultInstance(); + } + executeResponseBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.google.cloud.spannerlib.v1.ExecuteResponse, com.google.cloud.spannerlib.v1.ExecuteResponse.Builder, com.google.cloud.spannerlib.v1.ExecuteResponseOrBuilder>( + (com.google.cloud.spannerlib.v1.ExecuteResponse) response_, + getParentForChildren(), + isClean()); + response_ = null; + } + responseCase_ = 2; + onChanged(); + return executeResponseBuilder_; + } + + private com.google.protobuf.SingleFieldBuilder< + com.google.spanner.v1.ExecuteBatchDmlResponse, com.google.spanner.v1.ExecuteBatchDmlResponse.Builder, com.google.spanner.v1.ExecuteBatchDmlResponseOrBuilder> executeBatchResponseBuilder_; + /** + * .google.spanner.v1.ExecuteBatchDmlResponse execute_batch_response = 3; + * @return Whether the executeBatchResponse field is set. + */ + @java.lang.Override + public boolean hasExecuteBatchResponse() { + return responseCase_ == 3; + } + /** + * .google.spanner.v1.ExecuteBatchDmlResponse execute_batch_response = 3; + * @return The executeBatchResponse. + */ + @java.lang.Override + public com.google.spanner.v1.ExecuteBatchDmlResponse getExecuteBatchResponse() { + if (executeBatchResponseBuilder_ == null) { + if (responseCase_ == 3) { + return (com.google.spanner.v1.ExecuteBatchDmlResponse) response_; + } + return com.google.spanner.v1.ExecuteBatchDmlResponse.getDefaultInstance(); + } else { + if (responseCase_ == 3) { + return executeBatchResponseBuilder_.getMessage(); + } + return com.google.spanner.v1.ExecuteBatchDmlResponse.getDefaultInstance(); + } + } + /** + * .google.spanner.v1.ExecuteBatchDmlResponse execute_batch_response = 3; + */ + public Builder setExecuteBatchResponse(com.google.spanner.v1.ExecuteBatchDmlResponse value) { + if (executeBatchResponseBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + response_ = value; + onChanged(); + } else { + executeBatchResponseBuilder_.setMessage(value); + } + responseCase_ = 3; + return this; + } + /** + * .google.spanner.v1.ExecuteBatchDmlResponse execute_batch_response = 3; + */ + public Builder setExecuteBatchResponse( + com.google.spanner.v1.ExecuteBatchDmlResponse.Builder builderForValue) { + if (executeBatchResponseBuilder_ == null) { + response_ = builderForValue.build(); + onChanged(); + } else { + executeBatchResponseBuilder_.setMessage(builderForValue.build()); + } + responseCase_ = 3; + return this; + } + /** + * .google.spanner.v1.ExecuteBatchDmlResponse execute_batch_response = 3; + */ + public Builder mergeExecuteBatchResponse(com.google.spanner.v1.ExecuteBatchDmlResponse value) { + if (executeBatchResponseBuilder_ == null) { + if (responseCase_ == 3 && + response_ != com.google.spanner.v1.ExecuteBatchDmlResponse.getDefaultInstance()) { + response_ = com.google.spanner.v1.ExecuteBatchDmlResponse.newBuilder((com.google.spanner.v1.ExecuteBatchDmlResponse) response_) + .mergeFrom(value).buildPartial(); + } else { + response_ = value; + } + onChanged(); + } else { + if (responseCase_ == 3) { + executeBatchResponseBuilder_.mergeFrom(value); + } else { + executeBatchResponseBuilder_.setMessage(value); + } + } + responseCase_ = 3; + return this; + } + /** + * .google.spanner.v1.ExecuteBatchDmlResponse execute_batch_response = 3; + */ + public Builder clearExecuteBatchResponse() { + if (executeBatchResponseBuilder_ == null) { + if (responseCase_ == 3) { + responseCase_ = 0; + response_ = null; + onChanged(); + } + } else { + if (responseCase_ == 3) { + responseCase_ = 0; + response_ = null; + } + executeBatchResponseBuilder_.clear(); + } + return this; + } + /** + * .google.spanner.v1.ExecuteBatchDmlResponse execute_batch_response = 3; + */ + public com.google.spanner.v1.ExecuteBatchDmlResponse.Builder getExecuteBatchResponseBuilder() { + return internalGetExecuteBatchResponseFieldBuilder().getBuilder(); + } + /** + * .google.spanner.v1.ExecuteBatchDmlResponse execute_batch_response = 3; + */ + @java.lang.Override + public com.google.spanner.v1.ExecuteBatchDmlResponseOrBuilder getExecuteBatchResponseOrBuilder() { + if ((responseCase_ == 3) && (executeBatchResponseBuilder_ != null)) { + return executeBatchResponseBuilder_.getMessageOrBuilder(); + } else { + if (responseCase_ == 3) { + return (com.google.spanner.v1.ExecuteBatchDmlResponse) response_; + } + return com.google.spanner.v1.ExecuteBatchDmlResponse.getDefaultInstance(); + } + } + /** + * .google.spanner.v1.ExecuteBatchDmlResponse execute_batch_response = 3; + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.spanner.v1.ExecuteBatchDmlResponse, com.google.spanner.v1.ExecuteBatchDmlResponse.Builder, com.google.spanner.v1.ExecuteBatchDmlResponseOrBuilder> + internalGetExecuteBatchResponseFieldBuilder() { + if (executeBatchResponseBuilder_ == null) { + if (!(responseCase_ == 3)) { + response_ = com.google.spanner.v1.ExecuteBatchDmlResponse.getDefaultInstance(); + } + executeBatchResponseBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.google.spanner.v1.ExecuteBatchDmlResponse, com.google.spanner.v1.ExecuteBatchDmlResponse.Builder, com.google.spanner.v1.ExecuteBatchDmlResponseOrBuilder>( + (com.google.spanner.v1.ExecuteBatchDmlResponse) response_, + getParentForChildren(), + isClean()); + response_ = null; + } + responseCase_ = 3; + onChanged(); + return executeBatchResponseBuilder_; + } + + private com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Empty, com.google.protobuf.Empty.Builder, com.google.protobuf.EmptyOrBuilder> beginTransactionResponseBuilder_; + /** + * .google.protobuf.Empty begin_transaction_response = 4; + * @return Whether the beginTransactionResponse field is set. + */ + @java.lang.Override + public boolean hasBeginTransactionResponse() { + return responseCase_ == 4; + } + /** + * .google.protobuf.Empty begin_transaction_response = 4; + * @return The beginTransactionResponse. + */ + @java.lang.Override + public com.google.protobuf.Empty getBeginTransactionResponse() { + if (beginTransactionResponseBuilder_ == null) { + if (responseCase_ == 4) { + return (com.google.protobuf.Empty) response_; + } + return com.google.protobuf.Empty.getDefaultInstance(); + } else { + if (responseCase_ == 4) { + return beginTransactionResponseBuilder_.getMessage(); + } + return com.google.protobuf.Empty.getDefaultInstance(); + } + } + /** + * .google.protobuf.Empty begin_transaction_response = 4; + */ + public Builder setBeginTransactionResponse(com.google.protobuf.Empty value) { + if (beginTransactionResponseBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + response_ = value; + onChanged(); + } else { + beginTransactionResponseBuilder_.setMessage(value); + } + responseCase_ = 4; + return this; + } + /** + * .google.protobuf.Empty begin_transaction_response = 4; + */ + public Builder setBeginTransactionResponse( + com.google.protobuf.Empty.Builder builderForValue) { + if (beginTransactionResponseBuilder_ == null) { + response_ = builderForValue.build(); + onChanged(); + } else { + beginTransactionResponseBuilder_.setMessage(builderForValue.build()); + } + responseCase_ = 4; + return this; + } + /** + * .google.protobuf.Empty begin_transaction_response = 4; + */ + public Builder mergeBeginTransactionResponse(com.google.protobuf.Empty value) { + if (beginTransactionResponseBuilder_ == null) { + if (responseCase_ == 4 && + response_ != com.google.protobuf.Empty.getDefaultInstance()) { + response_ = com.google.protobuf.Empty.newBuilder((com.google.protobuf.Empty) response_) + .mergeFrom(value).buildPartial(); + } else { + response_ = value; + } + onChanged(); + } else { + if (responseCase_ == 4) { + beginTransactionResponseBuilder_.mergeFrom(value); + } else { + beginTransactionResponseBuilder_.setMessage(value); + } + } + responseCase_ = 4; + return this; + } + /** + * .google.protobuf.Empty begin_transaction_response = 4; + */ + public Builder clearBeginTransactionResponse() { + if (beginTransactionResponseBuilder_ == null) { + if (responseCase_ == 4) { + responseCase_ = 0; + response_ = null; + onChanged(); + } + } else { + if (responseCase_ == 4) { + responseCase_ = 0; + response_ = null; + } + beginTransactionResponseBuilder_.clear(); + } + return this; + } + /** + * .google.protobuf.Empty begin_transaction_response = 4; + */ + public com.google.protobuf.Empty.Builder getBeginTransactionResponseBuilder() { + return internalGetBeginTransactionResponseFieldBuilder().getBuilder(); + } + /** + * .google.protobuf.Empty begin_transaction_response = 4; + */ + @java.lang.Override + public com.google.protobuf.EmptyOrBuilder getBeginTransactionResponseOrBuilder() { + if ((responseCase_ == 4) && (beginTransactionResponseBuilder_ != null)) { + return beginTransactionResponseBuilder_.getMessageOrBuilder(); + } else { + if (responseCase_ == 4) { + return (com.google.protobuf.Empty) response_; + } + return com.google.protobuf.Empty.getDefaultInstance(); + } + } + /** + * .google.protobuf.Empty begin_transaction_response = 4; + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Empty, com.google.protobuf.Empty.Builder, com.google.protobuf.EmptyOrBuilder> + internalGetBeginTransactionResponseFieldBuilder() { + if (beginTransactionResponseBuilder_ == null) { + if (!(responseCase_ == 4)) { + response_ = com.google.protobuf.Empty.getDefaultInstance(); + } + beginTransactionResponseBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Empty, com.google.protobuf.Empty.Builder, com.google.protobuf.EmptyOrBuilder>( + (com.google.protobuf.Empty) response_, + getParentForChildren(), + isClean()); + response_ = null; + } + responseCase_ = 4; + onChanged(); + return beginTransactionResponseBuilder_; + } + + private com.google.protobuf.SingleFieldBuilder< + com.google.spanner.v1.CommitResponse, com.google.spanner.v1.CommitResponse.Builder, com.google.spanner.v1.CommitResponseOrBuilder> commitResponseBuilder_; + /** + * .google.spanner.v1.CommitResponse commit_response = 5; + * @return Whether the commitResponse field is set. + */ + @java.lang.Override + public boolean hasCommitResponse() { + return responseCase_ == 5; + } + /** + * .google.spanner.v1.CommitResponse commit_response = 5; + * @return The commitResponse. + */ + @java.lang.Override + public com.google.spanner.v1.CommitResponse getCommitResponse() { + if (commitResponseBuilder_ == null) { + if (responseCase_ == 5) { + return (com.google.spanner.v1.CommitResponse) response_; + } + return com.google.spanner.v1.CommitResponse.getDefaultInstance(); + } else { + if (responseCase_ == 5) { + return commitResponseBuilder_.getMessage(); + } + return com.google.spanner.v1.CommitResponse.getDefaultInstance(); + } + } + /** + * .google.spanner.v1.CommitResponse commit_response = 5; + */ + public Builder setCommitResponse(com.google.spanner.v1.CommitResponse value) { + if (commitResponseBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + response_ = value; + onChanged(); + } else { + commitResponseBuilder_.setMessage(value); + } + responseCase_ = 5; + return this; + } + /** + * .google.spanner.v1.CommitResponse commit_response = 5; + */ + public Builder setCommitResponse( + com.google.spanner.v1.CommitResponse.Builder builderForValue) { + if (commitResponseBuilder_ == null) { + response_ = builderForValue.build(); + onChanged(); + } else { + commitResponseBuilder_.setMessage(builderForValue.build()); + } + responseCase_ = 5; + return this; + } + /** + * .google.spanner.v1.CommitResponse commit_response = 5; + */ + public Builder mergeCommitResponse(com.google.spanner.v1.CommitResponse value) { + if (commitResponseBuilder_ == null) { + if (responseCase_ == 5 && + response_ != com.google.spanner.v1.CommitResponse.getDefaultInstance()) { + response_ = com.google.spanner.v1.CommitResponse.newBuilder((com.google.spanner.v1.CommitResponse) response_) + .mergeFrom(value).buildPartial(); + } else { + response_ = value; + } + onChanged(); + } else { + if (responseCase_ == 5) { + commitResponseBuilder_.mergeFrom(value); + } else { + commitResponseBuilder_.setMessage(value); + } + } + responseCase_ = 5; + return this; + } + /** + * .google.spanner.v1.CommitResponse commit_response = 5; + */ + public Builder clearCommitResponse() { + if (commitResponseBuilder_ == null) { + if (responseCase_ == 5) { + responseCase_ = 0; + response_ = null; + onChanged(); + } + } else { + if (responseCase_ == 5) { + responseCase_ = 0; + response_ = null; + } + commitResponseBuilder_.clear(); + } + return this; + } + /** + * .google.spanner.v1.CommitResponse commit_response = 5; + */ + public com.google.spanner.v1.CommitResponse.Builder getCommitResponseBuilder() { + return internalGetCommitResponseFieldBuilder().getBuilder(); + } + /** + * .google.spanner.v1.CommitResponse commit_response = 5; + */ + @java.lang.Override + public com.google.spanner.v1.CommitResponseOrBuilder getCommitResponseOrBuilder() { + if ((responseCase_ == 5) && (commitResponseBuilder_ != null)) { + return commitResponseBuilder_.getMessageOrBuilder(); + } else { + if (responseCase_ == 5) { + return (com.google.spanner.v1.CommitResponse) response_; + } + return com.google.spanner.v1.CommitResponse.getDefaultInstance(); + } + } + /** + * .google.spanner.v1.CommitResponse commit_response = 5; + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.spanner.v1.CommitResponse, com.google.spanner.v1.CommitResponse.Builder, com.google.spanner.v1.CommitResponseOrBuilder> + internalGetCommitResponseFieldBuilder() { + if (commitResponseBuilder_ == null) { + if (!(responseCase_ == 5)) { + response_ = com.google.spanner.v1.CommitResponse.getDefaultInstance(); + } + commitResponseBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.google.spanner.v1.CommitResponse, com.google.spanner.v1.CommitResponse.Builder, com.google.spanner.v1.CommitResponseOrBuilder>( + (com.google.spanner.v1.CommitResponse) response_, + getParentForChildren(), + isClean()); + response_ = null; + } + responseCase_ = 5; + onChanged(); + return commitResponseBuilder_; + } + + private com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Empty, com.google.protobuf.Empty.Builder, com.google.protobuf.EmptyOrBuilder> rollbackResponseBuilder_; + /** + * .google.protobuf.Empty rollback_response = 6; + * @return Whether the rollbackResponse field is set. + */ + @java.lang.Override + public boolean hasRollbackResponse() { + return responseCase_ == 6; + } + /** + * .google.protobuf.Empty rollback_response = 6; + * @return The rollbackResponse. + */ + @java.lang.Override + public com.google.protobuf.Empty getRollbackResponse() { + if (rollbackResponseBuilder_ == null) { + if (responseCase_ == 6) { + return (com.google.protobuf.Empty) response_; + } + return com.google.protobuf.Empty.getDefaultInstance(); + } else { + if (responseCase_ == 6) { + return rollbackResponseBuilder_.getMessage(); + } + return com.google.protobuf.Empty.getDefaultInstance(); + } + } + /** + * .google.protobuf.Empty rollback_response = 6; + */ + public Builder setRollbackResponse(com.google.protobuf.Empty value) { + if (rollbackResponseBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + response_ = value; + onChanged(); + } else { + rollbackResponseBuilder_.setMessage(value); + } + responseCase_ = 6; + return this; + } + /** + * .google.protobuf.Empty rollback_response = 6; + */ + public Builder setRollbackResponse( + com.google.protobuf.Empty.Builder builderForValue) { + if (rollbackResponseBuilder_ == null) { + response_ = builderForValue.build(); + onChanged(); + } else { + rollbackResponseBuilder_.setMessage(builderForValue.build()); + } + responseCase_ = 6; + return this; + } + /** + * .google.protobuf.Empty rollback_response = 6; + */ + public Builder mergeRollbackResponse(com.google.protobuf.Empty value) { + if (rollbackResponseBuilder_ == null) { + if (responseCase_ == 6 && + response_ != com.google.protobuf.Empty.getDefaultInstance()) { + response_ = com.google.protobuf.Empty.newBuilder((com.google.protobuf.Empty) response_) + .mergeFrom(value).buildPartial(); + } else { + response_ = value; + } + onChanged(); + } else { + if (responseCase_ == 6) { + rollbackResponseBuilder_.mergeFrom(value); + } else { + rollbackResponseBuilder_.setMessage(value); + } + } + responseCase_ = 6; + return this; + } + /** + * .google.protobuf.Empty rollback_response = 6; + */ + public Builder clearRollbackResponse() { + if (rollbackResponseBuilder_ == null) { + if (responseCase_ == 6) { + responseCase_ = 0; + response_ = null; + onChanged(); + } + } else { + if (responseCase_ == 6) { + responseCase_ = 0; + response_ = null; + } + rollbackResponseBuilder_.clear(); + } + return this; + } + /** + * .google.protobuf.Empty rollback_response = 6; + */ + public com.google.protobuf.Empty.Builder getRollbackResponseBuilder() { + return internalGetRollbackResponseFieldBuilder().getBuilder(); + } + /** + * .google.protobuf.Empty rollback_response = 6; + */ + @java.lang.Override + public com.google.protobuf.EmptyOrBuilder getRollbackResponseOrBuilder() { + if ((responseCase_ == 6) && (rollbackResponseBuilder_ != null)) { + return rollbackResponseBuilder_.getMessageOrBuilder(); + } else { + if (responseCase_ == 6) { + return (com.google.protobuf.Empty) response_; + } + return com.google.protobuf.Empty.getDefaultInstance(); + } + } + /** + * .google.protobuf.Empty rollback_response = 6; + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Empty, com.google.protobuf.Empty.Builder, com.google.protobuf.EmptyOrBuilder> + internalGetRollbackResponseFieldBuilder() { + if (rollbackResponseBuilder_ == null) { + if (!(responseCase_ == 6)) { + response_ = com.google.protobuf.Empty.getDefaultInstance(); + } + rollbackResponseBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Empty, com.google.protobuf.Empty.Builder, com.google.protobuf.EmptyOrBuilder>( + (com.google.protobuf.Empty) response_, + getParentForChildren(), + isClean()); + response_ = null; + } + responseCase_ = 6; + onChanged(); + return rollbackResponseBuilder_; + } + + private com.google.protobuf.SingleFieldBuilder< + com.google.spanner.v1.CommitResponse, com.google.spanner.v1.CommitResponse.Builder, com.google.spanner.v1.CommitResponseOrBuilder> writeMutationsResponseBuilder_; + /** + * .google.spanner.v1.CommitResponse write_mutations_response = 7; + * @return Whether the writeMutationsResponse field is set. + */ + @java.lang.Override + public boolean hasWriteMutationsResponse() { + return responseCase_ == 7; + } + /** + * .google.spanner.v1.CommitResponse write_mutations_response = 7; + * @return The writeMutationsResponse. + */ + @java.lang.Override + public com.google.spanner.v1.CommitResponse getWriteMutationsResponse() { + if (writeMutationsResponseBuilder_ == null) { + if (responseCase_ == 7) { + return (com.google.spanner.v1.CommitResponse) response_; + } + return com.google.spanner.v1.CommitResponse.getDefaultInstance(); + } else { + if (responseCase_ == 7) { + return writeMutationsResponseBuilder_.getMessage(); + } + return com.google.spanner.v1.CommitResponse.getDefaultInstance(); + } + } + /** + * .google.spanner.v1.CommitResponse write_mutations_response = 7; + */ + public Builder setWriteMutationsResponse(com.google.spanner.v1.CommitResponse value) { + if (writeMutationsResponseBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + response_ = value; + onChanged(); + } else { + writeMutationsResponseBuilder_.setMessage(value); + } + responseCase_ = 7; + return this; + } + /** + * .google.spanner.v1.CommitResponse write_mutations_response = 7; + */ + public Builder setWriteMutationsResponse( + com.google.spanner.v1.CommitResponse.Builder builderForValue) { + if (writeMutationsResponseBuilder_ == null) { + response_ = builderForValue.build(); + onChanged(); + } else { + writeMutationsResponseBuilder_.setMessage(builderForValue.build()); + } + responseCase_ = 7; + return this; + } + /** + * .google.spanner.v1.CommitResponse write_mutations_response = 7; + */ + public Builder mergeWriteMutationsResponse(com.google.spanner.v1.CommitResponse value) { + if (writeMutationsResponseBuilder_ == null) { + if (responseCase_ == 7 && + response_ != com.google.spanner.v1.CommitResponse.getDefaultInstance()) { + response_ = com.google.spanner.v1.CommitResponse.newBuilder((com.google.spanner.v1.CommitResponse) response_) + .mergeFrom(value).buildPartial(); + } else { + response_ = value; + } + onChanged(); + } else { + if (responseCase_ == 7) { + writeMutationsResponseBuilder_.mergeFrom(value); + } else { + writeMutationsResponseBuilder_.setMessage(value); + } + } + responseCase_ = 7; + return this; + } + /** + * .google.spanner.v1.CommitResponse write_mutations_response = 7; + */ + public Builder clearWriteMutationsResponse() { + if (writeMutationsResponseBuilder_ == null) { + if (responseCase_ == 7) { + responseCase_ = 0; + response_ = null; + onChanged(); + } + } else { + if (responseCase_ == 7) { + responseCase_ = 0; + response_ = null; + } + writeMutationsResponseBuilder_.clear(); + } + return this; + } + /** + * .google.spanner.v1.CommitResponse write_mutations_response = 7; + */ + public com.google.spanner.v1.CommitResponse.Builder getWriteMutationsResponseBuilder() { + return internalGetWriteMutationsResponseFieldBuilder().getBuilder(); + } + /** + * .google.spanner.v1.CommitResponse write_mutations_response = 7; + */ + @java.lang.Override + public com.google.spanner.v1.CommitResponseOrBuilder getWriteMutationsResponseOrBuilder() { + if ((responseCase_ == 7) && (writeMutationsResponseBuilder_ != null)) { + return writeMutationsResponseBuilder_.getMessageOrBuilder(); + } else { + if (responseCase_ == 7) { + return (com.google.spanner.v1.CommitResponse) response_; + } + return com.google.spanner.v1.CommitResponse.getDefaultInstance(); + } + } + /** + * .google.spanner.v1.CommitResponse write_mutations_response = 7; + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.spanner.v1.CommitResponse, com.google.spanner.v1.CommitResponse.Builder, com.google.spanner.v1.CommitResponseOrBuilder> + internalGetWriteMutationsResponseFieldBuilder() { + if (writeMutationsResponseBuilder_ == null) { + if (!(responseCase_ == 7)) { + response_ = com.google.spanner.v1.CommitResponse.getDefaultInstance(); + } + writeMutationsResponseBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.google.spanner.v1.CommitResponse, com.google.spanner.v1.CommitResponse.Builder, com.google.spanner.v1.CommitResponseOrBuilder>( + (com.google.spanner.v1.CommitResponse) response_, getParentForChildren(), isClean()); response_ = null; } - responseCase_ = 1; + responseCase_ = 7; onChanged(); - return rowBuilder_; + return writeMutationsResponseBuilder_; } // @@protoc_insertion_point(builder_scope:google.spannerlib.v1.ConnectionStreamResponse) diff --git a/spannerlib/wrappers/spannerlib-java/src/main/java/com/google/cloud/spannerlib/v1/ConnectionStreamResponseOrBuilder.java b/spannerlib/wrappers/spannerlib-java/src/main/java/com/google/cloud/spannerlib/v1/ConnectionStreamResponseOrBuilder.java index f3f7a97a..64824432 100644 --- a/spannerlib/wrappers/spannerlib-java/src/main/java/com/google/cloud/spannerlib/v1/ConnectionStreamResponseOrBuilder.java +++ b/spannerlib/wrappers/spannerlib-java/src/main/java/com/google/cloud/spannerlib/v1/ConnectionStreamResponseOrBuilder.java @@ -11,19 +11,124 @@ public interface ConnectionStreamResponseOrBuilder extends com.google.protobuf.MessageOrBuilder { /** - * .google.spanner.v1.PartialResultSet row = 1; - * @return Whether the row field is set. + *
+   * Status indicates whether the request succeeded or failed. The response field only contains
+   * a value if the status code is OK.
+   * 
+ * + * .google.rpc.Status status = 1; + * @return Whether the status field is set. */ - boolean hasRow(); + boolean hasStatus(); /** - * .google.spanner.v1.PartialResultSet row = 1; - * @return The row. + *
+   * Status indicates whether the request succeeded or failed. The response field only contains
+   * a value if the status code is OK.
+   * 
+ * + * .google.rpc.Status status = 1; + * @return The status. */ - com.google.spanner.v1.PartialResultSet getRow(); + com.google.rpc.Status getStatus(); /** - * .google.spanner.v1.PartialResultSet row = 1; + *
+   * Status indicates whether the request succeeded or failed. The response field only contains
+   * a value if the status code is OK.
+   * 
+ * + * .google.rpc.Status status = 1; */ - com.google.spanner.v1.PartialResultSetOrBuilder getRowOrBuilder(); + com.google.rpc.StatusOrBuilder getStatusOrBuilder(); + + /** + * .google.spannerlib.v1.ExecuteResponse execute_response = 2; + * @return Whether the executeResponse field is set. + */ + boolean hasExecuteResponse(); + /** + * .google.spannerlib.v1.ExecuteResponse execute_response = 2; + * @return The executeResponse. + */ + com.google.cloud.spannerlib.v1.ExecuteResponse getExecuteResponse(); + /** + * .google.spannerlib.v1.ExecuteResponse execute_response = 2; + */ + com.google.cloud.spannerlib.v1.ExecuteResponseOrBuilder getExecuteResponseOrBuilder(); + + /** + * .google.spanner.v1.ExecuteBatchDmlResponse execute_batch_response = 3; + * @return Whether the executeBatchResponse field is set. + */ + boolean hasExecuteBatchResponse(); + /** + * .google.spanner.v1.ExecuteBatchDmlResponse execute_batch_response = 3; + * @return The executeBatchResponse. + */ + com.google.spanner.v1.ExecuteBatchDmlResponse getExecuteBatchResponse(); + /** + * .google.spanner.v1.ExecuteBatchDmlResponse execute_batch_response = 3; + */ + com.google.spanner.v1.ExecuteBatchDmlResponseOrBuilder getExecuteBatchResponseOrBuilder(); + + /** + * .google.protobuf.Empty begin_transaction_response = 4; + * @return Whether the beginTransactionResponse field is set. + */ + boolean hasBeginTransactionResponse(); + /** + * .google.protobuf.Empty begin_transaction_response = 4; + * @return The beginTransactionResponse. + */ + com.google.protobuf.Empty getBeginTransactionResponse(); + /** + * .google.protobuf.Empty begin_transaction_response = 4; + */ + com.google.protobuf.EmptyOrBuilder getBeginTransactionResponseOrBuilder(); + + /** + * .google.spanner.v1.CommitResponse commit_response = 5; + * @return Whether the commitResponse field is set. + */ + boolean hasCommitResponse(); + /** + * .google.spanner.v1.CommitResponse commit_response = 5; + * @return The commitResponse. + */ + com.google.spanner.v1.CommitResponse getCommitResponse(); + /** + * .google.spanner.v1.CommitResponse commit_response = 5; + */ + com.google.spanner.v1.CommitResponseOrBuilder getCommitResponseOrBuilder(); + + /** + * .google.protobuf.Empty rollback_response = 6; + * @return Whether the rollbackResponse field is set. + */ + boolean hasRollbackResponse(); + /** + * .google.protobuf.Empty rollback_response = 6; + * @return The rollbackResponse. + */ + com.google.protobuf.Empty getRollbackResponse(); + /** + * .google.protobuf.Empty rollback_response = 6; + */ + com.google.protobuf.EmptyOrBuilder getRollbackResponseOrBuilder(); + + /** + * .google.spanner.v1.CommitResponse write_mutations_response = 7; + * @return Whether the writeMutationsResponse field is set. + */ + boolean hasWriteMutationsResponse(); + /** + * .google.spanner.v1.CommitResponse write_mutations_response = 7; + * @return The writeMutationsResponse. + */ + com.google.spanner.v1.CommitResponse getWriteMutationsResponse(); + /** + * .google.spanner.v1.CommitResponse write_mutations_response = 7; + */ + com.google.spanner.v1.CommitResponseOrBuilder getWriteMutationsResponseOrBuilder(); com.google.cloud.spannerlib.v1.ConnectionStreamResponse.ResponseCase getResponseCase(); } diff --git a/spannerlib/wrappers/spannerlib-java/src/main/java/com/google/cloud/spannerlib/v1/ExecuteRequest.java b/spannerlib/wrappers/spannerlib-java/src/main/java/com/google/cloud/spannerlib/v1/ExecuteRequest.java index 06f0fff1..66ba8512 100644 --- a/spannerlib/wrappers/spannerlib-java/src/main/java/com/google/cloud/spannerlib/v1/ExecuteRequest.java +++ b/spannerlib/wrappers/spannerlib-java/src/main/java/com/google/cloud/spannerlib/v1/ExecuteRequest.java @@ -96,6 +96,32 @@ public com.google.spanner.v1.ExecuteSqlRequestOrBuilder getExecuteSqlRequestOrBu return executeSqlRequest_ == null ? com.google.spanner.v1.ExecuteSqlRequest.getDefaultInstance() : executeSqlRequest_; } + public static final int FETCH_OPTIONS_FIELD_NUMBER = 3; + private com.google.cloud.spannerlib.v1.FetchOptions fetchOptions_; + /** + * .google.spannerlib.v1.FetchOptions fetch_options = 3; + * @return Whether the fetchOptions field is set. + */ + @java.lang.Override + public boolean hasFetchOptions() { + return ((bitField0_ & 0x00000004) != 0); + } + /** + * .google.spannerlib.v1.FetchOptions fetch_options = 3; + * @return The fetchOptions. + */ + @java.lang.Override + public com.google.cloud.spannerlib.v1.FetchOptions getFetchOptions() { + return fetchOptions_ == null ? com.google.cloud.spannerlib.v1.FetchOptions.getDefaultInstance() : fetchOptions_; + } + /** + * .google.spannerlib.v1.FetchOptions fetch_options = 3; + */ + @java.lang.Override + public com.google.cloud.spannerlib.v1.FetchOptionsOrBuilder getFetchOptionsOrBuilder() { + return fetchOptions_ == null ? com.google.cloud.spannerlib.v1.FetchOptions.getDefaultInstance() : fetchOptions_; + } + private byte memoizedIsInitialized = -1; @java.lang.Override public final boolean isInitialized() { @@ -116,6 +142,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) if (((bitField0_ & 0x00000002) != 0)) { output.writeMessage(2, getExecuteSqlRequest()); } + if (((bitField0_ & 0x00000004) != 0)) { + output.writeMessage(3, getFetchOptions()); + } getUnknownFields().writeTo(output); } @@ -133,6 +162,10 @@ public int getSerializedSize() { size += com.google.protobuf.CodedOutputStream .computeMessageSize(2, getExecuteSqlRequest()); } + if (((bitField0_ & 0x00000004) != 0)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, getFetchOptions()); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -158,6 +191,11 @@ public boolean equals(final java.lang.Object obj) { if (!getExecuteSqlRequest() .equals(other.getExecuteSqlRequest())) return false; } + if (hasFetchOptions() != other.hasFetchOptions()) return false; + if (hasFetchOptions()) { + if (!getFetchOptions() + .equals(other.getFetchOptions())) return false; + } if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -177,6 +215,10 @@ public int hashCode() { hash = (37 * hash) + EXECUTE_SQL_REQUEST_FIELD_NUMBER; hash = (53 * hash) + getExecuteSqlRequest().hashCode(); } + if (hasFetchOptions()) { + hash = (37 * hash) + FETCH_OPTIONS_FIELD_NUMBER; + hash = (53 * hash) + getFetchOptions().hashCode(); + } hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; @@ -309,6 +351,7 @@ private void maybeForceBuilderInitialization() { .alwaysUseFieldBuilders) { internalGetConnectionFieldBuilder(); internalGetExecuteSqlRequestFieldBuilder(); + internalGetFetchOptionsFieldBuilder(); } } @java.lang.Override @@ -325,6 +368,11 @@ public Builder clear() { executeSqlRequestBuilder_.dispose(); executeSqlRequestBuilder_ = null; } + fetchOptions_ = null; + if (fetchOptionsBuilder_ != null) { + fetchOptionsBuilder_.dispose(); + fetchOptionsBuilder_ = null; + } return this; } @@ -371,6 +419,12 @@ private void buildPartial0(com.google.cloud.spannerlib.v1.ExecuteRequest result) : executeSqlRequestBuilder_.build(); to_bitField0_ |= 0x00000002; } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.fetchOptions_ = fetchOptionsBuilder_ == null + ? fetchOptions_ + : fetchOptionsBuilder_.build(); + to_bitField0_ |= 0x00000004; + } result.bitField0_ |= to_bitField0_; } @@ -392,6 +446,9 @@ public Builder mergeFrom(com.google.cloud.spannerlib.v1.ExecuteRequest other) { if (other.hasExecuteSqlRequest()) { mergeExecuteSqlRequest(other.getExecuteSqlRequest()); } + if (other.hasFetchOptions()) { + mergeFetchOptions(other.getFetchOptions()); + } this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; @@ -432,6 +489,13 @@ public Builder mergeFrom( bitField0_ |= 0x00000002; break; } // case 18 + case 26: { + input.readMessage( + internalGetFetchOptionsFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000004; + break; + } // case 26 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { done = true; // was an endgroup tag @@ -691,6 +755,127 @@ public com.google.spanner.v1.ExecuteSqlRequestOrBuilder getExecuteSqlRequestOrBu return executeSqlRequestBuilder_; } + private com.google.cloud.spannerlib.v1.FetchOptions fetchOptions_; + private com.google.protobuf.SingleFieldBuilder< + com.google.cloud.spannerlib.v1.FetchOptions, com.google.cloud.spannerlib.v1.FetchOptions.Builder, com.google.cloud.spannerlib.v1.FetchOptionsOrBuilder> fetchOptionsBuilder_; + /** + * .google.spannerlib.v1.FetchOptions fetch_options = 3; + * @return Whether the fetchOptions field is set. + */ + public boolean hasFetchOptions() { + return ((bitField0_ & 0x00000004) != 0); + } + /** + * .google.spannerlib.v1.FetchOptions fetch_options = 3; + * @return The fetchOptions. + */ + public com.google.cloud.spannerlib.v1.FetchOptions getFetchOptions() { + if (fetchOptionsBuilder_ == null) { + return fetchOptions_ == null ? com.google.cloud.spannerlib.v1.FetchOptions.getDefaultInstance() : fetchOptions_; + } else { + return fetchOptionsBuilder_.getMessage(); + } + } + /** + * .google.spannerlib.v1.FetchOptions fetch_options = 3; + */ + public Builder setFetchOptions(com.google.cloud.spannerlib.v1.FetchOptions value) { + if (fetchOptionsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + fetchOptions_ = value; + } else { + fetchOptionsBuilder_.setMessage(value); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * .google.spannerlib.v1.FetchOptions fetch_options = 3; + */ + public Builder setFetchOptions( + com.google.cloud.spannerlib.v1.FetchOptions.Builder builderForValue) { + if (fetchOptionsBuilder_ == null) { + fetchOptions_ = builderForValue.build(); + } else { + fetchOptionsBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * .google.spannerlib.v1.FetchOptions fetch_options = 3; + */ + public Builder mergeFetchOptions(com.google.cloud.spannerlib.v1.FetchOptions value) { + if (fetchOptionsBuilder_ == null) { + if (((bitField0_ & 0x00000004) != 0) && + fetchOptions_ != null && + fetchOptions_ != com.google.cloud.spannerlib.v1.FetchOptions.getDefaultInstance()) { + getFetchOptionsBuilder().mergeFrom(value); + } else { + fetchOptions_ = value; + } + } else { + fetchOptionsBuilder_.mergeFrom(value); + } + if (fetchOptions_ != null) { + bitField0_ |= 0x00000004; + onChanged(); + } + return this; + } + /** + * .google.spannerlib.v1.FetchOptions fetch_options = 3; + */ + public Builder clearFetchOptions() { + bitField0_ = (bitField0_ & ~0x00000004); + fetchOptions_ = null; + if (fetchOptionsBuilder_ != null) { + fetchOptionsBuilder_.dispose(); + fetchOptionsBuilder_ = null; + } + onChanged(); + return this; + } + /** + * .google.spannerlib.v1.FetchOptions fetch_options = 3; + */ + public com.google.cloud.spannerlib.v1.FetchOptions.Builder getFetchOptionsBuilder() { + bitField0_ |= 0x00000004; + onChanged(); + return internalGetFetchOptionsFieldBuilder().getBuilder(); + } + /** + * .google.spannerlib.v1.FetchOptions fetch_options = 3; + */ + public com.google.cloud.spannerlib.v1.FetchOptionsOrBuilder getFetchOptionsOrBuilder() { + if (fetchOptionsBuilder_ != null) { + return fetchOptionsBuilder_.getMessageOrBuilder(); + } else { + return fetchOptions_ == null ? + com.google.cloud.spannerlib.v1.FetchOptions.getDefaultInstance() : fetchOptions_; + } + } + /** + * .google.spannerlib.v1.FetchOptions fetch_options = 3; + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.cloud.spannerlib.v1.FetchOptions, com.google.cloud.spannerlib.v1.FetchOptions.Builder, com.google.cloud.spannerlib.v1.FetchOptionsOrBuilder> + internalGetFetchOptionsFieldBuilder() { + if (fetchOptionsBuilder_ == null) { + fetchOptionsBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.google.cloud.spannerlib.v1.FetchOptions, com.google.cloud.spannerlib.v1.FetchOptions.Builder, com.google.cloud.spannerlib.v1.FetchOptionsOrBuilder>( + getFetchOptions(), + getParentForChildren(), + isClean()); + fetchOptions_ = null; + } + return fetchOptionsBuilder_; + } + // @@protoc_insertion_point(builder_scope:google.spannerlib.v1.ExecuteRequest) } diff --git a/spannerlib/wrappers/spannerlib-java/src/main/java/com/google/cloud/spannerlib/v1/ExecuteRequestOrBuilder.java b/spannerlib/wrappers/spannerlib-java/src/main/java/com/google/cloud/spannerlib/v1/ExecuteRequestOrBuilder.java index 89f82663..a24acd84 100644 --- a/spannerlib/wrappers/spannerlib-java/src/main/java/com/google/cloud/spannerlib/v1/ExecuteRequestOrBuilder.java +++ b/spannerlib/wrappers/spannerlib-java/src/main/java/com/google/cloud/spannerlib/v1/ExecuteRequestOrBuilder.java @@ -39,4 +39,19 @@ public interface ExecuteRequestOrBuilder extends * .google.spanner.v1.ExecuteSqlRequest execute_sql_request = 2 [(.google.api.field_behavior) = REQUIRED]; */ com.google.spanner.v1.ExecuteSqlRequestOrBuilder getExecuteSqlRequestOrBuilder(); + + /** + * .google.spannerlib.v1.FetchOptions fetch_options = 3; + * @return Whether the fetchOptions field is set. + */ + boolean hasFetchOptions(); + /** + * .google.spannerlib.v1.FetchOptions fetch_options = 3; + * @return The fetchOptions. + */ + com.google.cloud.spannerlib.v1.FetchOptions getFetchOptions(); + /** + * .google.spannerlib.v1.FetchOptions fetch_options = 3; + */ + com.google.cloud.spannerlib.v1.FetchOptionsOrBuilder getFetchOptionsOrBuilder(); } diff --git a/spannerlib/wrappers/spannerlib-java/src/main/java/com/google/cloud/spannerlib/v1/ExecuteResponse.java b/spannerlib/wrappers/spannerlib-java/src/main/java/com/google/cloud/spannerlib/v1/ExecuteResponse.java new file mode 100644 index 00000000..f5d8a605 --- /dev/null +++ b/spannerlib/wrappers/spannerlib-java/src/main/java/com/google/cloud/spannerlib/v1/ExecuteResponse.java @@ -0,0 +1,1188 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: google/spannerlib/v1/spannerlib.proto +// Protobuf Java Version: 4.32.1 + +package com.google.cloud.spannerlib.v1; + +/** + *
+ * ExecuteResponse is returned by the server when it receives an ExecuteRequest on a bi-directional
+ * ConnectionStream. The response contains the first N rows, the metadata, and an indication whether
+ * the result contains more data than in the initial response. The client should fetch the remaining
+ * data by calling the ContinueStreaming RPC. This will start a separate server stream with the
+ * remaining results. The client can continue to send additional requests on the ConnectionStream
+ * while the additional server stream is open.
+ *
+ * The initial response also contains the ResultSetStats if there is no more data to be returned.
+ * 
+ * + * Protobuf type {@code google.spannerlib.v1.ExecuteResponse} + */ +@com.google.protobuf.Generated +public final class ExecuteResponse extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:google.spannerlib.v1.ExecuteResponse) + ExecuteResponseOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 32, + /* patch= */ 1, + /* suffix= */ "", + ExecuteResponse.class.getName()); + } + // Use ExecuteResponse.newBuilder() to construct. + private ExecuteResponse(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private ExecuteResponse() { + resultSets_ = java.util.Collections.emptyList(); + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.spannerlib.v1.SpannerLibProto.internal_static_google_spannerlib_v1_ExecuteResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.spannerlib.v1.SpannerLibProto.internal_static_google_spannerlib_v1_ExecuteResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.spannerlib.v1.ExecuteResponse.class, com.google.cloud.spannerlib.v1.ExecuteResponse.Builder.class); + } + + private int bitField0_; + public static final int ROWS_FIELD_NUMBER = 1; + private com.google.cloud.spannerlib.v1.Rows rows_; + /** + * .google.spannerlib.v1.Rows rows = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return Whether the rows field is set. + */ + @java.lang.Override + public boolean hasRows() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * .google.spannerlib.v1.Rows rows = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return The rows. + */ + @java.lang.Override + public com.google.cloud.spannerlib.v1.Rows getRows() { + return rows_ == null ? com.google.cloud.spannerlib.v1.Rows.getDefaultInstance() : rows_; + } + /** + * .google.spannerlib.v1.Rows rows = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + @java.lang.Override + public com.google.cloud.spannerlib.v1.RowsOrBuilder getRowsOrBuilder() { + return rows_ == null ? com.google.cloud.spannerlib.v1.Rows.getDefaultInstance() : rows_; + } + + public static final int RESULT_SETS_FIELD_NUMBER = 2; + @SuppressWarnings("serial") + private java.util.List resultSets_; + /** + * repeated .google.spanner.v1.ResultSet result_sets = 2; + */ + @java.lang.Override + public java.util.List getResultSetsList() { + return resultSets_; + } + /** + * repeated .google.spanner.v1.ResultSet result_sets = 2; + */ + @java.lang.Override + public java.util.List + getResultSetsOrBuilderList() { + return resultSets_; + } + /** + * repeated .google.spanner.v1.ResultSet result_sets = 2; + */ + @java.lang.Override + public int getResultSetsCount() { + return resultSets_.size(); + } + /** + * repeated .google.spanner.v1.ResultSet result_sets = 2; + */ + @java.lang.Override + public com.google.spanner.v1.ResultSet getResultSets(int index) { + return resultSets_.get(index); + } + /** + * repeated .google.spanner.v1.ResultSet result_sets = 2; + */ + @java.lang.Override + public com.google.spanner.v1.ResultSetOrBuilder getResultSetsOrBuilder( + int index) { + return resultSets_.get(index); + } + + public static final int STATUS_FIELD_NUMBER = 3; + private com.google.rpc.Status status_; + /** + * .google.rpc.Status status = 3; + * @return Whether the status field is set. + */ + @java.lang.Override + public boolean hasStatus() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * .google.rpc.Status status = 3; + * @return The status. + */ + @java.lang.Override + public com.google.rpc.Status getStatus() { + return status_ == null ? com.google.rpc.Status.getDefaultInstance() : status_; + } + /** + * .google.rpc.Status status = 3; + */ + @java.lang.Override + public com.google.rpc.StatusOrBuilder getStatusOrBuilder() { + return status_ == null ? com.google.rpc.Status.getDefaultInstance() : status_; + } + + public static final int HAS_MORE_RESULTS_FIELD_NUMBER = 4; + private boolean hasMoreResults_ = false; + /** + * bool has_more_results = 4; + * @return The hasMoreResults. + */ + @java.lang.Override + public boolean getHasMoreResults() { + return hasMoreResults_; + } + + 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 (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(1, getRows()); + } + for (int i = 0; i < resultSets_.size(); i++) { + output.writeMessage(2, resultSets_.get(i)); + } + if (((bitField0_ & 0x00000002) != 0)) { + output.writeMessage(3, getStatus()); + } + if (hasMoreResults_ != false) { + output.writeBool(4, hasMoreResults_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, getRows()); + } + for (int i = 0; i < resultSets_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, resultSets_.get(i)); + } + if (((bitField0_ & 0x00000002) != 0)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, getStatus()); + } + if (hasMoreResults_ != false) { + size += com.google.protobuf.CodedOutputStream + .computeBoolSize(4, hasMoreResults_); + } + size += getUnknownFields().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.cloud.spannerlib.v1.ExecuteResponse)) { + return super.equals(obj); + } + com.google.cloud.spannerlib.v1.ExecuteResponse other = (com.google.cloud.spannerlib.v1.ExecuteResponse) obj; + + if (hasRows() != other.hasRows()) return false; + if (hasRows()) { + if (!getRows() + .equals(other.getRows())) return false; + } + if (!getResultSetsList() + .equals(other.getResultSetsList())) return false; + if (hasStatus() != other.hasStatus()) return false; + if (hasStatus()) { + if (!getStatus() + .equals(other.getStatus())) return false; + } + if (getHasMoreResults() + != other.getHasMoreResults()) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasRows()) { + hash = (37 * hash) + ROWS_FIELD_NUMBER; + hash = (53 * hash) + getRows().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 = (37 * hash) + HAS_MORE_RESULTS_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean( + getHasMoreResults()); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.spannerlib.v1.ExecuteResponse parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.spannerlib.v1.ExecuteResponse parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.google.cloud.spannerlib.v1.ExecuteResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.spannerlib.v1.ExecuteResponse 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.cloud.spannerlib.v1.ExecuteResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.spannerlib.v1.ExecuteResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.google.cloud.spannerlib.v1.ExecuteResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static com.google.cloud.spannerlib.v1.ExecuteResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static com.google.cloud.spannerlib.v1.ExecuteResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.spannerlib.v1.ExecuteResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.google.cloud.spannerlib.v1.ExecuteResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static com.google.cloud.spannerlib.v1.ExecuteResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .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.cloud.spannerlib.v1.ExecuteResponse 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.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * ExecuteResponse is returned by the server when it receives an ExecuteRequest on a bi-directional
+   * ConnectionStream. The response contains the first N rows, the metadata, and an indication whether
+   * the result contains more data than in the initial response. The client should fetch the remaining
+   * data by calling the ContinueStreaming RPC. This will start a separate server stream with the
+   * remaining results. The client can continue to send additional requests on the ConnectionStream
+   * while the additional server stream is open.
+   *
+   * The initial response also contains the ResultSetStats if there is no more data to be returned.
+   * 
+ * + * Protobuf type {@code google.spannerlib.v1.ExecuteResponse} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:google.spannerlib.v1.ExecuteResponse) + com.google.cloud.spannerlib.v1.ExecuteResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.spannerlib.v1.SpannerLibProto.internal_static_google_spannerlib_v1_ExecuteResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.spannerlib.v1.SpannerLibProto.internal_static_google_spannerlib_v1_ExecuteResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.spannerlib.v1.ExecuteResponse.class, com.google.cloud.spannerlib.v1.ExecuteResponse.Builder.class); + } + + // Construct using com.google.cloud.spannerlib.v1.ExecuteResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage + .alwaysUseFieldBuilders) { + internalGetRowsFieldBuilder(); + internalGetResultSetsFieldBuilder(); + internalGetStatusFieldBuilder(); + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + rows_ = null; + if (rowsBuilder_ != null) { + rowsBuilder_.dispose(); + rowsBuilder_ = null; + } + if (resultSetsBuilder_ == null) { + resultSets_ = java.util.Collections.emptyList(); + } else { + resultSets_ = null; + resultSetsBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000002); + status_ = null; + if (statusBuilder_ != null) { + statusBuilder_.dispose(); + statusBuilder_ = null; + } + hasMoreResults_ = false; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.google.cloud.spannerlib.v1.SpannerLibProto.internal_static_google_spannerlib_v1_ExecuteResponse_descriptor; + } + + @java.lang.Override + public com.google.cloud.spannerlib.v1.ExecuteResponse getDefaultInstanceForType() { + return com.google.cloud.spannerlib.v1.ExecuteResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.spannerlib.v1.ExecuteResponse build() { + com.google.cloud.spannerlib.v1.ExecuteResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.spannerlib.v1.ExecuteResponse buildPartial() { + com.google.cloud.spannerlib.v1.ExecuteResponse result = new com.google.cloud.spannerlib.v1.ExecuteResponse(this); + buildPartialRepeatedFields(result); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartialRepeatedFields(com.google.cloud.spannerlib.v1.ExecuteResponse result) { + if (resultSetsBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0)) { + resultSets_ = java.util.Collections.unmodifiableList(resultSets_); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.resultSets_ = resultSets_; + } else { + result.resultSets_ = resultSetsBuilder_.build(); + } + } + + private void buildPartial0(com.google.cloud.spannerlib.v1.ExecuteResponse result) { + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.rows_ = rowsBuilder_ == null + ? rows_ + : rowsBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.status_ = statusBuilder_ == null + ? status_ + : statusBuilder_.build(); + to_bitField0_ |= 0x00000002; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.hasMoreResults_ = hasMoreResults_; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.spannerlib.v1.ExecuteResponse) { + return mergeFrom((com.google.cloud.spannerlib.v1.ExecuteResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.spannerlib.v1.ExecuteResponse other) { + if (other == com.google.cloud.spannerlib.v1.ExecuteResponse.getDefaultInstance()) return this; + if (other.hasRows()) { + mergeRows(other.getRows()); + } + if (resultSetsBuilder_ == null) { + if (!other.resultSets_.isEmpty()) { + if (resultSets_.isEmpty()) { + resultSets_ = other.resultSets_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureResultSetsIsMutable(); + resultSets_.addAll(other.resultSets_); + } + onChanged(); + } + } else { + if (!other.resultSets_.isEmpty()) { + if (resultSetsBuilder_.isEmpty()) { + resultSetsBuilder_.dispose(); + resultSetsBuilder_ = null; + resultSets_ = other.resultSets_; + bitField0_ = (bitField0_ & ~0x00000002); + resultSetsBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + internalGetResultSetsFieldBuilder() : null; + } else { + resultSetsBuilder_.addAllMessages(other.resultSets_); + } + } + } + if (other.hasStatus()) { + mergeStatus(other.getStatus()); + } + if (other.getHasMoreResults() != false) { + setHasMoreResults(other.getHasMoreResults()); + } + this.mergeUnknownFields(other.getUnknownFields()); + 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 { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + input.readMessage( + internalGetRowsFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: { + com.google.spanner.v1.ResultSet m = + input.readMessage( + com.google.spanner.v1.ResultSet.parser(), + extensionRegistry); + if (resultSetsBuilder_ == null) { + ensureResultSetsIsMutable(); + resultSets_.add(m); + } else { + resultSetsBuilder_.addMessage(m); + } + break; + } // case 18 + case 26: { + input.readMessage( + internalGetStatusFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000004; + break; + } // case 26 + case 32: { + hasMoreResults_ = input.readBool(); + bitField0_ |= 0x00000008; + break; + } // case 32 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private com.google.cloud.spannerlib.v1.Rows rows_; + private com.google.protobuf.SingleFieldBuilder< + com.google.cloud.spannerlib.v1.Rows, com.google.cloud.spannerlib.v1.Rows.Builder, com.google.cloud.spannerlib.v1.RowsOrBuilder> rowsBuilder_; + /** + * .google.spannerlib.v1.Rows rows = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return Whether the rows field is set. + */ + public boolean hasRows() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * .google.spannerlib.v1.Rows rows = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return The rows. + */ + public com.google.cloud.spannerlib.v1.Rows getRows() { + if (rowsBuilder_ == null) { + return rows_ == null ? com.google.cloud.spannerlib.v1.Rows.getDefaultInstance() : rows_; + } else { + return rowsBuilder_.getMessage(); + } + } + /** + * .google.spannerlib.v1.Rows rows = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder setRows(com.google.cloud.spannerlib.v1.Rows value) { + if (rowsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + rows_ = value; + } else { + rowsBuilder_.setMessage(value); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * .google.spannerlib.v1.Rows rows = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder setRows( + com.google.cloud.spannerlib.v1.Rows.Builder builderForValue) { + if (rowsBuilder_ == null) { + rows_ = builderForValue.build(); + } else { + rowsBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * .google.spannerlib.v1.Rows rows = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder mergeRows(com.google.cloud.spannerlib.v1.Rows value) { + if (rowsBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0) && + rows_ != null && + rows_ != com.google.cloud.spannerlib.v1.Rows.getDefaultInstance()) { + getRowsBuilder().mergeFrom(value); + } else { + rows_ = value; + } + } else { + rowsBuilder_.mergeFrom(value); + } + if (rows_ != null) { + bitField0_ |= 0x00000001; + onChanged(); + } + return this; + } + /** + * .google.spannerlib.v1.Rows rows = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder clearRows() { + bitField0_ = (bitField0_ & ~0x00000001); + rows_ = null; + if (rowsBuilder_ != null) { + rowsBuilder_.dispose(); + rowsBuilder_ = null; + } + onChanged(); + return this; + } + /** + * .google.spannerlib.v1.Rows rows = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public com.google.cloud.spannerlib.v1.Rows.Builder getRowsBuilder() { + bitField0_ |= 0x00000001; + onChanged(); + return internalGetRowsFieldBuilder().getBuilder(); + } + /** + * .google.spannerlib.v1.Rows rows = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public com.google.cloud.spannerlib.v1.RowsOrBuilder getRowsOrBuilder() { + if (rowsBuilder_ != null) { + return rowsBuilder_.getMessageOrBuilder(); + } else { + return rows_ == null ? + com.google.cloud.spannerlib.v1.Rows.getDefaultInstance() : rows_; + } + } + /** + * .google.spannerlib.v1.Rows rows = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.cloud.spannerlib.v1.Rows, com.google.cloud.spannerlib.v1.Rows.Builder, com.google.cloud.spannerlib.v1.RowsOrBuilder> + internalGetRowsFieldBuilder() { + if (rowsBuilder_ == null) { + rowsBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.google.cloud.spannerlib.v1.Rows, com.google.cloud.spannerlib.v1.Rows.Builder, com.google.cloud.spannerlib.v1.RowsOrBuilder>( + getRows(), + getParentForChildren(), + isClean()); + rows_ = null; + } + return rowsBuilder_; + } + + private java.util.List resultSets_ = + java.util.Collections.emptyList(); + private void ensureResultSetsIsMutable() { + if (!((bitField0_ & 0x00000002) != 0)) { + resultSets_ = new java.util.ArrayList(resultSets_); + bitField0_ |= 0x00000002; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + com.google.spanner.v1.ResultSet, com.google.spanner.v1.ResultSet.Builder, com.google.spanner.v1.ResultSetOrBuilder> resultSetsBuilder_; + + /** + * repeated .google.spanner.v1.ResultSet result_sets = 2; + */ + public java.util.List getResultSetsList() { + if (resultSetsBuilder_ == null) { + return java.util.Collections.unmodifiableList(resultSets_); + } else { + return resultSetsBuilder_.getMessageList(); + } + } + /** + * repeated .google.spanner.v1.ResultSet result_sets = 2; + */ + public int getResultSetsCount() { + if (resultSetsBuilder_ == null) { + return resultSets_.size(); + } else { + return resultSetsBuilder_.getCount(); + } + } + /** + * repeated .google.spanner.v1.ResultSet result_sets = 2; + */ + public com.google.spanner.v1.ResultSet getResultSets(int index) { + if (resultSetsBuilder_ == null) { + return resultSets_.get(index); + } else { + return resultSetsBuilder_.getMessage(index); + } + } + /** + * repeated .google.spanner.v1.ResultSet result_sets = 2; + */ + 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; + } + /** + * repeated .google.spanner.v1.ResultSet result_sets = 2; + */ + 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; + } + /** + * repeated .google.spanner.v1.ResultSet result_sets = 2; + */ + 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; + } + /** + * repeated .google.spanner.v1.ResultSet result_sets = 2; + */ + 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; + } + /** + * repeated .google.spanner.v1.ResultSet result_sets = 2; + */ + 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; + } + /** + * repeated .google.spanner.v1.ResultSet result_sets = 2; + */ + 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; + } + /** + * repeated .google.spanner.v1.ResultSet result_sets = 2; + */ + 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; + } + /** + * repeated .google.spanner.v1.ResultSet result_sets = 2; + */ + public Builder clearResultSets() { + if (resultSetsBuilder_ == null) { + resultSets_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + } else { + resultSetsBuilder_.clear(); + } + return this; + } + /** + * repeated .google.spanner.v1.ResultSet result_sets = 2; + */ + public Builder removeResultSets(int index) { + if (resultSetsBuilder_ == null) { + ensureResultSetsIsMutable(); + resultSets_.remove(index); + onChanged(); + } else { + resultSetsBuilder_.remove(index); + } + return this; + } + /** + * repeated .google.spanner.v1.ResultSet result_sets = 2; + */ + public com.google.spanner.v1.ResultSet.Builder getResultSetsBuilder( + int index) { + return internalGetResultSetsFieldBuilder().getBuilder(index); + } + /** + * repeated .google.spanner.v1.ResultSet result_sets = 2; + */ + public com.google.spanner.v1.ResultSetOrBuilder getResultSetsOrBuilder( + int index) { + if (resultSetsBuilder_ == null) { + return resultSets_.get(index); } else { + return resultSetsBuilder_.getMessageOrBuilder(index); + } + } + /** + * repeated .google.spanner.v1.ResultSet result_sets = 2; + */ + public java.util.List + getResultSetsOrBuilderList() { + if (resultSetsBuilder_ != null) { + return resultSetsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(resultSets_); + } + } + /** + * repeated .google.spanner.v1.ResultSet result_sets = 2; + */ + public com.google.spanner.v1.ResultSet.Builder addResultSetsBuilder() { + return internalGetResultSetsFieldBuilder().addBuilder( + com.google.spanner.v1.ResultSet.getDefaultInstance()); + } + /** + * repeated .google.spanner.v1.ResultSet result_sets = 2; + */ + public com.google.spanner.v1.ResultSet.Builder addResultSetsBuilder( + int index) { + return internalGetResultSetsFieldBuilder().addBuilder( + index, com.google.spanner.v1.ResultSet.getDefaultInstance()); + } + /** + * repeated .google.spanner.v1.ResultSet result_sets = 2; + */ + public java.util.List + getResultSetsBuilderList() { + return internalGetResultSetsFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + com.google.spanner.v1.ResultSet, com.google.spanner.v1.ResultSet.Builder, com.google.spanner.v1.ResultSetOrBuilder> + internalGetResultSetsFieldBuilder() { + if (resultSetsBuilder_ == null) { + resultSetsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + com.google.spanner.v1.ResultSet, com.google.spanner.v1.ResultSet.Builder, com.google.spanner.v1.ResultSetOrBuilder>( + resultSets_, + ((bitField0_ & 0x00000002) != 0), + getParentForChildren(), + isClean()); + resultSets_ = null; + } + return resultSetsBuilder_; + } + + private com.google.rpc.Status status_; + private com.google.protobuf.SingleFieldBuilder< + com.google.rpc.Status, com.google.rpc.Status.Builder, com.google.rpc.StatusOrBuilder> statusBuilder_; + /** + * .google.rpc.Status status = 3; + * @return Whether the status field is set. + */ + public boolean hasStatus() { + return ((bitField0_ & 0x00000004) != 0); + } + /** + * .google.rpc.Status status = 3; + * @return The status. + */ + public com.google.rpc.Status getStatus() { + if (statusBuilder_ == null) { + return status_ == null ? com.google.rpc.Status.getDefaultInstance() : status_; + } else { + return statusBuilder_.getMessage(); + } + } + /** + * .google.rpc.Status status = 3; + */ + public Builder setStatus(com.google.rpc.Status value) { + if (statusBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + status_ = value; + } else { + statusBuilder_.setMessage(value); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * .google.rpc.Status status = 3; + */ + public Builder setStatus( + com.google.rpc.Status.Builder builderForValue) { + if (statusBuilder_ == null) { + status_ = builderForValue.build(); + } else { + statusBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * .google.rpc.Status status = 3; + */ + public Builder mergeStatus(com.google.rpc.Status value) { + if (statusBuilder_ == null) { + if (((bitField0_ & 0x00000004) != 0) && + status_ != null && + status_ != com.google.rpc.Status.getDefaultInstance()) { + getStatusBuilder().mergeFrom(value); + } else { + status_ = value; + } + } else { + statusBuilder_.mergeFrom(value); + } + if (status_ != null) { + bitField0_ |= 0x00000004; + onChanged(); + } + return this; + } + /** + * .google.rpc.Status status = 3; + */ + public Builder clearStatus() { + bitField0_ = (bitField0_ & ~0x00000004); + status_ = null; + if (statusBuilder_ != null) { + statusBuilder_.dispose(); + statusBuilder_ = null; + } + onChanged(); + return this; + } + /** + * .google.rpc.Status status = 3; + */ + public com.google.rpc.Status.Builder getStatusBuilder() { + bitField0_ |= 0x00000004; + onChanged(); + return internalGetStatusFieldBuilder().getBuilder(); + } + /** + * .google.rpc.Status status = 3; + */ + public com.google.rpc.StatusOrBuilder getStatusOrBuilder() { + if (statusBuilder_ != null) { + return statusBuilder_.getMessageOrBuilder(); + } else { + return status_ == null ? + com.google.rpc.Status.getDefaultInstance() : status_; + } + } + /** + * .google.rpc.Status status = 3; + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.rpc.Status, com.google.rpc.Status.Builder, com.google.rpc.StatusOrBuilder> + internalGetStatusFieldBuilder() { + if (statusBuilder_ == null) { + statusBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.google.rpc.Status, com.google.rpc.Status.Builder, com.google.rpc.StatusOrBuilder>( + getStatus(), + getParentForChildren(), + isClean()); + status_ = null; + } + return statusBuilder_; + } + + private boolean hasMoreResults_ ; + /** + * bool has_more_results = 4; + * @return The hasMoreResults. + */ + @java.lang.Override + public boolean getHasMoreResults() { + return hasMoreResults_; + } + /** + * bool has_more_results = 4; + * @param value The hasMoreResults to set. + * @return This builder for chaining. + */ + public Builder setHasMoreResults(boolean value) { + + hasMoreResults_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + * bool has_more_results = 4; + * @return This builder for chaining. + */ + public Builder clearHasMoreResults() { + bitField0_ = (bitField0_ & ~0x00000008); + hasMoreResults_ = false; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:google.spannerlib.v1.ExecuteResponse) + } + + // @@protoc_insertion_point(class_scope:google.spannerlib.v1.ExecuteResponse) + private static final com.google.cloud.spannerlib.v1.ExecuteResponse DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.google.cloud.spannerlib.v1.ExecuteResponse(); + } + + public static com.google.cloud.spannerlib.v1.ExecuteResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ExecuteResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + 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.cloud.spannerlib.v1.ExecuteResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/spannerlib/wrappers/spannerlib-java/src/main/java/com/google/cloud/spannerlib/v1/ExecuteResponseOrBuilder.java b/spannerlib/wrappers/spannerlib-java/src/main/java/com/google/cloud/spannerlib/v1/ExecuteResponseOrBuilder.java new file mode 100644 index 00000000..8872a5d2 --- /dev/null +++ b/spannerlib/wrappers/spannerlib-java/src/main/java/com/google/cloud/spannerlib/v1/ExecuteResponseOrBuilder.java @@ -0,0 +1,72 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: google/spannerlib/v1/spannerlib.proto +// Protobuf Java Version: 4.32.1 + +package com.google.cloud.spannerlib.v1; + +@com.google.protobuf.Generated +public interface ExecuteResponseOrBuilder extends + // @@protoc_insertion_point(interface_extends:google.spannerlib.v1.ExecuteResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * .google.spannerlib.v1.Rows rows = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return Whether the rows field is set. + */ + boolean hasRows(); + /** + * .google.spannerlib.v1.Rows rows = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return The rows. + */ + com.google.cloud.spannerlib.v1.Rows getRows(); + /** + * .google.spannerlib.v1.Rows rows = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + com.google.cloud.spannerlib.v1.RowsOrBuilder getRowsOrBuilder(); + + /** + * repeated .google.spanner.v1.ResultSet result_sets = 2; + */ + java.util.List + getResultSetsList(); + /** + * repeated .google.spanner.v1.ResultSet result_sets = 2; + */ + com.google.spanner.v1.ResultSet getResultSets(int index); + /** + * repeated .google.spanner.v1.ResultSet result_sets = 2; + */ + int getResultSetsCount(); + /** + * repeated .google.spanner.v1.ResultSet result_sets = 2; + */ + java.util.List + getResultSetsOrBuilderList(); + /** + * repeated .google.spanner.v1.ResultSet result_sets = 2; + */ + com.google.spanner.v1.ResultSetOrBuilder getResultSetsOrBuilder( + int index); + + /** + * .google.rpc.Status status = 3; + * @return Whether the status field is set. + */ + boolean hasStatus(); + /** + * .google.rpc.Status status = 3; + * @return The status. + */ + com.google.rpc.Status getStatus(); + /** + * .google.rpc.Status status = 3; + */ + com.google.rpc.StatusOrBuilder getStatusOrBuilder(); + + /** + * bool has_more_results = 4; + * @return The hasMoreResults. + */ + boolean getHasMoreResults(); +} diff --git a/spannerlib/wrappers/spannerlib-java/src/main/java/com/google/cloud/spannerlib/v1/FetchOptions.java b/spannerlib/wrappers/spannerlib-java/src/main/java/com/google/cloud/spannerlib/v1/FetchOptions.java new file mode 100644 index 00000000..2a60d958 --- /dev/null +++ b/spannerlib/wrappers/spannerlib-java/src/main/java/com/google/cloud/spannerlib/v1/FetchOptions.java @@ -0,0 +1,500 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: google/spannerlib/v1/spannerlib.proto +// Protobuf Java Version: 4.32.1 + +package com.google.cloud.spannerlib.v1; + +/** + * Protobuf type {@code google.spannerlib.v1.FetchOptions} + */ +@com.google.protobuf.Generated +public final class FetchOptions extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:google.spannerlib.v1.FetchOptions) + FetchOptionsOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 32, + /* patch= */ 1, + /* suffix= */ "", + FetchOptions.class.getName()); + } + // Use FetchOptions.newBuilder() to construct. + private FetchOptions(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private FetchOptions() { + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.spannerlib.v1.SpannerLibProto.internal_static_google_spannerlib_v1_FetchOptions_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.spannerlib.v1.SpannerLibProto.internal_static_google_spannerlib_v1_FetchOptions_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.spannerlib.v1.FetchOptions.class, com.google.cloud.spannerlib.v1.FetchOptions.Builder.class); + } + + public static final int NUM_ROWS_FIELD_NUMBER = 1; + private long numRows_ = 0L; + /** + * int64 num_rows = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return The numRows. + */ + @java.lang.Override + public long getNumRows() { + return numRows_; + } + + public static final int ENCODING_FIELD_NUMBER = 2; + private long encoding_ = 0L; + /** + * int64 encoding = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return The encoding. + */ + @java.lang.Override + public long getEncoding() { + return encoding_; + } + + 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 (numRows_ != 0L) { + output.writeInt64(1, numRows_); + } + if (encoding_ != 0L) { + output.writeInt64(2, encoding_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (numRows_ != 0L) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(1, numRows_); + } + if (encoding_ != 0L) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(2, encoding_); + } + size += getUnknownFields().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.cloud.spannerlib.v1.FetchOptions)) { + return super.equals(obj); + } + com.google.cloud.spannerlib.v1.FetchOptions other = (com.google.cloud.spannerlib.v1.FetchOptions) obj; + + if (getNumRows() + != other.getNumRows()) return false; + if (getEncoding() + != other.getEncoding()) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NUM_ROWS_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getNumRows()); + hash = (37 * hash) + ENCODING_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getEncoding()); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.spannerlib.v1.FetchOptions parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.spannerlib.v1.FetchOptions parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.google.cloud.spannerlib.v1.FetchOptions parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.spannerlib.v1.FetchOptions 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.cloud.spannerlib.v1.FetchOptions parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.spannerlib.v1.FetchOptions parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.google.cloud.spannerlib.v1.FetchOptions parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static com.google.cloud.spannerlib.v1.FetchOptions parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static com.google.cloud.spannerlib.v1.FetchOptions parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.spannerlib.v1.FetchOptions parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.google.cloud.spannerlib.v1.FetchOptions parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static com.google.cloud.spannerlib.v1.FetchOptions parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .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.cloud.spannerlib.v1.FetchOptions 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.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code google.spannerlib.v1.FetchOptions} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:google.spannerlib.v1.FetchOptions) + com.google.cloud.spannerlib.v1.FetchOptionsOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.spannerlib.v1.SpannerLibProto.internal_static_google_spannerlib_v1_FetchOptions_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.spannerlib.v1.SpannerLibProto.internal_static_google_spannerlib_v1_FetchOptions_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.spannerlib.v1.FetchOptions.class, com.google.cloud.spannerlib.v1.FetchOptions.Builder.class); + } + + // Construct using com.google.cloud.spannerlib.v1.FetchOptions.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + numRows_ = 0L; + encoding_ = 0L; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.google.cloud.spannerlib.v1.SpannerLibProto.internal_static_google_spannerlib_v1_FetchOptions_descriptor; + } + + @java.lang.Override + public com.google.cloud.spannerlib.v1.FetchOptions getDefaultInstanceForType() { + return com.google.cloud.spannerlib.v1.FetchOptions.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.spannerlib.v1.FetchOptions build() { + com.google.cloud.spannerlib.v1.FetchOptions result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.spannerlib.v1.FetchOptions buildPartial() { + com.google.cloud.spannerlib.v1.FetchOptions result = new com.google.cloud.spannerlib.v1.FetchOptions(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.cloud.spannerlib.v1.FetchOptions result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.numRows_ = numRows_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.encoding_ = encoding_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.spannerlib.v1.FetchOptions) { + return mergeFrom((com.google.cloud.spannerlib.v1.FetchOptions)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.spannerlib.v1.FetchOptions other) { + if (other == com.google.cloud.spannerlib.v1.FetchOptions.getDefaultInstance()) return this; + if (other.getNumRows() != 0L) { + setNumRows(other.getNumRows()); + } + if (other.getEncoding() != 0L) { + setEncoding(other.getEncoding()); + } + this.mergeUnknownFields(other.getUnknownFields()); + 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 { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + numRows_ = input.readInt64(); + bitField0_ |= 0x00000001; + break; + } // case 8 + case 16: { + encoding_ = input.readInt64(); + bitField0_ |= 0x00000002; + break; + } // case 16 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private long numRows_ ; + /** + * int64 num_rows = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return The numRows. + */ + @java.lang.Override + public long getNumRows() { + return numRows_; + } + /** + * int64 num_rows = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param value The numRows to set. + * @return This builder for chaining. + */ + public Builder setNumRows(long value) { + + numRows_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * int64 num_rows = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return This builder for chaining. + */ + public Builder clearNumRows() { + bitField0_ = (bitField0_ & ~0x00000001); + numRows_ = 0L; + onChanged(); + return this; + } + + private long encoding_ ; + /** + * int64 encoding = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return The encoding. + */ + @java.lang.Override + public long getEncoding() { + return encoding_; + } + /** + * int64 encoding = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param value The encoding to set. + * @return This builder for chaining. + */ + public Builder setEncoding(long value) { + + encoding_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * int64 encoding = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return This builder for chaining. + */ + public Builder clearEncoding() { + bitField0_ = (bitField0_ & ~0x00000002); + encoding_ = 0L; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:google.spannerlib.v1.FetchOptions) + } + + // @@protoc_insertion_point(class_scope:google.spannerlib.v1.FetchOptions) + private static final com.google.cloud.spannerlib.v1.FetchOptions DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.google.cloud.spannerlib.v1.FetchOptions(); + } + + public static com.google.cloud.spannerlib.v1.FetchOptions getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public FetchOptions parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + 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.cloud.spannerlib.v1.FetchOptions getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/spannerlib/wrappers/spannerlib-java/src/main/java/com/google/cloud/spannerlib/v1/FetchOptionsOrBuilder.java b/spannerlib/wrappers/spannerlib-java/src/main/java/com/google/cloud/spannerlib/v1/FetchOptionsOrBuilder.java new file mode 100644 index 00000000..23844684 --- /dev/null +++ b/spannerlib/wrappers/spannerlib-java/src/main/java/com/google/cloud/spannerlib/v1/FetchOptionsOrBuilder.java @@ -0,0 +1,24 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: google/spannerlib/v1/spannerlib.proto +// Protobuf Java Version: 4.32.1 + +package com.google.cloud.spannerlib.v1; + +@com.google.protobuf.Generated +public interface FetchOptionsOrBuilder extends + // @@protoc_insertion_point(interface_extends:google.spannerlib.v1.FetchOptions) + com.google.protobuf.MessageOrBuilder { + + /** + * int64 num_rows = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return The numRows. + */ + long getNumRows(); + + /** + * int64 encoding = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return The encoding. + */ + long getEncoding(); +} diff --git a/spannerlib/wrappers/spannerlib-java/src/main/java/com/google/cloud/spannerlib/v1/NextRequest.java b/spannerlib/wrappers/spannerlib-java/src/main/java/com/google/cloud/spannerlib/v1/NextRequest.java index 9decc52c..3af8e7ba 100644 --- a/spannerlib/wrappers/spannerlib-java/src/main/java/com/google/cloud/spannerlib/v1/NextRequest.java +++ b/spannerlib/wrappers/spannerlib-java/src/main/java/com/google/cloud/spannerlib/v1/NextRequest.java @@ -70,26 +70,30 @@ public com.google.cloud.spannerlib.v1.RowsOrBuilder getRowsOrBuilder() { return rows_ == null ? com.google.cloud.spannerlib.v1.Rows.getDefaultInstance() : rows_; } - public static final int NUM_ROWS_FIELD_NUMBER = 2; - private long numRows_ = 0L; + public static final int FETCH_OPTIONS_FIELD_NUMBER = 2; + private com.google.cloud.spannerlib.v1.FetchOptions fetchOptions_; /** - * int64 num_rows = 2 [(.google.api.field_behavior) = REQUIRED]; - * @return The numRows. + * .google.spannerlib.v1.FetchOptions fetch_options = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return Whether the fetchOptions field is set. */ @java.lang.Override - public long getNumRows() { - return numRows_; + public boolean hasFetchOptions() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * .google.spannerlib.v1.FetchOptions fetch_options = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return The fetchOptions. + */ + @java.lang.Override + public com.google.cloud.spannerlib.v1.FetchOptions getFetchOptions() { + return fetchOptions_ == null ? com.google.cloud.spannerlib.v1.FetchOptions.getDefaultInstance() : fetchOptions_; } - - public static final int ENCODING_FIELD_NUMBER = 3; - private long encoding_ = 0L; /** - * int64 encoding = 3 [(.google.api.field_behavior) = REQUIRED]; - * @return The encoding. + * .google.spannerlib.v1.FetchOptions fetch_options = 2 [(.google.api.field_behavior) = REQUIRED]; */ @java.lang.Override - public long getEncoding() { - return encoding_; + public com.google.cloud.spannerlib.v1.FetchOptionsOrBuilder getFetchOptionsOrBuilder() { + return fetchOptions_ == null ? com.google.cloud.spannerlib.v1.FetchOptions.getDefaultInstance() : fetchOptions_; } private byte memoizedIsInitialized = -1; @@ -109,11 +113,8 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) if (((bitField0_ & 0x00000001) != 0)) { output.writeMessage(1, getRows()); } - if (numRows_ != 0L) { - output.writeInt64(2, numRows_); - } - if (encoding_ != 0L) { - output.writeInt64(3, encoding_); + if (((bitField0_ & 0x00000002) != 0)) { + output.writeMessage(2, getFetchOptions()); } getUnknownFields().writeTo(output); } @@ -128,13 +129,9 @@ public int getSerializedSize() { size += com.google.protobuf.CodedOutputStream .computeMessageSize(1, getRows()); } - if (numRows_ != 0L) { - size += com.google.protobuf.CodedOutputStream - .computeInt64Size(2, numRows_); - } - if (encoding_ != 0L) { + if (((bitField0_ & 0x00000002) != 0)) { size += com.google.protobuf.CodedOutputStream - .computeInt64Size(3, encoding_); + .computeMessageSize(2, getFetchOptions()); } size += getUnknownFields().getSerializedSize(); memoizedSize = size; @@ -156,10 +153,11 @@ public boolean equals(final java.lang.Object obj) { if (!getRows() .equals(other.getRows())) return false; } - if (getNumRows() - != other.getNumRows()) return false; - if (getEncoding() - != other.getEncoding()) return false; + if (hasFetchOptions() != other.hasFetchOptions()) return false; + if (hasFetchOptions()) { + if (!getFetchOptions() + .equals(other.getFetchOptions())) return false; + } if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -175,12 +173,10 @@ public int hashCode() { hash = (37 * hash) + ROWS_FIELD_NUMBER; hash = (53 * hash) + getRows().hashCode(); } - hash = (37 * hash) + NUM_ROWS_FIELD_NUMBER; - hash = (53 * hash) + com.google.protobuf.Internal.hashLong( - getNumRows()); - hash = (37 * hash) + ENCODING_FIELD_NUMBER; - hash = (53 * hash) + com.google.protobuf.Internal.hashLong( - getEncoding()); + if (hasFetchOptions()) { + hash = (37 * hash) + FETCH_OPTIONS_FIELD_NUMBER; + hash = (53 * hash) + getFetchOptions().hashCode(); + } hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; @@ -312,6 +308,7 @@ private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage .alwaysUseFieldBuilders) { internalGetRowsFieldBuilder(); + internalGetFetchOptionsFieldBuilder(); } } @java.lang.Override @@ -323,8 +320,11 @@ public Builder clear() { rowsBuilder_.dispose(); rowsBuilder_ = null; } - numRows_ = 0L; - encoding_ = 0L; + fetchOptions_ = null; + if (fetchOptionsBuilder_ != null) { + fetchOptionsBuilder_.dispose(); + fetchOptionsBuilder_ = null; + } return this; } @@ -366,10 +366,10 @@ private void buildPartial0(com.google.cloud.spannerlib.v1.NextRequest result) { to_bitField0_ |= 0x00000001; } if (((from_bitField0_ & 0x00000002) != 0)) { - result.numRows_ = numRows_; - } - if (((from_bitField0_ & 0x00000004) != 0)) { - result.encoding_ = encoding_; + result.fetchOptions_ = fetchOptionsBuilder_ == null + ? fetchOptions_ + : fetchOptionsBuilder_.build(); + to_bitField0_ |= 0x00000002; } result.bitField0_ |= to_bitField0_; } @@ -389,11 +389,8 @@ public Builder mergeFrom(com.google.cloud.spannerlib.v1.NextRequest other) { if (other.hasRows()) { mergeRows(other.getRows()); } - if (other.getNumRows() != 0L) { - setNumRows(other.getNumRows()); - } - if (other.getEncoding() != 0L) { - setEncoding(other.getEncoding()); + if (other.hasFetchOptions()) { + mergeFetchOptions(other.getFetchOptions()); } this.mergeUnknownFields(other.getUnknownFields()); onChanged(); @@ -428,16 +425,13 @@ public Builder mergeFrom( bitField0_ |= 0x00000001; break; } // case 10 - case 16: { - numRows_ = input.readInt64(); + case 18: { + input.readMessage( + internalGetFetchOptionsFieldBuilder().getBuilder(), + extensionRegistry); bitField0_ |= 0x00000002; break; - } // case 16 - case 24: { - encoding_ = input.readInt64(); - bitField0_ |= 0x00000004; - break; - } // case 24 + } // case 18 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { done = true; // was an endgroup tag @@ -576,68 +570,125 @@ public com.google.cloud.spannerlib.v1.RowsOrBuilder getRowsOrBuilder() { return rowsBuilder_; } - private long numRows_ ; + private com.google.cloud.spannerlib.v1.FetchOptions fetchOptions_; + private com.google.protobuf.SingleFieldBuilder< + com.google.cloud.spannerlib.v1.FetchOptions, com.google.cloud.spannerlib.v1.FetchOptions.Builder, com.google.cloud.spannerlib.v1.FetchOptionsOrBuilder> fetchOptionsBuilder_; /** - * int64 num_rows = 2 [(.google.api.field_behavior) = REQUIRED]; - * @return The numRows. + * .google.spannerlib.v1.FetchOptions fetch_options = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return Whether the fetchOptions field is set. */ - @java.lang.Override - public long getNumRows() { - return numRows_; + public boolean hasFetchOptions() { + return ((bitField0_ & 0x00000002) != 0); } /** - * int64 num_rows = 2 [(.google.api.field_behavior) = REQUIRED]; - * @param value The numRows to set. - * @return This builder for chaining. + * .google.spannerlib.v1.FetchOptions fetch_options = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return The fetchOptions. */ - public Builder setNumRows(long value) { - - numRows_ = value; + public com.google.cloud.spannerlib.v1.FetchOptions getFetchOptions() { + if (fetchOptionsBuilder_ == null) { + return fetchOptions_ == null ? com.google.cloud.spannerlib.v1.FetchOptions.getDefaultInstance() : fetchOptions_; + } else { + return fetchOptionsBuilder_.getMessage(); + } + } + /** + * .google.spannerlib.v1.FetchOptions fetch_options = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder setFetchOptions(com.google.cloud.spannerlib.v1.FetchOptions value) { + if (fetchOptionsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + fetchOptions_ = value; + } else { + fetchOptionsBuilder_.setMessage(value); + } bitField0_ |= 0x00000002; onChanged(); return this; } /** - * int64 num_rows = 2 [(.google.api.field_behavior) = REQUIRED]; - * @return This builder for chaining. + * .google.spannerlib.v1.FetchOptions fetch_options = 2 [(.google.api.field_behavior) = REQUIRED]; */ - public Builder clearNumRows() { - bitField0_ = (bitField0_ & ~0x00000002); - numRows_ = 0L; + public Builder setFetchOptions( + com.google.cloud.spannerlib.v1.FetchOptions.Builder builderForValue) { + if (fetchOptionsBuilder_ == null) { + fetchOptions_ = builderForValue.build(); + } else { + fetchOptionsBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000002; onChanged(); return this; } - - private long encoding_ ; /** - * int64 encoding = 3 [(.google.api.field_behavior) = REQUIRED]; - * @return The encoding. + * .google.spannerlib.v1.FetchOptions fetch_options = 2 [(.google.api.field_behavior) = REQUIRED]; */ - @java.lang.Override - public long getEncoding() { - return encoding_; + public Builder mergeFetchOptions(com.google.cloud.spannerlib.v1.FetchOptions value) { + if (fetchOptionsBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0) && + fetchOptions_ != null && + fetchOptions_ != com.google.cloud.spannerlib.v1.FetchOptions.getDefaultInstance()) { + getFetchOptionsBuilder().mergeFrom(value); + } else { + fetchOptions_ = value; + } + } else { + fetchOptionsBuilder_.mergeFrom(value); + } + if (fetchOptions_ != null) { + bitField0_ |= 0x00000002; + onChanged(); + } + return this; } /** - * int64 encoding = 3 [(.google.api.field_behavior) = REQUIRED]; - * @param value The encoding to set. - * @return This builder for chaining. + * .google.spannerlib.v1.FetchOptions fetch_options = 2 [(.google.api.field_behavior) = REQUIRED]; */ - public Builder setEncoding(long value) { - - encoding_ = value; - bitField0_ |= 0x00000004; + public Builder clearFetchOptions() { + bitField0_ = (bitField0_ & ~0x00000002); + fetchOptions_ = null; + if (fetchOptionsBuilder_ != null) { + fetchOptionsBuilder_.dispose(); + fetchOptionsBuilder_ = null; + } onChanged(); return this; } /** - * int64 encoding = 3 [(.google.api.field_behavior) = REQUIRED]; - * @return This builder for chaining. + * .google.spannerlib.v1.FetchOptions fetch_options = 2 [(.google.api.field_behavior) = REQUIRED]; */ - public Builder clearEncoding() { - bitField0_ = (bitField0_ & ~0x00000004); - encoding_ = 0L; + public com.google.cloud.spannerlib.v1.FetchOptions.Builder getFetchOptionsBuilder() { + bitField0_ |= 0x00000002; onChanged(); - return this; + return internalGetFetchOptionsFieldBuilder().getBuilder(); + } + /** + * .google.spannerlib.v1.FetchOptions fetch_options = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + public com.google.cloud.spannerlib.v1.FetchOptionsOrBuilder getFetchOptionsOrBuilder() { + if (fetchOptionsBuilder_ != null) { + return fetchOptionsBuilder_.getMessageOrBuilder(); + } else { + return fetchOptions_ == null ? + com.google.cloud.spannerlib.v1.FetchOptions.getDefaultInstance() : fetchOptions_; + } + } + /** + * .google.spannerlib.v1.FetchOptions fetch_options = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.cloud.spannerlib.v1.FetchOptions, com.google.cloud.spannerlib.v1.FetchOptions.Builder, com.google.cloud.spannerlib.v1.FetchOptionsOrBuilder> + internalGetFetchOptionsFieldBuilder() { + if (fetchOptionsBuilder_ == null) { + fetchOptionsBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.google.cloud.spannerlib.v1.FetchOptions, com.google.cloud.spannerlib.v1.FetchOptions.Builder, com.google.cloud.spannerlib.v1.FetchOptionsOrBuilder>( + getFetchOptions(), + getParentForChildren(), + isClean()); + fetchOptions_ = null; + } + return fetchOptionsBuilder_; } // @@protoc_insertion_point(builder_scope:google.spannerlib.v1.NextRequest) diff --git a/spannerlib/wrappers/spannerlib-java/src/main/java/com/google/cloud/spannerlib/v1/NextRequestOrBuilder.java b/spannerlib/wrappers/spannerlib-java/src/main/java/com/google/cloud/spannerlib/v1/NextRequestOrBuilder.java index 664bed22..567fc52a 100644 --- a/spannerlib/wrappers/spannerlib-java/src/main/java/com/google/cloud/spannerlib/v1/NextRequestOrBuilder.java +++ b/spannerlib/wrappers/spannerlib-java/src/main/java/com/google/cloud/spannerlib/v1/NextRequestOrBuilder.java @@ -26,14 +26,17 @@ public interface NextRequestOrBuilder extends com.google.cloud.spannerlib.v1.RowsOrBuilder getRowsOrBuilder(); /** - * int64 num_rows = 2 [(.google.api.field_behavior) = REQUIRED]; - * @return The numRows. + * .google.spannerlib.v1.FetchOptions fetch_options = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return Whether the fetchOptions field is set. */ - long getNumRows(); - + boolean hasFetchOptions(); + /** + * .google.spannerlib.v1.FetchOptions fetch_options = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return The fetchOptions. + */ + com.google.cloud.spannerlib.v1.FetchOptions getFetchOptions(); /** - * int64 encoding = 3 [(.google.api.field_behavior) = REQUIRED]; - * @return The encoding. + * .google.spannerlib.v1.FetchOptions fetch_options = 2 [(.google.api.field_behavior) = REQUIRED]; */ - long getEncoding(); + com.google.cloud.spannerlib.v1.FetchOptionsOrBuilder getFetchOptionsOrBuilder(); } diff --git a/spannerlib/wrappers/spannerlib-java/src/main/java/com/google/cloud/spannerlib/v1/SpannerLibGrpc.java b/spannerlib/wrappers/spannerlib-java/src/main/java/com/google/cloud/spannerlib/v1/SpannerLibGrpc.java index fbfb5da6..53ddbe57 100644 --- a/spannerlib/wrappers/spannerlib-java/src/main/java/com/google/cloud/spannerlib/v1/SpannerLibGrpc.java +++ b/spannerlib/wrappers/spannerlib-java/src/main/java/com/google/cloud/spannerlib/v1/SpannerLibGrpc.java @@ -570,6 +570,37 @@ com.google.cloud.spannerlib.v1.ConnectionStreamResponse> getConnectionStreamMeth return getConnectionStreamMethod; } + private static volatile io.grpc.MethodDescriptor getContinueStreamingMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "ContinueStreaming", + requestType = com.google.cloud.spannerlib.v1.Rows.class, + responseType = com.google.cloud.spannerlib.v1.RowData.class, + methodType = io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING) + public static io.grpc.MethodDescriptor getContinueStreamingMethod() { + io.grpc.MethodDescriptor getContinueStreamingMethod; + if ((getContinueStreamingMethod = SpannerLibGrpc.getContinueStreamingMethod) == null) { + synchronized (SpannerLibGrpc.class) { + if ((getContinueStreamingMethod = SpannerLibGrpc.getContinueStreamingMethod) == null) { + SpannerLibGrpc.getContinueStreamingMethod = getContinueStreamingMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "ContinueStreaming")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.spannerlib.v1.Rows.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.spannerlib.v1.RowData.getDefaultInstance())) + .setSchemaDescriptor(new SpannerLibMethodDescriptorSupplier("ContinueStreaming")) + .build(); + } + } + } + return getContinueStreamingMethod; + } + /** * Creates a new async stub that supports all call types for the service */ @@ -753,11 +784,29 @@ default void writeMutations(com.google.cloud.spannerlib.v1.WriteMutationsRequest } /** + *
+     * ConnectionStream opens a bi-directional gRPC stream between the client and the server.
+     * This stream can be re-used by the client for multiple requests, and normally gives the
+     * lowest possible latency, at the cost of a slightly more complex API.
+     * 
*/ default io.grpc.stub.StreamObserver connectionStream( io.grpc.stub.StreamObserver responseObserver) { return io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall(getConnectionStreamMethod(), responseObserver); } + + /** + *
+     * ContinueStreaming returns a server stream that returns the remaining rows of a SQL statement
+     * that has previously been executed using a ConnectionStreamRequest on a bi-directional
+     * ConnectionStream. The client is responsible for calling this RPC if the has_more_data flag
+     * of the ExecuteResponse was true.
+     * 
+ */ + default void continueStreaming(com.google.cloud.spannerlib.v1.Rows request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getContinueStreamingMethod(), responseObserver); + } } /** @@ -924,12 +973,31 @@ public void writeMutations(com.google.cloud.spannerlib.v1.WriteMutationsRequest } /** + *
+     * ConnectionStream opens a bi-directional gRPC stream between the client and the server.
+     * This stream can be re-used by the client for multiple requests, and normally gives the
+     * lowest possible latency, at the cost of a slightly more complex API.
+     * 
*/ public io.grpc.stub.StreamObserver connectionStream( io.grpc.stub.StreamObserver responseObserver) { return io.grpc.stub.ClientCalls.asyncBidiStreamingCall( getChannel().newCall(getConnectionStreamMethod(), getCallOptions()), responseObserver); } + + /** + *
+     * ContinueStreaming returns a server stream that returns the remaining rows of a SQL statement
+     * that has previously been executed using a ConnectionStreamRequest on a bi-directional
+     * ConnectionStream. The client is responsible for calling this RPC if the has_more_data flag
+     * of the ExecuteResponse was true.
+     * 
+ */ + public void continueStreaming(com.google.cloud.spannerlib.v1.Rows request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncServerStreamingCall( + getChannel().newCall(getContinueStreamingMethod(), getCallOptions()), request, responseObserver); + } } /** @@ -1070,6 +1138,11 @@ public com.google.spanner.v1.CommitResponse writeMutations(com.google.cloud.span } /** + *
+     * ConnectionStream opens a bi-directional gRPC stream between the client and the server.
+     * This stream can be re-used by the client for multiple requests, and normally gives the
+     * lowest possible latency, at the cost of a slightly more complex API.
+     * 
*/ @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/10918") public io.grpc.stub.BlockingClientCall @@ -1077,6 +1150,21 @@ public com.google.spanner.v1.CommitResponse writeMutations(com.google.cloud.span return io.grpc.stub.ClientCalls.blockingBidiStreamingCall( getChannel(), getConnectionStreamMethod(), getCallOptions()); } + + /** + *
+     * ContinueStreaming returns a server stream that returns the remaining rows of a SQL statement
+     * that has previously been executed using a ConnectionStreamRequest on a bi-directional
+     * ConnectionStream. The client is responsible for calling this RPC if the has_more_data flag
+     * of the ExecuteResponse was true.
+     * 
+ */ + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/10918") + public io.grpc.stub.BlockingClientCall + continueStreaming(com.google.cloud.spannerlib.v1.Rows request) { + return io.grpc.stub.ClientCalls.blockingV2ServerStreamingCall( + getChannel(), getContinueStreamingMethod(), getCallOptions(), request); + } } /** @@ -1214,6 +1302,20 @@ public com.google.spanner.v1.CommitResponse writeMutations(com.google.cloud.span return io.grpc.stub.ClientCalls.blockingUnaryCall( getChannel(), getWriteMutationsMethod(), getCallOptions(), request); } + + /** + *
+     * ContinueStreaming returns a server stream that returns the remaining rows of a SQL statement
+     * that has previously been executed using a ConnectionStreamRequest on a bi-directional
+     * ConnectionStream. The client is responsible for calling this RPC if the has_more_data flag
+     * of the ExecuteResponse was true.
+     * 
+ */ + public java.util.Iterator continueStreaming( + com.google.cloud.spannerlib.v1.Rows request) { + return io.grpc.stub.ClientCalls.blockingServerStreamingCall( + getChannel(), getContinueStreamingMethod(), getCallOptions(), request); + } } /** @@ -1378,7 +1480,8 @@ public com.google.common.util.concurrent.ListenableFuture implements io.grpc.stub.ServerCalls.UnaryMethod, @@ -1465,6 +1568,10 @@ public void invoke(Req request, io.grpc.stub.StreamObserver responseObserv serviceImpl.writeMutations((com.google.cloud.spannerlib.v1.WriteMutationsRequest) request, (io.grpc.stub.StreamObserver) responseObserver); break; + case METHODID_CONTINUE_STREAMING: + serviceImpl.continueStreaming((com.google.cloud.spannerlib.v1.Rows) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; default: throw new AssertionError(); } @@ -1612,6 +1719,13 @@ public static final io.grpc.ServerServiceDefinition bindService(AsyncService ser com.google.cloud.spannerlib.v1.ConnectionStreamRequest, com.google.cloud.spannerlib.v1.ConnectionStreamResponse>( service, METHODID_CONNECTION_STREAM))) + .addMethod( + getContinueStreamingMethod(), + io.grpc.stub.ServerCalls.asyncServerStreamingCall( + new MethodHandlers< + com.google.cloud.spannerlib.v1.Rows, + com.google.cloud.spannerlib.v1.RowData>( + service, METHODID_CONTINUE_STREAMING))) .build(); } @@ -1678,6 +1792,7 @@ public static io.grpc.ServiceDescriptor getServiceDescriptor() { .addMethod(getRollbackMethod()) .addMethod(getWriteMutationsMethod()) .addMethod(getConnectionStreamMethod()) + .addMethod(getContinueStreamingMethod()) .build(); } } diff --git a/spannerlib/wrappers/spannerlib-java/src/main/java/com/google/cloud/spannerlib/v1/SpannerLibProto.java b/spannerlib/wrappers/spannerlib-java/src/main/java/com/google/cloud/spannerlib/v1/SpannerLibProto.java index b782bddb..02ed283b 100644 --- a/spannerlib/wrappers/spannerlib-java/src/main/java/com/google/cloud/spannerlib/v1/SpannerLibProto.java +++ b/spannerlib/wrappers/spannerlib-java/src/main/java/com/google/cloud/spannerlib/v1/SpannerLibProto.java @@ -46,6 +46,11 @@ public static void registerAllExtensions( static final com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_google_spannerlib_v1_CreateConnectionRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_spannerlib_v1_FetchOptions_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_google_spannerlib_v1_FetchOptions_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_spannerlib_v1_ExecuteRequest_descriptor; static final @@ -106,6 +111,11 @@ public static void registerAllExtensions( static final com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_google_spannerlib_v1_ConnectionStreamRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_spannerlib_v1_ExecuteResponse_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_google_spannerlib_v1_ExecuteResponse_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_spannerlib_v1_ConnectionStreamResponse_descriptor; static final @@ -123,96 +133,126 @@ public static void registerAllExtensions( "\n%google/spannerlib/v1/spannerlib.proto\022" + "\024google.spannerlib.v1\032\037google/api/field_" + "behavior.proto\032\033google/protobuf/empty.pr" + - "oto\032\034google/protobuf/struct.proto\032\"googl" + - "e/spanner/v1/result_set.proto\032\037google/sp" + - "anner/v1/spanner.proto\032#google/spanner/v" + - "1/transaction.proto\"\r\n\013InfoRequest\"\037\n\014In" + - "foResponse\022\017\n\007version\030\001 \001(\t\"3\n\021CreatePoo" + - "lRequest\022\036\n\021connection_string\030\001 \001(\tB\003\340A\002" + - "\"H\n\027CreateConnectionRequest\022-\n\004pool\030\001 \001(" + - "\0132\032.google.spannerlib.v1.PoolB\003\340A\002\"\223\001\n\016E" + - "xecuteRequest\0229\n\nconnection\030\001 \001(\0132 .goog" + - "le.spannerlib.v1.ConnectionB\003\340A\002\022F\n\023exec" + - "ute_sql_request\030\002 \001(\0132$.google.spanner.v" + - "1.ExecuteSqlRequestB\003\340A\002\"\243\001\n\023ExecuteBatc" + - "hRequest\0229\n\nconnection\030\001 \001(\0132 .google.sp" + - "annerlib.v1.ConnectionB\003\340A\002\022Q\n\031execute_b" + - "atch_dml_request\030\002 \001(\0132).google.spanner." + - "v1.ExecuteBatchDmlRequestB\003\340A\002\"\235\001\n\027Begin" + - "TransactionRequest\0229\n\nconnection\030\001 \001(\0132 " + - ".google.spannerlib.v1.ConnectionB\003\340A\002\022G\n" + - "\023transaction_options\030\002 \001(\0132%.google.span" + - "ner.v1.TransactionOptionsB\003\340A\002\"\236\001\n\025Write" + - "MutationsRequest\0229\n\nconnection\030\001 \001(\0132 .g" + - "oogle.spannerlib.v1.ConnectionB\003\340A\002\022J\n\tm" + - "utations\030\002 \001(\01322.google.spanner.v1.Batch" + - "WriteRequest.MutationGroupB\003\340A\002\"\027\n\004Pool\022" + - "\017\n\002id\030\001 \001(\003B\003\340A\002\"L\n\nConnection\022-\n\004pool\030\001" + - " \001(\0132\032.google.spannerlib.v1.PoolB\003\340A\002\022\017\n" + - "\002id\030\002 \001(\003B\003\340A\002\"R\n\004Rows\0229\n\nconnection\030\001 \001" + - "(\0132 .google.spannerlib.v1.ConnectionB\003\340A" + - "\002\022\017\n\002id\030\002 \001(\003B\003\340A\002\"j\n\013NextRequest\022-\n\004row" + - "s\030\001 \001(\0132\032.google.spannerlib.v1.RowsB\003\340A\002" + - "\022\025\n\010num_rows\030\002 \001(\003B\003\340A\002\022\025\n\010encoding\030\003 \001(" + - "\003B\003\340A\002\"\353\001\n\007RowData\022-\n\004rows\030\001 \001(\0132\032.googl" + - "e.spannerlib.v1.RowsB\003\340A\002\0226\n\010metadata\030\002 " + - "\001(\0132$.google.spanner.v1.ResultSetMetadat" + - "a\022-\n\004data\030\003 \003(\0132\032.google.protobuf.ListVa" + - "lueB\003\340A\002\0220\n\005stats\030\004 \001(\0132!.google.spanner" + - ".v1.ResultSetStats\022\030\n\020has_more_results\030\005" + - " \001(\010\"@\n\017MetadataRequest\022-\n\004rows\030\001 \001(\0132\032." + - "google.spannerlib.v1.RowsB\003\340A\002\"F\n\025Result" + - "SetStatsRequest\022-\n\004rows\030\001 \001(\0132\032.google.s" + - "pannerlib.v1.RowsB\003\340A\002\"e\n\027ConnectionStre" + - "amRequest\022?\n\017execute_request\030\001 \001(\0132$.goo" + - "gle.spannerlib.v1.ExecuteRequestH\000B\t\n\007re" + - "quest\"Z\n\030ConnectionStreamResponse\0222\n\003row" + - "\030\001 \001(\0132#.google.spanner.v1.PartialResult" + - "SetH\000B\n\n\010response2\227\014\n\nSpannerLib\022O\n\004Info" + - "\022!.google.spannerlib.v1.InfoRequest\032\".go" + - "ogle.spannerlib.v1.InfoResponse\"\000\022S\n\nCre" + - "atePool\022\'.google.spannerlib.v1.CreatePoo" + - "lRequest\032\032.google.spannerlib.v1.Pool\"\000\022A" + - "\n\tClosePool\022\032.google.spannerlib.v1.Pool\032" + - "\026.google.protobuf.Empty\"\000\022e\n\020CreateConne" + - "ction\022-.google.spannerlib.v1.CreateConne" + - "ctionRequest\032 .google.spannerlib.v1.Conn" + - "ection\"\000\022M\n\017CloseConnection\022 .google.spa" + - "nnerlib.v1.Connection\032\026.google.protobuf." + - "Empty\"\000\022M\n\007Execute\022$.google.spannerlib.v" + - "1.ExecuteRequest\032\032.google.spannerlib.v1." + - "Rows\"\000\022[\n\020ExecuteStreaming\022$.google.span" + - "nerlib.v1.ExecuteRequest\032\035.google.spanne" + - "rlib.v1.RowData\"\0000\001\022g\n\014ExecuteBatch\022).go" + - "ogle.spannerlib.v1.ExecuteBatchRequest\032*" + - ".google.spanner.v1.ExecuteBatchDmlRespon" + - "se\"\000\022N\n\010Metadata\022\032.google.spannerlib.v1." + - "Rows\032$.google.spanner.v1.ResultSetMetada" + - "ta\"\000\022G\n\004Next\022!.google.spannerlib.v1.Next" + - "Request\032\032.google.protobuf.ListValue\"\000\022Q\n" + - "\016ResultSetStats\022\032.google.spannerlib.v1.R" + - "ows\032!.google.spanner.v1.ResultSetStats\"\000" + - "\022S\n\rNextResultSet\022\032.google.spannerlib.v1" + - ".Rows\032$.google.spanner.v1.ResultSetMetad" + - "ata\"\000\022A\n\tCloseRows\022\032.google.spannerlib.v" + - "1.Rows\032\026.google.protobuf.Empty\"\000\022[\n\020Begi" + - "nTransaction\022-.google.spannerlib.v1.Begi" + - "nTransactionRequest\032\026.google.protobuf.Em" + - "pty\"\000\022O\n\006Commit\022 .google.spannerlib.v1.C" + - "onnection\032!.google.spanner.v1.CommitResp" + - "onse\"\000\022F\n\010Rollback\022 .google.spannerlib.v" + - "1.Connection\032\026.google.protobuf.Empty\"\000\022b" + - "\n\016WriteMutations\022+.google.spannerlib.v1." + - "WriteMutationsRequest\032!.google.spanner.v" + - "1.CommitResponse\"\000\022w\n\020ConnectionStream\022-" + - ".google.spannerlib.v1.ConnectionStreamRe" + - "quest\032..google.spannerlib.v1.ConnectionS" + - "treamResponse\"\000(\0010\001B\315\001\n\036com.google.cloud" + - ".spannerlib.v1B\017SpannerLibProtoP\001Z>cloud" + - ".google.com/go/spannerlib/apiv1/spannerl" + - "ibpb;spannerlibpb\252\002\032Google.Cloud.Spanner" + - "Lib.V1\312\002\032Google\\Cloud\\SpannerLib\\V1\352\002\035Go" + - "ogle::Cloud::SpannerLib::V1b\006proto3" + "oto\032\034google/protobuf/struct.proto\032\027googl" + + "e/rpc/status.proto\032\"google/spanner/v1/re" + + "sult_set.proto\032\037google/spanner/v1/spanne" + + "r.proto\032#google/spanner/v1/transaction.p" + + "roto\"\r\n\013InfoRequest\"\037\n\014InfoResponse\022\017\n\007v" + + "ersion\030\001 \001(\t\"3\n\021CreatePoolRequest\022\036\n\021con" + + "nection_string\030\001 \001(\tB\003\340A\002\"H\n\027CreateConne" + + "ctionRequest\022-\n\004pool\030\001 \001(\0132\032.google.span" + + "nerlib.v1.PoolB\003\340A\002\"<\n\014FetchOptions\022\025\n\010n" + + "um_rows\030\001 \001(\003B\003\340A\002\022\025\n\010encoding\030\002 \001(\003B\003\340A" + + "\002\"\316\001\n\016ExecuteRequest\0229\n\nconnection\030\001 \001(\013" + + "2 .google.spannerlib.v1.ConnectionB\003\340A\002\022" + + "F\n\023execute_sql_request\030\002 \001(\0132$.google.sp" + + "anner.v1.ExecuteSqlRequestB\003\340A\002\0229\n\rfetch" + + "_options\030\003 \001(\0132\".google.spannerlib.v1.Fe" + + "tchOptions\"\243\001\n\023ExecuteBatchRequest\0229\n\nco" + + "nnection\030\001 \001(\0132 .google.spannerlib.v1.Co" + + "nnectionB\003\340A\002\022Q\n\031execute_batch_dml_reque" + + "st\030\002 \001(\0132).google.spanner.v1.ExecuteBatc" + + "hDmlRequestB\003\340A\002\"\235\001\n\027BeginTransactionReq" + + "uest\0229\n\nconnection\030\001 \001(\0132 .google.spanne" + + "rlib.v1.ConnectionB\003\340A\002\022G\n\023transaction_o" + + "ptions\030\002 \001(\0132%.google.spanner.v1.Transac" + + "tionOptionsB\003\340A\002\"\236\001\n\025WriteMutationsReque" + + "st\0229\n\nconnection\030\001 \001(\0132 .google.spannerl" + + "ib.v1.ConnectionB\003\340A\002\022J\n\tmutations\030\002 \001(\013" + + "22.google.spanner.v1.BatchWriteRequest.M" + + "utationGroupB\003\340A\002\"\027\n\004Pool\022\017\n\002id\030\001 \001(\003B\003\340" + + "A\002\"L\n\nConnection\022-\n\004pool\030\001 \001(\0132\032.google." + + "spannerlib.v1.PoolB\003\340A\002\022\017\n\002id\030\002 \001(\003B\003\340A\002" + + "\"R\n\004Rows\0229\n\nconnection\030\001 \001(\0132 .google.sp" + + "annerlib.v1.ConnectionB\003\340A\002\022\017\n\002id\030\002 \001(\003B" + + "\003\340A\002\"|\n\013NextRequest\022-\n\004rows\030\001 \001(\0132\032.goog" + + "le.spannerlib.v1.RowsB\003\340A\002\022>\n\rfetch_opti" + + "ons\030\002 \001(\0132\".google.spannerlib.v1.FetchOp" + + "tionsB\003\340A\002\"\353\001\n\007RowData\022-\n\004rows\030\001 \001(\0132\032.g" + + "oogle.spannerlib.v1.RowsB\003\340A\002\0226\n\010metadat" + + "a\030\002 \001(\0132$.google.spanner.v1.ResultSetMet" + + "adata\022-\n\004data\030\003 \003(\0132\032.google.protobuf.Li" + + "stValueB\003\340A\002\0220\n\005stats\030\004 \001(\0132!.google.spa" + + "nner.v1.ResultSetStats\022\030\n\020has_more_resul" + + "ts\030\005 \001(\010\"@\n\017MetadataRequest\022-\n\004rows\030\001 \001(" + + "\0132\032.google.spannerlib.v1.RowsB\003\340A\002\"F\n\025Re" + + "sultSetStatsRequest\022-\n\004rows\030\001 \001(\0132\032.goog" + + "le.spannerlib.v1.RowsB\003\340A\002\"\317\003\n\027Connectio" + + "nStreamRequest\022?\n\017execute_request\030\001 \001(\0132" + + "$.google.spannerlib.v1.ExecuteRequestH\000\022" + + "J\n\025execute_batch_request\030\002 \001(\0132).google." + + "spannerlib.v1.ExecuteBatchRequestH\000\022R\n\031b" + + "egin_transaction_request\030\003 \001(\0132-.google." + + "spannerlib.v1.BeginTransactionRequestH\000\022" + + ":\n\016commit_request\030\004 \001(\0132 .google.spanner" + + "lib.v1.ConnectionH\000\022<\n\020rollback_request\030" + + "\005 \001(\0132 .google.spannerlib.v1.ConnectionH" + + "\000\022N\n\027write_mutations_request\030\006 \001(\0132+.goo" + + "gle.spannerlib.v1.WriteMutationsRequestH" + + "\000B\t\n\007request\"\261\001\n\017ExecuteResponse\022-\n\004rows" + + "\030\001 \001(\0132\032.google.spannerlib.v1.RowsB\003\340A\002\022" + + "1\n\013result_sets\030\002 \003(\0132\034.google.spanner.v1" + + ".ResultSet\022\"\n\006status\030\003 \001(\0132\022.google.rpc." + + "Status\022\030\n\020has_more_results\030\004 \001(\010\"\323\003\n\030Con" + + "nectionStreamResponse\022\"\n\006status\030\001 \001(\0132\022." + + "google.rpc.Status\022A\n\020execute_response\030\002 " + + "\001(\0132%.google.spannerlib.v1.ExecuteRespon" + + "seH\000\022L\n\026execute_batch_response\030\003 \001(\0132*.g" + + "oogle.spanner.v1.ExecuteBatchDmlResponse" + + "H\000\022<\n\032begin_transaction_response\030\004 \001(\0132\026" + + ".google.protobuf.EmptyH\000\022<\n\017commit_respo" + + "nse\030\005 \001(\0132!.google.spanner.v1.CommitResp" + + "onseH\000\0223\n\021rollback_response\030\006 \001(\0132\026.goog" + + "le.protobuf.EmptyH\000\022E\n\030write_mutations_r" + + "esponse\030\007 \001(\0132!.google.spanner.v1.Commit" + + "ResponseH\000B\n\n\010response2\353\014\n\nSpannerLib\022O\n" + + "\004Info\022!.google.spannerlib.v1.InfoRequest" + + "\032\".google.spannerlib.v1.InfoResponse\"\000\022S" + + "\n\nCreatePool\022\'.google.spannerlib.v1.Crea" + + "tePoolRequest\032\032.google.spannerlib.v1.Poo" + + "l\"\000\022A\n\tClosePool\022\032.google.spannerlib.v1." + + "Pool\032\026.google.protobuf.Empty\"\000\022e\n\020Create" + + "Connection\022-.google.spannerlib.v1.Create" + + "ConnectionRequest\032 .google.spannerlib.v1" + + ".Connection\"\000\022M\n\017CloseConnection\022 .googl" + + "e.spannerlib.v1.Connection\032\026.google.prot" + + "obuf.Empty\"\000\022M\n\007Execute\022$.google.spanner" + + "lib.v1.ExecuteRequest\032\032.google.spannerli" + + "b.v1.Rows\"\000\022[\n\020ExecuteStreaming\022$.google" + + ".spannerlib.v1.ExecuteRequest\032\035.google.s" + + "pannerlib.v1.RowData\"\0000\001\022g\n\014ExecuteBatch" + + "\022).google.spannerlib.v1.ExecuteBatchRequ" + + "est\032*.google.spanner.v1.ExecuteBatchDmlR" + + "esponse\"\000\022N\n\010Metadata\022\032.google.spannerli" + + "b.v1.Rows\032$.google.spanner.v1.ResultSetM" + + "etadata\"\000\022G\n\004Next\022!.google.spannerlib.v1" + + ".NextRequest\032\032.google.protobuf.ListValue" + + "\"\000\022Q\n\016ResultSetStats\022\032.google.spannerlib" + + ".v1.Rows\032!.google.spanner.v1.ResultSetSt" + + "ats\"\000\022S\n\rNextResultSet\022\032.google.spannerl" + + "ib.v1.Rows\032$.google.spanner.v1.ResultSet" + + "Metadata\"\000\022A\n\tCloseRows\022\032.google.spanner" + + "lib.v1.Rows\032\026.google.protobuf.Empty\"\000\022[\n" + + "\020BeginTransaction\022-.google.spannerlib.v1" + + ".BeginTransactionRequest\032\026.google.protob" + + "uf.Empty\"\000\022O\n\006Commit\022 .google.spannerlib" + + ".v1.Connection\032!.google.spanner.v1.Commi" + + "tResponse\"\000\022F\n\010Rollback\022 .google.spanner" + + "lib.v1.Connection\032\026.google.protobuf.Empt" + + "y\"\000\022b\n\016WriteMutations\022+.google.spannerli" + + "b.v1.WriteMutationsRequest\032!.google.span" + + "ner.v1.CommitResponse\"\000\022w\n\020ConnectionStr" + + "eam\022-.google.spannerlib.v1.ConnectionStr" + + "eamRequest\032..google.spannerlib.v1.Connec" + + "tionStreamResponse\"\000(\0010\001\022R\n\021ContinueStre" + + "aming\022\032.google.spannerlib.v1.Rows\032\035.goog" + + "le.spannerlib.v1.RowData\"\0000\001B\315\001\n\036com.goo" + + "gle.cloud.spannerlib.v1B\017SpannerLibProto" + + "P\001Z>cloud.google.com/go/spannerlib/apiv1" + + "/spannerlibpb;spannerlibpb\252\002\032Google.Clou" + + "d.SpannerLib.V1\312\002\032Google\\Cloud\\SpannerLi" + + "b\\V1\352\002\035Google::Cloud::SpannerLib::V1b\006pr" + + "oto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, @@ -220,6 +260,7 @@ public static void registerAllExtensions( com.google.api.FieldBehaviorProto.getDescriptor(), com.google.protobuf.EmptyProto.getDescriptor(), com.google.protobuf.StructProto.getDescriptor(), + com.google.rpc.StatusProto.getDescriptor(), com.google.spanner.v1.ResultSetProto.getDescriptor(), com.google.spanner.v1.SpannerProto.getDescriptor(), com.google.spanner.v1.TransactionProto.getDescriptor(), @@ -248,88 +289,101 @@ public static void registerAllExtensions( com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_spannerlib_v1_CreateConnectionRequest_descriptor, new java.lang.String[] { "Pool", }); - internal_static_google_spannerlib_v1_ExecuteRequest_descriptor = + internal_static_google_spannerlib_v1_FetchOptions_descriptor = getDescriptor().getMessageTypes().get(4); + internal_static_google_spannerlib_v1_FetchOptions_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_google_spannerlib_v1_FetchOptions_descriptor, + new java.lang.String[] { "NumRows", "Encoding", }); + internal_static_google_spannerlib_v1_ExecuteRequest_descriptor = + getDescriptor().getMessageTypes().get(5); internal_static_google_spannerlib_v1_ExecuteRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_spannerlib_v1_ExecuteRequest_descriptor, - new java.lang.String[] { "Connection", "ExecuteSqlRequest", }); + new java.lang.String[] { "Connection", "ExecuteSqlRequest", "FetchOptions", }); internal_static_google_spannerlib_v1_ExecuteBatchRequest_descriptor = - getDescriptor().getMessageTypes().get(5); + getDescriptor().getMessageTypes().get(6); internal_static_google_spannerlib_v1_ExecuteBatchRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_spannerlib_v1_ExecuteBatchRequest_descriptor, new java.lang.String[] { "Connection", "ExecuteBatchDmlRequest", }); internal_static_google_spannerlib_v1_BeginTransactionRequest_descriptor = - getDescriptor().getMessageTypes().get(6); + getDescriptor().getMessageTypes().get(7); internal_static_google_spannerlib_v1_BeginTransactionRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_spannerlib_v1_BeginTransactionRequest_descriptor, new java.lang.String[] { "Connection", "TransactionOptions", }); internal_static_google_spannerlib_v1_WriteMutationsRequest_descriptor = - getDescriptor().getMessageTypes().get(7); + getDescriptor().getMessageTypes().get(8); internal_static_google_spannerlib_v1_WriteMutationsRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_spannerlib_v1_WriteMutationsRequest_descriptor, new java.lang.String[] { "Connection", "Mutations", }); internal_static_google_spannerlib_v1_Pool_descriptor = - getDescriptor().getMessageTypes().get(8); + getDescriptor().getMessageTypes().get(9); internal_static_google_spannerlib_v1_Pool_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_spannerlib_v1_Pool_descriptor, new java.lang.String[] { "Id", }); internal_static_google_spannerlib_v1_Connection_descriptor = - getDescriptor().getMessageTypes().get(9); + getDescriptor().getMessageTypes().get(10); internal_static_google_spannerlib_v1_Connection_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_spannerlib_v1_Connection_descriptor, new java.lang.String[] { "Pool", "Id", }); internal_static_google_spannerlib_v1_Rows_descriptor = - getDescriptor().getMessageTypes().get(10); + getDescriptor().getMessageTypes().get(11); internal_static_google_spannerlib_v1_Rows_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_spannerlib_v1_Rows_descriptor, new java.lang.String[] { "Connection", "Id", }); internal_static_google_spannerlib_v1_NextRequest_descriptor = - getDescriptor().getMessageTypes().get(11); + getDescriptor().getMessageTypes().get(12); internal_static_google_spannerlib_v1_NextRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_spannerlib_v1_NextRequest_descriptor, - new java.lang.String[] { "Rows", "NumRows", "Encoding", }); + new java.lang.String[] { "Rows", "FetchOptions", }); internal_static_google_spannerlib_v1_RowData_descriptor = - getDescriptor().getMessageTypes().get(12); + getDescriptor().getMessageTypes().get(13); internal_static_google_spannerlib_v1_RowData_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_spannerlib_v1_RowData_descriptor, new java.lang.String[] { "Rows", "Metadata", "Data", "Stats", "HasMoreResults", }); internal_static_google_spannerlib_v1_MetadataRequest_descriptor = - getDescriptor().getMessageTypes().get(13); + getDescriptor().getMessageTypes().get(14); internal_static_google_spannerlib_v1_MetadataRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_spannerlib_v1_MetadataRequest_descriptor, new java.lang.String[] { "Rows", }); internal_static_google_spannerlib_v1_ResultSetStatsRequest_descriptor = - getDescriptor().getMessageTypes().get(14); + getDescriptor().getMessageTypes().get(15); internal_static_google_spannerlib_v1_ResultSetStatsRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_spannerlib_v1_ResultSetStatsRequest_descriptor, new java.lang.String[] { "Rows", }); internal_static_google_spannerlib_v1_ConnectionStreamRequest_descriptor = - getDescriptor().getMessageTypes().get(15); + getDescriptor().getMessageTypes().get(16); internal_static_google_spannerlib_v1_ConnectionStreamRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_spannerlib_v1_ConnectionStreamRequest_descriptor, - new java.lang.String[] { "ExecuteRequest", "Request", }); + new java.lang.String[] { "ExecuteRequest", "ExecuteBatchRequest", "BeginTransactionRequest", "CommitRequest", "RollbackRequest", "WriteMutationsRequest", "Request", }); + internal_static_google_spannerlib_v1_ExecuteResponse_descriptor = + getDescriptor().getMessageTypes().get(17); + internal_static_google_spannerlib_v1_ExecuteResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_google_spannerlib_v1_ExecuteResponse_descriptor, + new java.lang.String[] { "Rows", "ResultSets", "Status", "HasMoreResults", }); internal_static_google_spannerlib_v1_ConnectionStreamResponse_descriptor = - getDescriptor().getMessageTypes().get(16); + getDescriptor().getMessageTypes().get(18); internal_static_google_spannerlib_v1_ConnectionStreamResponse_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_spannerlib_v1_ConnectionStreamResponse_descriptor, - new java.lang.String[] { "Row", "Response", }); + new java.lang.String[] { "Status", "ExecuteResponse", "ExecuteBatchResponse", "BeginTransactionResponse", "CommitResponse", "RollbackResponse", "WriteMutationsResponse", "Response", }); descriptor.resolveAllFeaturesImmutable(); com.google.api.FieldBehaviorProto.getDescriptor(); com.google.protobuf.EmptyProto.getDescriptor(); com.google.protobuf.StructProto.getDescriptor(); + com.google.rpc.StatusProto.getDescriptor(); com.google.spanner.v1.ResultSetProto.getDescriptor(); com.google.spanner.v1.SpannerProto.getDescriptor(); com.google.spanner.v1.TransactionProto.getDescriptor();