11package org .lowcoder .sdk .plugin .common .sql ;
22
3+ import org .apache .commons .codec .binary .Base64 ;
34import org .jetbrains .annotations .Nullable ;
45
6+ import java .sql .Blob ;
57import java .sql .ResultSet ;
68import java .sql .ResultSetMetaData ;
79import java .sql .SQLException ;
@@ -25,6 +27,7 @@ public class ResultSetParser {
2527public static final String DATETIME_COLUMN_TYPE_NAME ="datetime" ;
2628public static final String TIMESTAMP_COLUMN_TYPE_NAME ="timestamp" ;
2729public static final String YEAR_COLUMN_TYPE_NAME ="year" ;
30+ public static final String BLOB_COLUMN_TYPE_NAME ="blob" ;
2831
2932public static List <Map <String ,Object >>parseRows (ResultSet resultSet )throws SQLException {
3033ResultSetMetaData metaData =resultSet .getMetaData ();
@@ -74,6 +77,12 @@ private static Object getValue(ResultSet resultSet, int i, String typeName) thro
7477if (YEAR_COLUMN_TYPE_NAME .equalsIgnoreCase (typeName )) {
7578return resultSet .getDate (i ).toLocalDate ().getYear ();
7679 }
80+ if (BLOB_COLUMN_TYPE_NAME .equalsIgnoreCase (typeName )) {
81+ //Convert binary data into base64
82+ Blob blob =resultSet .getBlob (i );
83+ byte []blobBytes =blob .getBytes (1 , (int )blob .length ());
84+ return Base64 .encodeBase64String (blobBytes );
85+ }
7786return resultSet .getObject (i );
7887 }
7988