Derby
  1. Derby
  2. DERBY-4810

setTimestamp() methods don't agree on trailing zeros

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 10.7.1.1
    • Fix Version/s: 10.7.1.1
    • Component/s: SQL
    • Labels:
      None
    • Bug behavior facts:
      Embedded/Client difference

      Description

      With the statement

      VALUES CAST(? AS VARCHAR(29))

      PreparedStatement.setTimestamp(int,Timestamp) and PreparedStatement.setTimestamp(int,Timestamp,Calendar) don't agree on what to do with trailing zeros in the nanosecond component. The method that doesn't take a Calendar argument, removes trailing zeros. The method that takes a Calendar object appends zeros so that the nanosecond component always has nine digits. (Both methods have a special case when nanoseconds is zero, and they agree on adding just a single zero after the decimal point in that case.)

      The format used by PreparedStatement.setTimestamp(int,Timestamp) matches what java.sql.Timestamp.toString() returns (in fact, it uses Timestamp.toString() internally to produce the string representation), and I think it would be reasonable to use that format for both the methods.

      1. derby-4810-1a.diff
        4 kB
        Knut Anders Hatlen
      2. test.diff
        2 kB
        Knut Anders Hatlen

        Activity

        Knut Anders Hatlen created issue -
        Knut Anders Hatlen made changes -
        Field Original Value New Value
        Status Open [ 1 ] In Progress [ 3 ]
        Knut Anders Hatlen made changes -
        Bug behavior facts [Embedded/Client difference]
        Knut Anders Hatlen made changes -
        Attachment test.diff [ 12455259 ]
        Knut Anders Hatlen made changes -
        Attachment derby-4810-1a.diff [ 12455263 ]
        Knut Anders Hatlen made changes -
        Issue & fix info [Patch Available]
        Component/s SQL [ 11408 ]
        Component/s JDBC [ 11407 ]
        Knut Anders Hatlen made changes -
        Status In Progress [ 3 ] Closed [ 6 ]
        Issue & fix info [Patch Available]
        Fix Version/s 10.7.0.0 [ 12314971 ]
        Resolution Fixed [ 1 ]
        Rick Hillegas made changes -
        Affects Version/s 10.7.1.1 [ 12315564 ]
        Affects Version/s 10.7.1.0 [ 12314971 ]
        Fix Version/s 10.7.1.1 [ 12315564 ]
        Fix Version/s 10.7.1.0 [ 12314971 ]
        Gavin made changes -
        Workflow jira [ 12521219 ] Default workflow, editable Closed status [ 12800279 ]

          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