Uploaded image for project: 'Apache Jena'
  1. Apache Jena
  2. JENA-1939

getUpdateCount() in the JDBC driver returns incorrect value - it looks like there are always more results (infinite loop)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • Jena 3.17.0
    • JDBC
    • None
    • Patch

    Description

      The method JenaStatement.getUpdateCount() returns 0. But java.sql.Statement documentation 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) iterate over these multiple results and need to know when finish. The 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 change in my branch 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).

      Attachments

        1. jena-jdbc-updateCount-patch-01.diff
          2 kB
          František Kučera

        Activity

          People

            rvesse Rob Vesse
            issues.apache.org.db7c0rhii@frantovo.cz František Kučera
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 0.5h
                0.5h