Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit48bb024

Browse files
author
Thomasr
committed
#1173: Implemented json serialization of oracle BLOB column type
1 parent041aef5 commit48bb024

File tree

1 file changed

+9
-0
lines changed
  • server/api-service/lowcoder-sdk/src/main/java/org/lowcoder/sdk/plugin/common/sql

1 file changed

+9
-0
lines changed

‎server/api-service/lowcoder-sdk/src/main/java/org/lowcoder/sdk/plugin/common/sql/ResultSetParser.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
packageorg.lowcoder.sdk.plugin.common.sql;
22

3+
importorg.apache.commons.codec.binary.Base64;
34
importorg.jetbrains.annotations.Nullable;
45

6+
importjava.sql.Blob;
57
importjava.sql.ResultSet;
68
importjava.sql.ResultSetMetaData;
79
importjava.sql.SQLException;
@@ -25,6 +27,7 @@ public class ResultSetParser {
2527
publicstaticfinalStringDATETIME_COLUMN_TYPE_NAME ="datetime";
2628
publicstaticfinalStringTIMESTAMP_COLUMN_TYPE_NAME ="timestamp";
2729
publicstaticfinalStringYEAR_COLUMN_TYPE_NAME ="year";
30+
publicstaticfinalStringBLOB_COLUMN_TYPE_NAME ="blob";
2831

2932
publicstaticList<Map<String,Object>>parseRows(ResultSetresultSet)throwsSQLException {
3033
ResultSetMetaDatametaData =resultSet.getMetaData();
@@ -74,6 +77,12 @@ private static Object getValue(ResultSet resultSet, int i, String typeName) thro
7477
if (YEAR_COLUMN_TYPE_NAME.equalsIgnoreCase(typeName)) {
7578
returnresultSet.getDate(i).toLocalDate().getYear();
7679
}
80+
if (BLOB_COLUMN_TYPE_NAME.equalsIgnoreCase(typeName)) {
81+
//Convert binary data into base64
82+
Blobblob =resultSet.getBlob(i);
83+
byte[]blobBytes =blob.getBytes(1, (int)blob.length());
84+
returnMap.of("type","BLOB","length",blobBytes.length,"content",Base64.encodeBase64String(blobBytes));
85+
}
7786
returnresultSet.getObject(i);
7887
}
7988

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp