Uploaded image for project: 'Derby'
  1. Derby
  2. DERBY-1816

Client's ResultSet.getTime() on a SQL TIMESTAMP column loses the sub-second resolution and always has a milli-second value of zero.



    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • JDBC, Network Client
    • None
    • Release Note Needed


      In embedded the java.sql.Time object returned from ResultSet.getTime() for a SQL TIMESTAMP object has its millisecond value for the time portion equal to that for the java.sql.Timestamp value.
      In client the millisecond time value for such a value is always set to zero.

      Note a Derby SQL TIME value has by definition resolution of only a second so its millisecond value is always zero,
      but java.sql.Time is not a direct mapping to the SQL Type, it's a JDBC type, so when converting from a SQL TIMESTAMP
      it should retain the precision.

      The new test lang.TimeHandlingTest has this assert code that shows the problem, one of its calls will be commented out
      with a comment with this bug number.

      private void assertTimeEqual(Time tv, Timestamp tsv)

      { cal.clear(); cal.setTime(tv); int hour = cal.get(Calendar.HOUR_OF_DAY); int min = cal.get(Calendar.MINUTE); int sec = cal.get(Calendar.SECOND); int ms = cal.get(Calendar.MILLISECOND); // Check the time portion is set to the same as tv cal.clear(); cal.setTime(tsv); assertEquals(hour, cal.get(Calendar.HOUR_OF_DAY)); assertEquals(min, cal.get(Calendar.MINUTE)); assertEquals(sec, cal.get(Calendar.SECOND)); assertEquals(ms, cal.get(Calendar.MILLISECOND)); <<<<<<<<<<<<< FAILS HERE }


        1. releaseNote.html
          4 kB
          Myrna van Lunteren
        2. releaseNote.html
          4 kB
          A B
        3. d1816_v1.patch
          7 kB
          A B
        4. d1816_recycleCleanup_v3.patch
          19 kB
          A B
        5. d1816_recycleCleanup_v2.stat
          0.1 kB
          A B
        6. d1816_recycleCleanup_v2.patch
          19 kB
          A B
        7. d1816_recycleCleanup_v1.patch
          18 kB
          A B

        Issue Links



              army A B
              djd Daniel John Debrunner
              1 Vote for this issue
              0 Start watching this issue