Re: help with front/backend datatype converting

From: "Do, Leon \(Leon\)" <leondo(at)alcatel-lucent(dot)com>
To: "Do, Leon \(Leon\)" <leondo(at)alcatel-lucent(dot)com>, "Kris Jurka" <books(at)ejurka(dot)com>
Cc: "Oliver Jowett" <oliver(at)opencloud(dot)com>, "Dave Cramer" <pg(at)fastcrypt(dot)com>, "imad" <immaad(at)gmail(dot)com>, <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: help with front/backend datatype converting
Date: 2007-01-05 21:58:04
Message-ID: D1EE06BA46B1E4449AF9A4F2FBEE18615E3840@ILEXC2U01.ndc.lucent.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

If you are reading the email you'll see paragraphs at the beginning.
Please ignore them and go to the embeded responses later in the page.

Leon Do

> -----Original Message-----
> From: pgsql-jdbc-owner(at)postgresql(dot)org
> [mailto:pgsql-jdbc-owner(at)postgresql(dot)org] On Behalf Of Do, Leon (Leon)
> Sent: Friday, January 05, 2007 4:46 PM
> To: Kris Jurka
> Cc: Oliver Jowett; Dave Cramer; imad; pgsql-jdbc(at)postgresql(dot)org
> Subject: Re: [JDBC] help with front/backend datatype converting
>
> Postgresql8.1 documentation:
>
> Table 8-12. Time Zone Input
> Example Description
> PST Pacific Standard Time
> -8:00 ISO-8601 offset for PST
> -800 ISO-8601 offset for PST
> -8 ISO-8601 offset for PST
> zulu Military abbreviation for UTC
> z Short form of zulu
>
> It can takes any input. You cann't assume it only return
> hh:mm. When things can go wrong it will go wrong.
>
>
>
>
> Refer to Appendix B for a list of time zone names that are
> recognized for input.
>
> > -----Original Message-----
> > From: Kris Jurka [mailto:books(at)ejurka(dot)com]
> > Sent: Friday, January 05, 2007 2:52 PM
> > To: Do, Leon (Leon)
> > Cc: Oliver Jowett; Dave Cramer; imad; pgsql-jdbc(at)postgresql(dot)org
> > Subject: Re: [JDBC] help with front/backend datatype converting
> >
> >
> >
> > On Fri, 5 Jan 2007, Do, Leon (Leon) wrote:
> >
> > > Leon-it is actually a bug in the class. The server could
> possibly
> > > sends a timezone in 'hhmm' format and the class treats
> the entire 4
> > > digits as number of hours which is totally incorrect. I already
> > > provided the quick fix so it won't take too much effort to
> > put it in
> > > the load. If you tell me the direction then I can add it
> > in the load
> > > so you don't have to spend extra effort.
> > >
> >
> > Please demonstrate how it is possible to generate a
> timezone in this
> > format. I can't seem to do it:
> >
> > jurka=# set timezone='Asia/Tehran';
> > SET
> > jurka=# select now();
> > now
> > ----------------------------------
> > 2007-01-05 22:56:26.065258+03:30
> >
>
> The Postgresql 8.1 document indicates that it can take the following
> inputs:
> Table 8-12. Time Zone Input
> Example Description
> PST Pacific Standard Time
> -8:00 ISO-8601 offset for PST
> -800 ISO-8601 offset for PST
> -8 ISO-8601 offset for PST
>
>
> The driver should expect timezone output to be one of its
> form as well.
> Murphy's Law, "If anything can go wrong, it will" so we
> cann't hardcode that way forever.
>
> In my situation, I have to work with multiple DBs. Since
> timestamp data type is varied across different DB vendors
> therefore I have to use the varchar to store the timestamp string.
>
> Ex:
> create table test {
> timestampfield varchar(50)
> );
>
>
> Insert into test values ("2007-01-05 23:20:25.122222+06:30");
> Insert into test values ("2006-01-05 23:20:25.122222+0650");
>
> I must allow two forms of timezones as indicated in the document
>
> Using PG JDBC driver, I can do the following:
>
> ResultSet rs = stmt.getResultSet();
> rs.getTimestamp();
>
> That the way I use it but it is a valid according to the document.
>
> Leon Do
>
>
> >
> > Kris Jurka
> >
> >
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 7: You can help support the PostgreSQL project by donating at
>
> http://www.postgresql.org/about/donate
>

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Tom Lane 2007-01-06 03:30:22 Re: help with front/backend datatype converting
Previous Message Do, Leon (Leon) 2007-01-05 21:46:09 Re: help with front/backend datatype converting