Skip to content

Commit

Permalink
Blob and Clob support
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeMirzayanov committed Oct 9, 2024
1 parent 8fcec9e commit 9a9d7f9
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions code/src/main/java/org/jacuzzi/core/PreparedStatementUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -328,15 +328,27 @@ private static <T> T runAndReturn(Invokable<T> invokable) throws SQLException {
static Object prepareResultSetGetObject(Object object) {
if (object == null) {
return null;
}

if (object instanceof BigInteger) {
} else if (object instanceof BigInteger) {
BigInteger bigInteger = (BigInteger) object;
try {
object = bigInteger.longValueExact();
} catch (ArithmeticException ignored) {
// No operations.
}
} else if (object instanceof Blob) {
Blob blob = (Blob) object;
try {
object = blob.getBytes(1, (int) blob.length());
} catch (SQLException e) {
throw new DatabaseException("Can't read blob.", e);
}
} else if (object instanceof Clob) {
Clob clob = (Clob) object;
try {
object = clob.getSubString(1, (int) clob.length());
} catch (SQLException e) {
throw new DatabaseException("Can't read clob.", e);
}
}

return object;
Expand Down

0 comments on commit 9a9d7f9

Please sign in to comment.