Skip to content

Commit

Permalink
Merge pull request #23 from Codeforces/dev-mikemirzayanov
Browse files Browse the repository at this point in the history
Blob and Clob support
  • Loading branch information
MikeMirzayanov authored Oct 9, 2024
2 parents b56c2a0 + bafe4a6 commit 3588044
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 3588044

Please sign in to comment.