Re: [PATCHES] JDBC timestamp does not understand [-]infinity

From: Barry Lind <barry(at)xythos(dot)com>
To: Dmitry Tkach <dmitry(at)openratings(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org, pgsql-patches(at)postgresql(dot)org
Subject: Re: [PATCHES] JDBC timestamp does not understand [-]infinity
Date: 2002-09-02 03:14:51
Message-ID: 3D72D7AB.5060401@xythos.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-jdbc pgsql-patches

A modified version of this patch has been applied.

--Barry

Dmitry Tkach wrote:

> The attached patch fixes 'Bad Timestamp format' exception when
> timestamp value is 'ininity' or '-ininity'.
> I hope, it helps...
> Dima.
>
>------------------------------------------------------------------------
>
>Index: AbstractJdbc1ResultSet.java
>===================================================================
>RCS file: /projects/cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1ResultSet.java,v
>retrieving revision 1.1
>diff -p -r1.1 AbstractJdbc1ResultSet.java
>*** AbstractJdbc1ResultSet.java 2002/07/23 03:59:55 1.1
>--- AbstractJdbc1ResultSet.java 2002/07/23 16:58:00
>*************** public abstract class AbstractJdbc1Resul
>*** 40,46 ****
>--- 40,50 ----
> protected StringBuffer sbuf = null;
> public byte[][] rowBuffer=null;
>
>+ public static final String MIN_DATE_STR = "0000-01-01";
>+ public static final String MAX_DATE_STR = "9999-12-31";
>+
>
>+
> public AbstractJdbc1ResultSet(org.postgresql.PGConnection conn, Field[] fields, Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor)
> {
> this.connection = conn;
>*************** public abstract class AbstractJdbc1Resul
>*** 853,861 ****
> else
> rs.sbuf.setLength(0);
>
> // Copy s into sbuf for parsing.
> rs.sbuf.append(s);
>- int slen = s.length();
>
> if (slen > 19)
> {
>--- 857,871 ----
> else
> rs.sbuf.setLength(0);
>
>+ int slen = s.length();
>+
>+ if (slen == 8 && s.equals ("infinity"))
>+ s = MAX_DATE_STR;
>+ else if (slen == 9 && s.equals ("-infinity"))
>+ s = MIN_DATE_STR;
>+
> // Copy s into sbuf for parsing.
> rs.sbuf.append(s);
>
> if (slen > 19)
> {
>
>
>------------------------------------------------------------------------
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
>
>

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message NISHAL K.R 2002-09-02 06:48:15 BUG
Previous Message Tomoyuki Niijima 2002-09-01 23:33:24 failed to build libpq.so on AIX 4 and 5/I have a solution

Browse pgsql-jdbc by date

  From Date Subject
Next Message Barry Lind 2002-09-02 03:15:18 Re: setBlob loop performance?
Previous Message Barry Lind 2002-09-02 03:13:34 Re: Issues with Array interface (String parsing)

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2002-09-02 04:28:19 Re: rules regression test fix
Previous Message Bruce Momjian 2002-09-02 02:24:35 Re: fulltextindex update