pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
issues with Statement.getTimestamp(int, Calendar)
10+ messages / 4 participants
[nested] [flat]

* issues with Statement.getTimestamp(int, Calendar)
@ 2006-12-12 09:15 Ravi Periasamy <ravitx12@yahoo.com>
  2006-12-13 00:42 ` Re: issues with Statement.getTimestamp(int, Calendar) Oliver Jowett <oliver@opencloud.com>
  0 siblings, 1 reply; 10+ messages in thread

From: Ravi Periasamy @ 2006-12-12 09:15 UTC (permalink / raw)
  To: pgsql-jdbc

Dear PSQL-JDBC team,

There is a issue with Statement.getTimestamp(int,
Calendar). The timestamp is offset in the wrong
direction.

The quivalent on ResultSet.getTimestamp(int, Calendar)
works fine.

Is this a known bug, can we expect a fix for this,
when?

Thanks
Ravi


 
____________________________________________________________________________________
Cheap talk?
Check out Yahoo! Messenger's low PC-to-Phone call rates.
http://voice.yahoo.com



^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* Re: issues with Statement.getTimestamp(int, Calendar)
  2006-12-12 09:15 issues with Statement.getTimestamp(int, Calendar) Ravi Periasamy <ravitx12@yahoo.com>
@ 2006-12-13 00:42 ` Oliver Jowett <oliver@opencloud.com>
  2006-12-13 04:05   ` Re: issues with Statement.getTimestamp(int, Calendar) Ravi Periasamy <ravitx12@yahoo.com>
  0 siblings, 1 reply; 10+ messages in thread

From: Oliver Jowett @ 2006-12-13 00:42 UTC (permalink / raw)
  To: Ravi Periasamy <ravitx12@yahoo.com>; +Cc: pgsql-jdbc

Ravi Periasamy wrote:
> Dear PSQL-JDBC team,
> 
> There is a issue with Statement.getTimestamp(int,
> Calendar). The timestamp is offset in the wrong
> direction.
> 
> The quivalent on ResultSet.getTimestamp(int, Calendar)
> works fine.
> 
> Is this a known bug, can we expect a fix for this,
> when?

Can you send a testcase demonstrating the problem please?

-O



^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* Re: issues with Statement.getTimestamp(int, Calendar)
  2006-12-12 09:15 issues with Statement.getTimestamp(int, Calendar) Ravi Periasamy <ravitx12@yahoo.com>
  2006-12-13 00:42 ` Re: issues with Statement.getTimestamp(int, Calendar) Oliver Jowett <oliver@opencloud.com>
@ 2006-12-13 04:05   ` Ravi Periasamy <ravitx12@yahoo.com>
  2006-12-13 11:38     ` Re: issues with Statement.getTimestamp(int, Calendar) Dave Cramer <pg@fastcrypt.com>
  0 siblings, 1 reply; 10+ messages in thread

From: Ravi Periasamy @ 2006-12-13 04:05 UTC (permalink / raw)
  To: Oliver Jowett <oliver@opencloud.com>; +Cc: pgsql-jdbc; Ravi Periasamy <ravitx12@yahoo.com>

The test case is as follows.

I created a function as follows:
==================================================
create or replace function testouttimestamp(OUT a1
timestamp) AS $$
begin
  a1 := '1970-01-01 00:00:00';
end;
$$ language plpgsql;
==================================================

and called through JDBC as follows:
==================================================
TimeZone tz = TimeZone.getTimeZone("GMT");
Calendar cr = Calendar.getInstance(tz);
CallableStatement stmt = con.prepareCall( "{call
testouttimestamp(?)}");
stmt.registerOutParameter(1, Types.TIMESTAMP);
stmt.execute();
Timestamp ts = stmt.getTimestamp(1, cr);
System.out.println("ts = " + ts);
==================================================

Actual Result ==> 
1969-12-31 18:30:00.0

Expected Result ==> 
1970-01-01 05:30:00.0

Note: ResultSet.getTimestamp(int, Calendar) works
fine.

Thanks
Ravi

--- Oliver Jowett <oliver@opencloud.com> wrote:

> Ravi Periasamy wrote:
> > Dear PSQL-JDBC team,
> > 
> > There is a issue with Statement.getTimestamp(int,
> > Calendar). The timestamp is offset in the wrong
> > direction.
> > 
> > The quivalent on ResultSet.getTimestamp(int,
> Calendar)
> > works fine.
> > 
> > Is this a known bug, can we expect a fix for this,
> > when?
> 
> Can you send a testcase demonstrating the problem
> please?
> 
> -O
> 



 
____________________________________________________________________________________
Want to start your own business?
Learn how on Yahoo! Small Business.
http://smallbusiness.yahoo.com/r-index



^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* Re: issues with Statement.getTimestamp(int, Calendar)
  2006-12-12 09:15 issues with Statement.getTimestamp(int, Calendar) Ravi Periasamy <ravitx12@yahoo.com>
  2006-12-13 00:42 ` Re: issues with Statement.getTimestamp(int, Calendar) Oliver Jowett <oliver@opencloud.com>
  2006-12-13 04:05   ` Re: issues with Statement.getTimestamp(int, Calendar) Ravi Periasamy <ravitx12@yahoo.com>
@ 2006-12-13 11:38     ` Dave Cramer <pg@fastcrypt.com>
  2006-12-13 11:47       ` Re: issues with Statement.getTimestamp(int, Calendar) Ravi Periasamy <ravitx12@yahoo.com>
  0 siblings, 1 reply; 10+ messages in thread

From: Dave Cramer @ 2006-12-13 11:38 UTC (permalink / raw)
  To: Ravi Periasamy <ravitx12@yahoo.com>; +Cc: Oliver Jowett <oliver@opencloud.com>; pgsql-jdbc

Ravi,

what is your time zone from what you have my guess would be -9:00 ?

I think the JVM adjusts the actual time to your local timezone when  
it prints it.

Dave
On 12-Dec-06, at 11:05 PM, Ravi Periasamy wrote:

> The test case is as follows.
>
> I created a function as follows:
> ==================================================
> create or replace function testouttimestamp(OUT a1
> timestamp) AS $$
> begin
>   a1 := '1970-01-01 00:00:00';
> end;
> $$ language plpgsql;
> ==================================================
>
> and called through JDBC as follows:
> ==================================================
> TimeZone tz = TimeZone.getTimeZone("GMT");
> Calendar cr = Calendar.getInstance(tz);
> CallableStatement stmt = con.prepareCall( "{call
> testouttimestamp(?)}");
> stmt.registerOutParameter(1, Types.TIMESTAMP);
> stmt.execute();
> Timestamp ts = stmt.getTimestamp(1, cr);
> System.out.println("ts = " + ts);
> ==================================================
>
> Actual Result ==>
> 1969-12-31 18:30:00.0
>
> Expected Result ==>
> 1970-01-01 05:30:00.0
>
> Note: ResultSet.getTimestamp(int, Calendar) works
> fine.
>
> Thanks
> Ravi
>
> --- Oliver Jowett <oliver@opencloud.com> wrote:
>
>> Ravi Periasamy wrote:
>>> Dear PSQL-JDBC team,
>>>
>>> There is a issue with Statement.getTimestamp(int,
>>> Calendar). The timestamp is offset in the wrong
>>> direction.
>>>
>>> The quivalent on ResultSet.getTimestamp(int,
>> Calendar)
>>> works fine.
>>>
>>> Is this a known bug, can we expect a fix for this,
>>> when?
>>
>> Can you send a testcase demonstrating the problem
>> please?
>>
>> -O
>>
>
>
>
>
> ______________________________________________________________________ 
> ______________
> Want to start your own business?
> Learn how on Yahoo! Small Business.
> http://smallbusiness.yahoo.com/r-index
>
> ---------------------------(end of  
> broadcast)---------------------------
> TIP 4: Have you searched our list archives?
>
>                http://archives.postgresql.org
>




^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* Re: issues with Statement.getTimestamp(int, Calendar)
  2006-12-12 09:15 issues with Statement.getTimestamp(int, Calendar) Ravi Periasamy <ravitx12@yahoo.com>
  2006-12-13 00:42 ` Re: issues with Statement.getTimestamp(int, Calendar) Oliver Jowett <oliver@opencloud.com>
  2006-12-13 04:05   ` Re: issues with Statement.getTimestamp(int, Calendar) Ravi Periasamy <ravitx12@yahoo.com>
  2006-12-13 11:38     ` Re: issues with Statement.getTimestamp(int, Calendar) Dave Cramer <pg@fastcrypt.com>
@ 2006-12-13 11:47       ` Ravi Periasamy <ravitx12@yahoo.com>
  2006-12-13 12:28         ` Re: issues with Statement.getTimestamp(int, Calendar) Oliver Jowett <oliver@opencloud.com>
  0 siblings, 1 reply; 10+ messages in thread

From: Ravi Periasamy @ 2006-12-13 11:47 UTC (permalink / raw)
  To: Dave Cramer <pg@fastcrypt.com>; +Cc: Oliver Jowett <oliver@opencloud.com>; pgsql-jdbc; Ravi Periasamy <ravitx12@yahoo.com>

Dave,

I'm in Asia/Calcutta (India) time zone. It is +5.30
from GMT.

I'm almost certain there's a bug in
Statement.getTimestamp(int, Calendar). Where as,
Resultset.getTimestamp(int, Calendar) gives the
correct value. 

I suspect the AbstractJdbc2Statement.changetime()
method.

Thanks
Ravi

--- Dave Cramer <pg@fastcrypt.com> wrote:

> Ravi,
> 
> what is your time zone from what you have my guess
> would be -9:00 ?
> 
> I think the JVM adjusts the actual time to your
> local timezone when  
> it prints it.
> 
> Dave
> On 12-Dec-06, at 11:05 PM, Ravi Periasamy wrote:
> 
> > The test case is as follows.
> >
> > I created a function as follows:
> > ==================================================
> > create or replace function testouttimestamp(OUT a1
> > timestamp) AS $$
> > begin
> >   a1 := '1970-01-01 00:00:00';
> > end;
> > $$ language plpgsql;
> > ==================================================
> >
> > and called through JDBC as follows:
> > ==================================================
> > TimeZone tz = TimeZone.getTimeZone("GMT");
> > Calendar cr = Calendar.getInstance(tz);
> > CallableStatement stmt = con.prepareCall( "{call
> > testouttimestamp(?)}");
> > stmt.registerOutParameter(1, Types.TIMESTAMP);
> > stmt.execute();
> > Timestamp ts = stmt.getTimestamp(1, cr);
> > System.out.println("ts = " + ts);
> > ==================================================
> >
> > Actual Result ==>
> > 1969-12-31 18:30:00.0
> >
> > Expected Result ==>
> > 1970-01-01 05:30:00.0
> >
> > Note: ResultSet.getTimestamp(int, Calendar) works
> > fine.
> >
> > Thanks
> > Ravi
> >
> > --- Oliver Jowett <oliver@opencloud.com> wrote:
> >
> >> Ravi Periasamy wrote:
> >>> Dear PSQL-JDBC team,
> >>>
> >>> There is a issue with
> Statement.getTimestamp(int,
> >>> Calendar). The timestamp is offset in the wrong
> >>> direction.
> >>>
> >>> The quivalent on ResultSet.getTimestamp(int,
> >> Calendar)
> >>> works fine.
> >>>
> >>> Is this a known bug, can we expect a fix for
> this,
> >>> when?
> >>
> >> Can you send a testcase demonstrating the problem
> >> please?
> >>
> >> -O
> >>
> >
> >
> >
> >
> >
>
______________________________________________________________________
> 
> > ______________
> > Want to start your own business?
> > Learn how on Yahoo! Small Business.
> > http://smallbusiness.yahoo.com/r-index
> >
> > ---------------------------(end of  
> > broadcast)---------------------------
> > TIP 4: Have you searched our list archives?
> >
> >                http://archives.postgresql.org
> >
> 
> 



 
____________________________________________________________________________________
Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail beta.
http://new.mail.yahoo.com



^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* Re: issues with Statement.getTimestamp(int, Calendar)
  2006-12-12 09:15 issues with Statement.getTimestamp(int, Calendar) Ravi Periasamy <ravitx12@yahoo.com>
  2006-12-13 00:42 ` Re: issues with Statement.getTimestamp(int, Calendar) Oliver Jowett <oliver@opencloud.com>
  2006-12-13 04:05   ` Re: issues with Statement.getTimestamp(int, Calendar) Ravi Periasamy <ravitx12@yahoo.com>
  2006-12-13 11:38     ` Re: issues with Statement.getTimestamp(int, Calendar) Dave Cramer <pg@fastcrypt.com>
  2006-12-13 11:47       ` Re: issues with Statement.getTimestamp(int, Calendar) Ravi Periasamy <ravitx12@yahoo.com>
@ 2006-12-13 12:28         ` Oliver Jowett <oliver@opencloud.com>
  2006-12-13 13:58           ` Re: issues with Statement.getTimestamp(int, Calendar) Dave Cramer <pg@fastcrypt.com>
  2007-01-04 21:59           ` Re: issues with Statement.getTimestamp(int, Calendar) Kris Jurka <books@ejurka.com>
  0 siblings, 2 replies; 10+ messages in thread

From: Oliver Jowett @ 2006-12-13 12:28 UTC (permalink / raw)
  To: Ravi Periasamy <ravitx12@yahoo.com>; +Cc: Dave Cramer <pg@fastcrypt.com>; pgsql-jdbc

Ravi Periasamy wrote:

> I suspect the AbstractJdbc2Statement.changetime()
> method.

Yeah, that code looks pretty broken to me, it has completely the wrong 
end of the stick about what it should be doing with the provided 
calendar, AFAICS.

Dave, why doesn't the out-parameter stuff do timestamp conversion by 
delegating to the same code as the ResultSet code uses? That does all 
the hard stuff for you..

-O



^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* Re: issues with Statement.getTimestamp(int, Calendar)
  2006-12-12 09:15 issues with Statement.getTimestamp(int, Calendar) Ravi Periasamy <ravitx12@yahoo.com>
  2006-12-13 00:42 ` Re: issues with Statement.getTimestamp(int, Calendar) Oliver Jowett <oliver@opencloud.com>
  2006-12-13 04:05   ` Re: issues with Statement.getTimestamp(int, Calendar) Ravi Periasamy <ravitx12@yahoo.com>
  2006-12-13 11:38     ` Re: issues with Statement.getTimestamp(int, Calendar) Dave Cramer <pg@fastcrypt.com>
  2006-12-13 11:47       ` Re: issues with Statement.getTimestamp(int, Calendar) Ravi Periasamy <ravitx12@yahoo.com>
  2006-12-13 12:28         ` Re: issues with Statement.getTimestamp(int, Calendar) Oliver Jowett <oliver@opencloud.com>
@ 2006-12-13 13:58           ` Dave Cramer <pg@fastcrypt.com>
  1 sibling, 0 replies; 10+ messages in thread

From: Dave Cramer @ 2006-12-13 13:58 UTC (permalink / raw)
  To: Oliver Jowett <oliver@opencloud.com>; +Cc: Ravi Periasamy <ravitx12@yahoo.com>; pgsql-jdbc

Oliver,

To be honest, I didn't write the stuff in AbstractJdbc2Statement.  
That is left over from the original implementation. That being said,  
there is no function in the utils that takes a date and a calendar  
and returns a Calendar.

It does look like the best place to put that code though.

Dave
On 13-Dec-06, at 7:28 AM, Oliver Jowett wrote:

> Ravi Periasamy wrote:
>
>> I suspect the AbstractJdbc2Statement.changetime()
>> method.
>
> Yeah, that code looks pretty broken to me, it has completely the  
> wrong end of the stick about what it should be doing with the  
> provided calendar, AFAICS.
>
> Dave, why doesn't the out-parameter stuff do timestamp conversion  
> by delegating to the same code as the ResultSet code uses? That  
> does all the hard stuff for you..
>
> -O
>




^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* Re: issues with Statement.getTimestamp(int, Calendar)
  2006-12-12 09:15 issues with Statement.getTimestamp(int, Calendar) Ravi Periasamy <ravitx12@yahoo.com>
  2006-12-13 00:42 ` Re: issues with Statement.getTimestamp(int, Calendar) Oliver Jowett <oliver@opencloud.com>
  2006-12-13 04:05   ` Re: issues with Statement.getTimestamp(int, Calendar) Ravi Periasamy <ravitx12@yahoo.com>
  2006-12-13 11:38     ` Re: issues with Statement.getTimestamp(int, Calendar) Dave Cramer <pg@fastcrypt.com>
  2006-12-13 11:47       ` Re: issues with Statement.getTimestamp(int, Calendar) Ravi Periasamy <ravitx12@yahoo.com>
  2006-12-13 12:28         ` Re: issues with Statement.getTimestamp(int, Calendar) Oliver Jowett <oliver@opencloud.com>
@ 2007-01-04 21:59           ` Kris Jurka <books@ejurka.com>
  2007-01-05 14:48             ` Re: issues with Statement.getTimestamp(int, Calendar) Ravi Periasamy <ravitx12@yahoo.com>
  1 sibling, 1 reply; 10+ messages in thread

From: Kris Jurka @ 2007-01-04 21:59 UTC (permalink / raw)
  To: Oliver Jowett <oliver@opencloud.com>; +Cc: Ravi Periasamy <ravitx12@yahoo.com>; Dave Cramer <pg@fastcrypt.com>; pgsql-jdbc



On Wed, 13 Dec 2006, Oliver Jowett wrote:

> Ravi Periasamy wrote:
>
>> I suspect the AbstractJdbc2Statement.changetime()
>> method.
>
> Yeah, that code looks pretty broken to me, it has completely the wrong 
> end of the stick about what it should be doing with the provided 
> calendar, AFAICS.
>
> Dave, why doesn't the out-parameter stuff do timestamp conversion by 
> delegating to the same code as the ResultSet code uses? That does all 
> the hard stuff for you..
>

I've rewritten this code to farm out the work to TimestampUtils and 
applied it to the 8.1, 8.2 and 8.3dev branches.

Kris Jurka



^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* Re: issues with Statement.getTimestamp(int, Calendar)
  2006-12-12 09:15 issues with Statement.getTimestamp(int, Calendar) Ravi Periasamy <ravitx12@yahoo.com>
  2006-12-13 00:42 ` Re: issues with Statement.getTimestamp(int, Calendar) Oliver Jowett <oliver@opencloud.com>
  2006-12-13 04:05   ` Re: issues with Statement.getTimestamp(int, Calendar) Ravi Periasamy <ravitx12@yahoo.com>
  2006-12-13 11:38     ` Re: issues with Statement.getTimestamp(int, Calendar) Dave Cramer <pg@fastcrypt.com>
  2006-12-13 11:47       ` Re: issues with Statement.getTimestamp(int, Calendar) Ravi Periasamy <ravitx12@yahoo.com>
  2006-12-13 12:28         ` Re: issues with Statement.getTimestamp(int, Calendar) Oliver Jowett <oliver@opencloud.com>
  2007-01-04 21:59           ` Re: issues with Statement.getTimestamp(int, Calendar) Kris Jurka <books@ejurka.com>
@ 2007-01-05 14:48             ` Ravi Periasamy <ravitx12@yahoo.com>
  2007-01-05 17:32               ` Re: issues with Statement.getTimestamp(int, Calendar) Kris Jurka <books@ejurka.com>
  0 siblings, 1 reply; 10+ messages in thread

From: Ravi Periasamy @ 2007-01-05 14:48 UTC (permalink / raw)
  To: Kris Jurka <books@ejurka.com>; Oliver Jowett <oliver@opencloud.com>; +Cc: Ravi Periasamy <ravitx12@yahoo.com>; Dave Cramer <pg@fastcrypt.com>; pgsql-jdbc

We worked around this issue. I'm keen to pick up a
official release of the JDBC driver with the fix, will
there be one anytime soon?

Thanks
Ravi
--- Kris Jurka <books@ejurka.com> wrote:

> 
> 
> On Wed, 13 Dec 2006, Oliver Jowett wrote:
> 
> > Ravi Periasamy wrote:
> >
> >> I suspect the AbstractJdbc2Statement.changetime()
> >> method.
> >
> > Yeah, that code looks pretty broken to me, it has
> completely the wrong 
> > end of the stick about what it should be doing
> with the provided 
> > calendar, AFAICS.
> >
> > Dave, why doesn't the out-parameter stuff do
> timestamp conversion by 
> > delegating to the same code as the ResultSet code
> uses? That does all 
> > the hard stuff for you..
> >
> 
> I've rewritten this code to farm out the work to
> TimestampUtils and 
> applied it to the 8.1, 8.2 and 8.3dev branches.
> 
> Kris Jurka
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* Re: issues with Statement.getTimestamp(int, Calendar)
  2006-12-12 09:15 issues with Statement.getTimestamp(int, Calendar) Ravi Periasamy <ravitx12@yahoo.com>
  2006-12-13 00:42 ` Re: issues with Statement.getTimestamp(int, Calendar) Oliver Jowett <oliver@opencloud.com>
  2006-12-13 04:05   ` Re: issues with Statement.getTimestamp(int, Calendar) Ravi Periasamy <ravitx12@yahoo.com>
  2006-12-13 11:38     ` Re: issues with Statement.getTimestamp(int, Calendar) Dave Cramer <pg@fastcrypt.com>
  2006-12-13 11:47       ` Re: issues with Statement.getTimestamp(int, Calendar) Ravi Periasamy <ravitx12@yahoo.com>
  2006-12-13 12:28         ` Re: issues with Statement.getTimestamp(int, Calendar) Oliver Jowett <oliver@opencloud.com>
  2007-01-04 21:59           ` Re: issues with Statement.getTimestamp(int, Calendar) Kris Jurka <books@ejurka.com>
  2007-01-05 14:48             ` Re: issues with Statement.getTimestamp(int, Calendar) Ravi Periasamy <ravitx12@yahoo.com>
@ 2007-01-05 17:32               ` Kris Jurka <books@ejurka.com>
  0 siblings, 0 replies; 10+ messages in thread

From: Kris Jurka @ 2007-01-05 17:32 UTC (permalink / raw)
  To: Ravi Periasamy <ravitx12@yahoo.com>; +Cc: Oliver Jowett <oliver@opencloud.com>; Dave Cramer <pg@fastcrypt.com>; pgsql-jdbc



On Fri, 5 Jan 2007, Ravi Periasamy wrote:

> We worked around this issue. I'm keen to pick up a
> official release of the JDBC driver with the fix, will
> there be one anytime soon?
>

I don't have any immediate plans for one as there are still a fair number 
of open issues that I'm dealing with.  If you'd like to test the fixes 
I've made you can pull them from CVS or try this jar file here:

http://ejurka.com/pgsql/jars/rp/

Kris Jurka



^ permalink  raw  reply  [nested|flat] 10+ messages in thread


end of thread, other threads:[~2007-01-05 17:32 UTC | newest]

Thread overview: 10+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-12-12 09:15 issues with Statement.getTimestamp(int, Calendar) Ravi Periasamy <ravitx12@yahoo.com>
2006-12-13 00:42 ` Oliver Jowett <oliver@opencloud.com>
2006-12-13 04:05   ` Ravi Periasamy <ravitx12@yahoo.com>
2006-12-13 11:38     ` Dave Cramer <pg@fastcrypt.com>
2006-12-13 11:47       ` Ravi Periasamy <ravitx12@yahoo.com>
2006-12-13 12:28         ` Oliver Jowett <oliver@opencloud.com>
2006-12-13 13:58           ` Dave Cramer <pg@fastcrypt.com>
2007-01-04 21:59           ` Kris Jurka <books@ejurka.com>
2007-01-05 14:48             ` Ravi Periasamy <ravitx12@yahoo.com>
2007-01-05 17:32               ` Kris Jurka <books@ejurka.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox