Derby
  1. Derby
  2. DERBY-4754

SQLClob.getObject() should always return a java.sql.Clob

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 10.6.1.0
    • Fix Version/s: 10.7.1.1
    • Component/s: JDBC, SQL
    • Urgency:
      Normal

      Description

      Depending on what SQLClob wraps (a string, a stream, a java.sql.Clob), SQLClob.getObject() sometimes returns a string and other times returns a java.sql.Clob. In at least one spot, the compiler expects that SQLClob.getObject() will always return a java.sql.Clob. See the final cast compiled by SQLToJavaValueNode.generateJavaValue(). I believe that the compiler is correct and SQLClob.getObject() should behave predictably.

      1. derby-4066-02-ac-outputLOBs.diff
        19 kB
        Rick Hillegas
      2. derby-4754-01-ab-harmonyLOBs.diff
        22 kB
        Rick Hillegas
      3. derby-4754-01-aa-harmonyLOBs.diff
        20 kB
        Rick Hillegas

        Issue Links

          Activity

          Hide
          Rick Hillegas added a comment -

          It appears to me that this bug has been fixed.

          Show
          Rick Hillegas added a comment - It appears to me that this bug has been fixed.
          Hide
          Rick Hillegas added a comment -

          After we improve the memory usage of the LOBs returned by SQLClob.getObject() and SQLBlob.getObject() (see DERBY-4544), we should add a test case to ParameterMappingTest to test LOB inout procedure args which are bigger than the VM memory. Grep that file for makeBigClob and makeBigBlob to see where to plug in this test. This should round off the work done on DERBY-4066.

          Show
          Rick Hillegas added a comment - After we improve the memory usage of the LOBs returned by SQLClob.getObject() and SQLBlob.getObject() (see DERBY-4544 ), we should add a test case to ParameterMappingTest to test LOB inout procedure args which are bigger than the VM memory. Grep that file for makeBigClob and makeBigBlob to see where to plug in this test. This should round off the work done on DERBY-4066 .
          Hide
          Rick Hillegas added a comment -

          Tests passed cleanly for me except for the network ping problem. Committed second rev of the patch at subversion revision 982585.

          Show
          Rick Hillegas added a comment - Tests passed cleanly for me except for the network ping problem. Committed second rev of the patch at subversion revision 982585.
          Hide
          Rick Hillegas added a comment -

          Attaching a second rev of the patch, derby-4754-01-ab-harmonyLOBs. This cleans up the previous rev, using Derby error messages instead of Harmony message ids. The replacement error messages are largely borrowed from EmbedBlob and EmbedClob.

          Show
          Rick Hillegas added a comment - Attaching a second rev of the patch, derby-4754-01-ab-harmonyLOBs. This cleans up the previous rev, using Derby error messages instead of Harmony message ids. The replacement error messages are largely borrowed from EmbedBlob and EmbedClob.
          Hide
          Rick Hillegas added a comment -

          I believe that the proposed patch is incremental improvement. It will allow Derby to continue processing in situations which raise exceptions today. However, the patch will have performance/resource issues in situations similar to those covered by DERBY-4544. That is because the Harmony LOBs are constructed by materializing the contents of the Derby LOBs. Perhaps the solution to DERBY-4544 can be applied to this bug to.

          Show
          Rick Hillegas added a comment - I believe that the proposed patch is incremental improvement. It will allow Derby to continue processing in situations which raise exceptions today. However, the patch will have performance/resource issues in situations similar to those covered by DERBY-4544 . That is because the Harmony LOBs are constructed by materializing the contents of the Derby LOBs. Perhaps the solution to DERBY-4544 can be applied to this bug to.
          Hide
          Rick Hillegas added a comment -

          Tests passed cleanly for me with this patch, except for a ping heisenbug in the network environment.

          Show
          Rick Hillegas added a comment - Tests passed cleanly for me with this patch, except for a ping heisenbug in the network environment.
          Hide
          Rick Hillegas added a comment -

          Attaching derby-4754-01-aa-harmonyLOBs.diff. This patch needs to be cleaned up a bit and I need to see what breaks when I run the regression tests.

          This patch adds the Harmony SerialBlob and SerialClob implementations to Derby. These are used as fallback implementations of Blob and Clob to be returned by SQLBlob.getObject() and SQLClob.getObject() when those data values do not wrap LOBs.

          Touches the following files:

          -------------

          M NOTICE

          Thanks Harmony for its code.

          -------------

          A java/engine/org/apache/derby/iapi/types/HarmonySerialBlob.java
          A java/engine/org/apache/derby/iapi/types/HarmonySerialClob.java

          The cloned Harmony code.

          -------------

          M java/engine/org/apache/derby/iapi/types/SQLChar.java
          M java/engine/org/apache/derby/iapi/types/SQLClob.java

          Fixes SQLClob.getObject() so that it always returns a java.sql.Clob.

          -------------

          M java/engine/org/apache/derby/iapi/types/SQLBlob.java
          M java/engine/org/apache/derby/iapi/types/SQLBinary.java

          Fixes SQLBlob.getObject() so that it always returns a java.sql.Blob.

          Show
          Rick Hillegas added a comment - Attaching derby-4754-01-aa-harmonyLOBs.diff. This patch needs to be cleaned up a bit and I need to see what breaks when I run the regression tests. This patch adds the Harmony SerialBlob and SerialClob implementations to Derby. These are used as fallback implementations of Blob and Clob to be returned by SQLBlob.getObject() and SQLClob.getObject() when those data values do not wrap LOBs. Touches the following files: ------------- M NOTICE Thanks Harmony for its code. ------------- A java/engine/org/apache/derby/iapi/types/HarmonySerialBlob.java A java/engine/org/apache/derby/iapi/types/HarmonySerialClob.java The cloned Harmony code. ------------- M java/engine/org/apache/derby/iapi/types/SQLChar.java M java/engine/org/apache/derby/iapi/types/SQLClob.java Fixes SQLClob.getObject() so that it always returns a java.sql.Clob. ------------- M java/engine/org/apache/derby/iapi/types/SQLBlob.java M java/engine/org/apache/derby/iapi/types/SQLBinary.java Fixes SQLBlob.getObject() so that it always returns a java.sql.Blob.

            People

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

              Dates

              • Created:
                Updated:
                Resolved:

                Development