Derby
  1. Derby
  2. DERBY-948

Miscellaneous ResultSet methods added by JDBC 4

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 10.2.1.6
    • Component/s: JDBC
    • Labels:
      None

      Description

      As described in the JDBC 4 spec sections 16 and 3.1.

      This provides support for new ResultSet methods added by JDBC4 and not addressed by other JIRAs: getHoldability() and isClosed().

      1. DERBY-948-v1.diff
        11 kB
        Knut Anders Hatlen
      2. DERBY-948-v1.stat
        0.3 kB
        Knut Anders Hatlen
      3. DERBY-948-v2.diff
        12 kB
        Knut Anders Hatlen
      4. DERBY-948-v2.stat
        0.3 kB
        Knut Anders Hatlen
      5. DERBY-948-v3.diff
        12 kB
        Knut Anders Hatlen
      6. DERBY-948-v3.stat
        0.3 kB
        Knut Anders Hatlen

        Activity

        Hide
        Knut Anders Hatlen added a comment -

        Thanks for reviewing, Rick! Committed revision 382710.

        Show
        Knut Anders Hatlen added a comment - Thanks for reviewing, Rick! Committed revision 382710.
        Hide
        Rick Hillegas added a comment -

        Hi Knut Anders,

        Solid code, good comments, useful tests. Derbyall runs cleanly for me modulo the wisconsin cruft. The jdbc4 tests run cleanly modulo the timestamp formatting cruft. I say commit away.

        Show
        Rick Hillegas added a comment - Hi Knut Anders, Solid code, good comments, useful tests. Derbyall runs cleanly for me modulo the wisconsin cruft. The jdbc4 tests run cleanly modulo the timestamp formatting cruft. I say commit away.
        Hide
        Knut Anders Hatlen added a comment -

        Current patch is DERBY-948-v3.diff. Please review. Thanks.

        Show
        Knut Anders Hatlen added a comment - Current patch is DERBY-948 -v3.diff. Please review. Thanks.
        Hide
        Knut Anders Hatlen added a comment -

        I investigated the possibility for null pointer exceptions
        further. The only result sets that return null in getStatement() are
        those created by getNewRowSet() and getOldRowSet() in
        InternalTriggerExecutionContext. Those result sets are not exposed to
        JDBC applications, so applications can't call getHoldability() on them
        anyway. However, I updated the patch with a comment about the null
        case, and made getHoldability() return CLOSE_CURSORS_AT_COMMIT instead
        of throwing NullPointerException.

        Show
        Knut Anders Hatlen added a comment - I investigated the possibility for null pointer exceptions further. The only result sets that return null in getStatement() are those created by getNewRowSet() and getOldRowSet() in InternalTriggerExecutionContext. Those result sets are not exposed to JDBC applications, so applications can't call getHoldability() on them anyway. However, I updated the patch with a comment about the null case, and made getHoldability() return CLOSE_CURSORS_AT_COMMIT instead of throwing NullPointerException.
        Hide
        Knut Anders Hatlen added a comment -

        Just realized there might be one issue with my implementation of
        ResultSet.getHoldability() in the embedded driver. To find the
        holdability, one has to call
        ResultSet.getStatement().getResultSetHoldability(). However,
        getStatement() might return null leading to a NullPointerException.

        It seems like the only way to get a ResultSet which returns null for
        getStatement() is through EmbedConnectionContext.getResultSet(). What
        is the holdability of the result sets returned by this method? And can
        those result sets be exposed to an application, or are they just used
        internally?

        Show
        Knut Anders Hatlen added a comment - Just realized there might be one issue with my implementation of ResultSet.getHoldability() in the embedded driver. To find the holdability, one has to call ResultSet.getStatement().getResultSetHoldability(). However, getStatement() might return null leading to a NullPointerException. It seems like the only way to get a ResultSet which returns null for getStatement() is through EmbedConnectionContext.getResultSet(). What is the holdability of the result sets returned by this method? And can those result sets be exposed to an application, or are they just used internally?
        Hide
        Knut Anders Hatlen added a comment -

        Attached a new patch (DERBY-948-v2.diff). Modified one test case so that exceptions aren't swallowed.

        Show
        Knut Anders Hatlen added a comment - Attached a new patch ( DERBY-948 -v2.diff). Modified one test case so that exceptions aren't swallowed.
        Hide
        Knut Anders Hatlen added a comment -

        Uploaded a patch (DERBY-948-v1.diff) which implements
        ResultSet.isClosed() and ResultSet.getHoldability() on embedded and
        client. Also added some test cases to jdbc4/TestResultSetMethods.java.

        In the client driver, I moved the methods from
        (...).net.NetResultSet40 to (...).am.ResultSet since they didn't
        contain any protocol specific or JDK 1.6 specific code.

        I have run the jdbc4 suite on Solaris 10 x86 / Sun JVM 1.6.0_b72 and
        derbyall on Solaris 10 x86 / Sun JVM 1.5.0 without errors.

        Please review. Thanks.

        Show
        Knut Anders Hatlen added a comment - Uploaded a patch ( DERBY-948 -v1.diff) which implements ResultSet.isClosed() and ResultSet.getHoldability() on embedded and client. Also added some test cases to jdbc4/TestResultSetMethods.java. In the client driver, I moved the methods from (...).net.NetResultSet40 to (...).am.ResultSet since they didn't contain any protocol specific or JDK 1.6 specific code. I have run the jdbc4 suite on Solaris 10 x86 / Sun JVM 1.6.0_b72 and derbyall on Solaris 10 x86 / Sun JVM 1.5.0 without errors. Please review. Thanks.

          People

          • Assignee:
            Knut Anders Hatlen
            Reporter:
            Rick Hillegas
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development