From 160cf85356dc8759c95c87128ed2eae19aa1e5d6 Mon Sep 17 00:00:00 2001 From: t-horikawa Date: Mon, 10 Feb 2025 14:18:07 +0900 Subject: [PATCH] update sql proto. files to be the same as jogasaki --- .../protos/jogasaki/proto/sql/common.proto | 24 +++++++++++-------- .../protos/jogasaki/proto/sql/response.proto | 9 +++++-- .../tsubakuro/sql/impl/TransactionImpl.java | 24 ++++++++++--------- 3 files changed, 34 insertions(+), 23 deletions(-) diff --git a/modules/proto/src/main/protos/jogasaki/proto/sql/common.proto b/modules/proto/src/main/protos/jogasaki/proto/sql/common.proto index 3d811f70..8e25256a 100644 --- a/modules/proto/src/main/protos/jogasaki/proto/sql/common.proto +++ b/modules/proto/src/main/protos/jogasaki/proto/sql/common.proto @@ -211,28 +211,32 @@ message DateTimeInterval { // the character large object value. message Clob { - // the channel name to transfer this large object data. - string channel_name = 1; - // the data of this large object. oneof data { + // the object value is stored in the file (don't across the network, only for used in the local system). + string local_path = 1; + + // the channel name to transmit this object value. + string channel_name = 2; - // absolute path of the large object data on the local file system (only for privileged mode) - string local_path = 2; + // the immediate object value (for small objects). + bytes contents = 3; } } // the binary large object value. message Blob { - // the channel name to transfer this large object data. - string channel_name = 1; - // the data of this large object. oneof data { + // the object value is stored in the file (don't across the network, only for used in the local system). + string local_path = 1; + + // the channel name to transmit this object value. + string channel_name = 2; - // absolute path of the large object data on the local file system (only for privileged mode) - string local_path = 2; + // the immediate object value (for small objects). + bytes contents = 3; } } diff --git a/modules/proto/src/main/protos/jogasaki/proto/sql/response.proto b/modules/proto/src/main/protos/jogasaki/proto/sql/response.proto index 24a5502b..6a2a22ca 100644 --- a/modules/proto/src/main/protos/jogasaki/proto/sql/response.proto +++ b/modules/proto/src/main/protos/jogasaki/proto/sql/response.proto @@ -275,9 +275,14 @@ message GetLargeObjectData { // request is successfully completed. message Success { - // the data channel name of retrieved large object data. - string channel_name = 1; + // the data of this large object. + oneof data { + // the data channel name of retrieved large object data. + string channel_name = 1; + // the immediate object value (for small objects). + bytes contents = 2; + } } reserved 1 to 10; diff --git a/modules/session/src/main/java/com/tsurugidb/tsubakuro/sql/impl/TransactionImpl.java b/modules/session/src/main/java/com/tsurugidb/tsubakuro/sql/impl/TransactionImpl.java index 90d3903b..1f72452b 100644 --- a/modules/session/src/main/java/com/tsurugidb/tsubakuro/sql/impl/TransactionImpl.java +++ b/modules/session/src/main/java/com/tsurugidb/tsubakuro/sql/impl/TransactionImpl.java @@ -169,16 +169,16 @@ private SqlRequest.Parameter addLob(SqlRequest.Parameter e, LinkedList throw new IllegalArgumentException(); } return SqlRequest.Parameter.newBuilder() - .setClob(SqlCommon.Clob.newBuilder() - .setChannelName(channelName) - .build()) + .setClob(SqlCommon.Clob.newBuilder() + .setChannelName(channelName) + .build()) .build(); + case CONTENTS: + return e; default: - throw new UnsupportedOperationException(); + throw new IllegalArgumentException(); } - - } - if (e.getValueCase() == SqlRequest.Parameter.ValueCase.BLOB) { + } else if (e.getValueCase() == SqlRequest.Parameter.ValueCase.BLOB) { var v = e.getBlob(); switch (v.getDataCase()) { case LOCAL_PATH: @@ -190,12 +190,14 @@ private SqlRequest.Parameter addLob(SqlRequest.Parameter e, LinkedList throw new IllegalArgumentException(); } return SqlRequest.Parameter.newBuilder() - .setBlob(SqlCommon.Blob.newBuilder() - .setChannelName(channelName) - .build()) + .setBlob(SqlCommon.Blob.newBuilder() + .setChannelName(channelName) + .build()) .build(); + case CONTENTS: + return e; default: - throw new UnsupportedOperationException(); + throw new IllegalArgumentException(); } } return e;