[ 
https://issues.apache.org/jira/browse/CALCITE-6781?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18077200#comment-18077200
 ] 

Caican Cai commented on CALCITE-6781:
-------------------------------------

fix in 
https://github.com/apache/calcite-avatica/commit/9efbff828397c7cfb9a5885aa06d94da8d2262dc

> The isUpdateCapable method of calcite.avatica will incorrectly traverse the 
> returned result value
> -------------------------------------------------------------------------------------------------
>
>                 Key: CALCITE-6781
>                 URL: https://issues.apache.org/jira/browse/CALCITE-6781
>             Project: Calcite
>          Issue Type: Bug
>          Components: avatica
>    Affects Versions: avatica-1.25.0
>            Reporter: Caican Cai
>            Priority: Major
>              Labels: pull-request-available
>
> When the delete statement is executed, statement.openResultSet.next will 
> return false, and we do not need to perform subsequent operations.
> {code:java}
>   private void isUpdateCapable(final AvaticaStatement statement)
>       throws SQLException {
>     Meta.Signature signature = statement.getSignature();
>     if (signature == null || signature.statementType == null) {
>       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.");
>       }
>       statement.openResultSet = null;
>     }
>   }
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to