František Kučera created JENA-1939:
--------------------------------------

             Summary: getUpdateCount() in the JDBC driver returns incorrect 
value - it looks that there are always more results (infinite loop)
                 Key: JENA-1939
                 URL: https://issues.apache.org/jira/browse/JENA-1939
             Project: Apache Jena
          Issue Type: Bug
          Components: JDBC
            Reporter: František Kučera
         Attachments: jena-jdbc-updateCount-patch-01.diff

Method {{JenaStatement.getUpdateCountn()}} returns 0. But 
[java.sql.Statement|https://docs.oracle.com/javase/8/docs/api/java/sql/Statement.html#getUpdateCount--]
 says:

??Returns: the current result as an update count; -1 if the current result is a 
ResultSet object or there are no more results??

Returning correct value is important because a single statement may have 
multiple result sets and cause mutiple updates (not only multiple updated 
records, but multiple sets of updated records).

Applications (e.g. [SQL-DK|http://sql-dk.globalcode.info/]) iterate over these 
multiple results and need to know when finish. The 
[getMoreResults()|https://docs.oracle.com/javase/8/docs/api/java/sql/Statement.html#getMoreResults--]
 documentation says:

??There are no more results when the following is true: ((stmt.getMoreResults() 
== false) && (stmt.getUpdateCount() == -1))
 ??

But if 0 is returned, the application enters infinite loop.

I think that attached patch could resolve this issue.

P.S. Is there a way to return actual count of updated records? 
({{UpdateProcessor.execute()}} returns void).





--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to