Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 86942 invoked from network); 21 Apr 2010 11:24:17 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 21 Apr 2010 11:24:17 -0000 Received: (qmail 86573 invoked by uid 500); 21 Apr 2010 11:24:16 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 86396 invoked by uid 500); 21 Apr 2010 11:24:16 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 86377 invoked by uid 99); 21 Apr 2010 11:24:15 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 Apr 2010 11:24:15 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 Apr 2010 11:24:12 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id o3LBNojA029025 for ; Wed, 21 Apr 2010 11:23:51 GMT Message-ID: <18357527.112601271849030771.JavaMail.jira@thor> Date: Wed, 21 Apr 2010 07:23:50 -0400 (EDT) From: "Knut Anders Hatlen (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Updated: (DERBY-4626) Timestamp truncated when converted to string with explicit calendar In-Reply-To: <32345954.112551271848669548.JavaMail.jira@thor> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/DERBY-4626?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Knut Anders Hatlen updated DERBY-4626: -------------------------------------- Attachment: TimestampToVarchar.java The attached class, TimestampToVarchar, shows the difference between the two methods. Note these two differences: 1) The setTimestamp() method that takes a Calendar truncates nanoseconds so that the resulting resolution is microseconds. The method that doesn't take a Calendar preserves the nanoseconds. 2) The setTimestamp() method that takes a Calendar does not remove trailing zeros, whereas the method that doesn't take a Calendar does remove trailing zeros (except if the fraction is zero). Here's the output of the repro on trunk: Testing timestamp: 2010-04-20 15:17:36.123456789 - without calendar: 2010-04-20 15:17:36.123456789 - with calendar: 2010-04-20 15:17:36.123457 Testing timestamp: 2010-04-20 15:17:36.12345678 - without calendar: 2010-04-20 15:17:36.12345678 - with calendar: 2010-04-20 15:17:36.123457 Testing timestamp: 2010-04-20 15:17:36.1234567 - without calendar: 2010-04-20 15:17:36.1234567 - with calendar: 2010-04-20 15:17:36.123457 Testing timestamp: 2010-04-20 15:17:36.123456 - without calendar: 2010-04-20 15:17:36.123456 - with calendar: 2010-04-20 15:17:36.123456 Testing timestamp: 2010-04-20 15:17:36.12345 - without calendar: 2010-04-20 15:17:36.12345 - with calendar: 2010-04-20 15:17:36.123450 Testing timestamp: 2010-04-20 15:17:36.1234 - without calendar: 2010-04-20 15:17:36.1234 - with calendar: 2010-04-20 15:17:36.123400 Testing timestamp: 2010-04-20 15:17:36.123 - without calendar: 2010-04-20 15:17:36.123 - with calendar: 2010-04-20 15:17:36.123000 Testing timestamp: 2010-04-20 15:17:36.12 - without calendar: 2010-04-20 15:17:36.12 - with calendar: 2010-04-20 15:17:36.120000 Testing timestamp: 2010-04-20 15:17:36.1 - without calendar: 2010-04-20 15:17:36.1 - with calendar: 2010-04-20 15:17:36.100000 Testing timestamp: 2010-04-20 15:17:36.0 - without calendar: 2010-04-20 15:17:36.0 - with calendar: 2010-04-20 15:17:36.0 > Timestamp truncated when converted to string with explicit calendar > ------------------------------------------------------------------- > > Key: DERBY-4626 > URL: https://issues.apache.org/jira/browse/DERBY-4626 > Project: Derby > Issue Type: Bug > Components: SQL > Affects Versions: 10.5.3.0 > Reporter: Knut Anders Hatlen > Attachments: TimestampToVarchar.java > > > When setting the value of a VARCHAR parameter with setTimestamp() the timestamp is truncated to microsecond resolution if a calendar is specified. Nanosecond resolution is preserved when a calendar is not specified. These two methods should behave the same way. Since Derby supports nanosecond resolution, the timestamps should not be truncated. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.