db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bryan Pendleton (JIRA)" <derby-...@db.apache.org>
Subject [jira] Updated: (DERBY-889) with client getTimestamp on a TIME column will print the date 1900-01-01 instead of the current date
Date Thu, 09 Mar 2006 04:14:40 GMT
     [ http://issues.apache.org/jira/browse/DERBY-889?page=all ]

Bryan Pendleton updated DERBY-889:
----------------------------------

    Attachment: derby-889.diff

Here is a proposed patch, including changes to both the embedded driver and the network client
driver, and a regression test.

For the embedded driver, the patch causes the driver to skip using the cached calendar, and
instead allow the time conversion code to allocate a fresh new calendar initialized with today's
date.

For the network client driver, the patch explicitly allocates a java.util.Date object and
uses it to set the date portion of the returned timestamp to contain today's date.

The regression test is added to jdbcapi/resultset.java, and simply calls getTimestamp() on
a field of type TIME and verifies that the date portion of the timestamp that is returned
contains today's date. For good measure, the regression test also calls getTimestamp() on
fields of type DATE and type TIMESTAMP and verifies that the expected results are returned
there, too. That is possibly overkill, except in the case of the embedded driver it is important
for the purposes of reproducing the bug that we force the ConnectionChild cached calendar
object to have an "interesting" calendar value, so that is why we call getTimestamp on the
other two fields first.

Please have a look and tell me what you think.


> with client getTimestamp on a TIME column will print the date  1900-01-01 instead of
the current date
> -----------------------------------------------------------------------------------------------------
>
>          Key: DERBY-889
>          URL: http://issues.apache.org/jira/browse/DERBY-889
>      Project: Derby
>         Type: Bug
>   Components: Network Client
>     Versions: 10.1.2.1, 10.1.2.2, 10.2.0.0, 10.1.3.0
>     Reporter: Kathey Marsden
>     Assignee: Bryan Pendleton
>  Attachments: derby-889.diff
>
> On client getTimestamp on a TIME column will print date   1900-01-01 instead of the current
date like the embedded driver.
> To repro run the DERBY-877 repro without specifying a file.encoding
> java TestEnc derbynetclient
> [snip]
> COLUMN 2:TM TIME
>         getString:      16:27:35
>         getTimeStamp:   1900-01-01 16:27:35.0
>         getTime:        16:27:35
>         getDate         Exception SQLSTATE:null  (EXPECTED)
> With Embedded  it prints the current date for getTimestamp
> java TestEnc  derby
> COLUMN 2:TM TIME
>         getString:      16:27:35
>         getTimeStamp:   2006-01-28 16:27:35.0
>         getTime:        16:27:35
>         getDate         Exception SQLSTATE:22005  (EXPECTED)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message