Skip to content

Commit

Permalink
[CALCITE-6781] The isUpdateCapable method of calcite.avatica will inc…
Browse files Browse the repository at this point in the history
…orrectly traverse the returned result value
  • Loading branch information
caicancai committed Jan 12, 2025
1 parent eccf644 commit 51db123
Showing 1 changed file with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -614,18 +614,20 @@ private void isUpdateCapable(final AvaticaStatement statement)
return;
}
if (signature.statementType.canUpdate() && statement.updateCount == -1) {
statement.openResultSet.next();
Object obj = statement.openResultSet.getObject(ROWCOUNT_COLUMN_NAME);
if (obj instanceof Number) {
statement.updateCount = ((Number) obj).intValue();
} else if (obj instanceof List) {
@SuppressWarnings("unchecked")
final List<Number> numbers = (List<Number>) obj;
statement.updateCount = numbers.get(0).intValue();
} else {
throw HELPER.createException("Not a valid return result.");
if (statement.openResultSet.next()) {
statement.openResultSet.next();
Object obj = statement.openResultSet.getObject(ROWCOUNT_COLUMN_NAME);
if (obj instanceof Number) {
statement.updateCount = ((Number) obj).intValue();
} else if (obj instanceof List) {
@SuppressWarnings("unchecked")
final List<Number> numbers = (List<Number>) obj;
statement.updateCount = numbers.get(0).intValue();
} else {
throw HELPER.createException("Not a valid return result.");
}
statement.openResultSet = null;
}
statement.openResultSet = null;
}
}

Expand Down

0 comments on commit 51db123

Please sign in to comment.