From: | "Thomas O'Dowd" <tom(at)nooper(dot)com> |
---|---|
To: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | Re: (2) patch against cvs for getTimestamp() problem. |
Date: | 2001-12-08 09:55:32 |
Message-ID: | 20011208185532.I17132@beast.uwillsee.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
As a followup to this I noticed a small typo in the jdbc1 part of the
patch which is fixed in this patch. So please ignore the first patch
that I sent. I'd like to add that the jdbc2 part is tested as far as
I can but someone should briefly test the jdbc1 part as I haven't
the environment to test that here.
Regards,
Tom.
On Sat, Dec 08, 2001 at 02:40:51PM +0900, Thomas O'Dowd wrote:
> Hi all,
>
> I just upgraded my development environment to 7.2b3 and the latest cvs
> driver both built from source. I found that ResultSet.getTimestamp()
> was no longer working against a 7.2 database and causing an exception
> parsing the timestamp that pg was returning.
>
> Bad Timestamp Format at 23 in 2001-12-06 23:24:07.895882+09
> at org.postgresql.jdbc2.ResultSet.toTimestamp(ResultSet.java:1707)
> at org.postgresql.jdbc2.ResultSet.getTimestamp(ResultSet.java:398)
>
> It seems that timestamps have become more accurate in 7.2 going from
> 2 fractional second digits to 6 which was causing the exception. Looking
> at the code in toTimestamp() I decided that it was better to rewrite
> it, then add a small fix as the method of parsing before was error
> prone in my opinion and the new code (less the comments) is smaller
> and easier to read IMHO :)
>
> I'm including patches against jdbc1 and jdbc2 ResultSet.java. I generated
> the patch against the latest cvs, using cvs diff -c. I've tested the
> jdbc2 versions pretty well and it parses the following combinations
>
> "2001-12-07 16:29:22.47+09",
> "2001-12-07 16:29:26+09",
> "2001-12-07 16:26:50.144213+09",
> "2001-12-07 16:26:59.461349+09",
> "2001-12-07 16:26:59.461349+05:30",
> "2001-12-07 00:00:00+09",
> "2001-12-07 12:00:00",
> "2001-12-07"
>
> The driver is set to return ISO datestyle formats so I'm not sure if the
> latter two formats are required but as the older code supported them, I've
> added code to do this. If anyone can suggest more formats that pg may
> return I can test those on the new code too. I've been running the new
> driver with my code with no problem now.
>
> If anyone has any questions or suggestions please let me know. I think
> this is an important bug fix for the 7.2 release of pg. Can someone test
> the changes in the jdbc1 driver as I don't have a means of doing this.
>
> The patch file is attached.
>
> Regards,
>
> Tom.
> --
> Thomas O'Dowd. - Nooping - http://nooper.com
> tom(at)nooper(dot)com - Testing - http://nooper.co.jp/labs
Attachment | Content-Type | Size |
---|---|---|
rs_patch | text/plain | 15.1 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Rene Pijlman | 2001-12-08 13:25:23 | Re: Bug with caching SQLTypes in Connection:getSQLType(oid) |
Previous Message | Thomas O'Dowd | 2001-12-08 05:40:51 | patch against cvs for getTimestamp() problem. |