Skip to content

Commit

Permalink
Fixed: #4608 - CLOB Support in EDM Editor
Browse files Browse the repository at this point in the history
  • Loading branch information
delchev committed Feb 2, 2025
1 parent bc2f6b6 commit 011d914
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import java.math.BigDecimal;
import java.math.BigInteger;
import java.sql.Blob;
import java.sql.Clob;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
Expand Down Expand Up @@ -152,6 +153,10 @@ public void write(ResultSet resultSet, OutputStream output) throws Exception {
Blob blob = (Blob) value;
int[] intArray = readBlob(blob);
jsonGenerator.writeArray(intArray, 0, intArray.length - 1);
} else if (value instanceof Clob) {
Clob clob = (Clob) value;
String clobValue = readClob(clob);
jsonGenerator.writeString(clobValue);
} else {
jsonGenerator.writeString(value == null ? null : value.toString());
}
Expand Down Expand Up @@ -184,4 +189,20 @@ private int[] readBlob(Blob blob) throws SQLException {
return intArray;
}

/**
* Read clob.
*
* @param clob the clob
* @return the string
* @throws SQLException the SQL exception
*/
private String readClob(Clob clob) throws SQLException {
long clobLength = clob.length();
if (clobLength <= Integer.MAX_VALUE) {
String clobAsString = clob.getSubString(1, (int) clobLength);
return clobAsString;
}
return "The size of the CLOB is too big";
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ angular.module('edmDetails', ['ideUI', 'ideView'])
{ value: "DOUBLE", label: "DOUBLE" },
{ value: "BOOLEAN", label: "BOOLEAN" },
{ value: "BLOB", label: "BLOB" },
{ value: 'CLOB', label: 'CLOB' },
{ value: "DECIMAL", label: "DECIMAL" },
{ value: "BIT", label: "BIT" }
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ angular.module('edmDetails', ['blimpKit', 'platformView'])
{ value: 'DOUBLE', label: 'DOUBLE' },
{ value: 'BOOLEAN', label: 'BOOLEAN' },
{ value: 'BLOB', label: 'BLOB' },
{ value: 'CLOB', label: 'CLOB' },
{ value: 'DECIMAL', label: 'DECIMAL' },
{ value: 'BIT', label: 'BIT' }
];
Expand Down

0 comments on commit 011d914

Please sign in to comment.