You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by "František Kučera (Jira)" <ji...@apache.org> on 2020/07/31 15:57:00 UTC

[jira] [Comment Edited] (JENA-1939) getUpdateCount() in the JDBC driver returns incorrect value - it looks like there are always more results (infinite loop)

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

František Kučera edited comment on JENA-1939 at 7/31/20, 3:56 PM:
------------------------------------------------------------------

{quote}then please send a github PR{quote}

I am not registered on GitHub because I do not want to support the centralization of the internet and the developer infrastructure.

Could you merge from the [branch|https://git-zaloha.frantovo.cz/gitbox.apache.org/repos/asf/jena.git/commit/?h=JENA-1939_updateCount&id=bdb5439d22b80b2909258449d82fb7b5003fd64c] mentioned above? If not, you can just apply the patch file – this is a trivial change – however it would be nice to mention my name.

{quote}Because an RDF graph is a set of triples, and adding a triple when it is already in the graph is a no-op, counting is not straightforward.{quote}

I understand. Then 0 seems OK to me. (it could be also something like -2 to signalize unknown count and distinguish it from no changes, but I am not sure whether all clients will distinguish it from -1; so 0 is probably more safe)


was (Author: issues.apache.org.db7c0rhii@frantovo.cz):
{quote}then please send a github PR{quote}

I am not registered on GitHub because I do not want to support the centralization of the internet and the developer infrastructure.

Could you merge from the [branch|https://git-zaloha.frantovo.cz/gitbox.apache.org/repos/asf/jena.git/commit/?h=JENA-1939_updateCount&id=bdb5439d22b80b2909258449d82fb7b5003fd64c] mentioned above? If not, you can just apply the patch file – this is a trivial change – however it would be nice to mention my name.

{quote}Because an RDF graph is a set of triples, and adding a triple when it is already in the graph is a no-op, counting is not straightforward.{quote}

I understand. Then 0 seem OK to me. (it could be also something like -2 to signalize unknown count and distinguish it from no changes, but I am not sure whether all clients will distinguish it from -1; so 0 is probably more safe)

> getUpdateCount() in the JDBC driver returns incorrect value - it looks like 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
>            Priority: Major
>         Attachments: jena-jdbc-updateCount-patch-01.diff
>
>
> The method {{JenaStatement.getUpdateCount()}} returns 0. But [java.sql.Statement|https://docs.oracle.com/javase/8/docs/api/java/sql/Statement.html#getUpdateCount--] documentation says:
> bq. 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:
> bq. 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 [change in my branch|https://git-zaloha.frantovo.cz/gitbox.apache.org/repos/asf/jena.git/log/?h=JENA-1939_updateCount] could resolve this issue (also attached as a patch).
> 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)