Derby
  1. Derby
  2. DERBY-5063

Embedded driver allows updateBytes() on BOOLEAN column

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 10.7.1.1
    • Fix Version/s: 10.8.1.2
    • Component/s: JDBC
    • Labels:
      None
    • Issue & fix info:
      Repro attached
    • Bug behavior facts:
      Embedded/Client difference

      Description

      The following code inserts the value TRUE into the table T on the embedded driver:

      Statement s = c.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
      s.execute("create table t(b boolean)");
      ResultSet rs = s.executeQuery("select b from t");
      rs.moveToInsertRow();
      rs.updateBytes(1, "this is a test".getBytes());
      rs.insertRow();

      The client driver fails:

      java.sql.SQLException: An attempt was made to put a data value of type 'byte[]' into a data value of type 'BOOLEAN'.

      I believe the client driver is correct, and embedded should be changed to match it.

      1. derby-5063-1b.diff
        3 kB
        Knut Anders Hatlen
      2. derby-5063-1a.diff
        1 kB
        Knut Anders Hatlen

        Issue Links

          Activity

          Knut Anders Hatlen created issue -
          Knut Anders Hatlen made changes -
          Field Original Value New Value
          Link This issue relates to DERBY-5058 [ DERBY-5058 ]
          Knut Anders Hatlen made changes -
          Assignee Knut Anders Hatlen [ knutanders ]
          Knut Anders Hatlen made changes -
          Status Open [ 1 ] In Progress [ 3 ]
          Hide
          Knut Anders Hatlen added a comment -

          Removing the setValue(byte[]) override in the SQLBoolean class (see attached patch derby-5063-1a.diff) makes embedded raise the same error as the client.

          Show
          Knut Anders Hatlen added a comment - Removing the setValue(byte[]) override in the SQLBoolean class (see attached patch derby-5063-1a.diff) makes embedded raise the same error as the client.
          Knut Anders Hatlen made changes -
          Attachment derby-5063-1a.diff [ 12471533 ]
          Hide
          Knut Anders Hatlen added a comment -

          Uploading a new patch (1b) which adds a test case. Without the fix, the test case fails with the embedded driver and passes with the client driver. It passes with both drivers when the fix is applied.

          The removal of setValue(byte[]) in SQLBoolean makes it use the method that it inherits from DataType, which throws the same exception as we see with the client driver.

          All regression tests ran cleanly.

          Show
          Knut Anders Hatlen added a comment - Uploading a new patch (1b) which adds a test case. Without the fix, the test case fails with the embedded driver and passes with the client driver. It passes with both drivers when the fix is applied. The removal of setValue(byte[]) in SQLBoolean makes it use the method that it inherits from DataType, which throws the same exception as we see with the client driver. All regression tests ran cleanly.
          Knut Anders Hatlen made changes -
          Attachment derby-5063-1b.diff [ 12471566 ]
          Knut Anders Hatlen made changes -
          Issue & fix info [Repro attached] [Patch Available, Repro attached]
          Hide
          Knut Anders Hatlen added a comment -

          Committed revision 1073287.

          Show
          Knut Anders Hatlen added a comment - Committed revision 1073287.
          Knut Anders Hatlen made changes -
          Status In Progress [ 3 ] Resolved [ 5 ]
          Issue & fix info [Repro attached, Patch Available] [Repro attached]
          Fix Version/s 10.8.0.0 [ 12315561 ]
          Resolution Fixed [ 1 ]
          Rick Hillegas made changes -
          Fix Version/s 10.8.1.1 [ 12316356 ]
          Fix Version/s 10.8.1.0 [ 12315561 ]
          Rick Hillegas made changes -
          Fix Version/s 10.8.1.2 [ 12316362 ]
          Fix Version/s 10.8.1.1 [ 12316356 ]
          Knut Anders Hatlen made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Gavin made changes -
          Workflow jira [ 12599454 ] Default workflow, editable Closed status [ 12801122 ]
          Transition Time In Source Status Execution Times Last Executer Last Execution Date
          Open Open In Progress In Progress
          34m 31s 1 Knut Anders Hatlen 20/Feb/11 21:32
          In Progress In Progress Resolved Resolved
          1d 12h 54m 1 Knut Anders Hatlen 22/Feb/11 10:27
          Resolved Resolved Closed Closed
          127d 22h 54m 1 Knut Anders Hatlen 30/Jun/11 10:21

            People

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

              Dates

              • Created:
                Updated:
                Resolved:

                Development