Home > Archive > PostgreSQL JDBC > April 2005 > Re: Interval support for Postgres









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Interval support for Postgres
Kris Jurka

2005-04-21, 1:24 pm



On Thu, 21 Apr 2005, Oliver Siegmar wrote:

> here's a patch that adds functionality to the PGInterval class. I'd be happy
> to see this in upstream.


You cannot use regex code in this class because it must compile with 1.2
and 1.3 JDKs.

Kris Jurka

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Oliver Siegmar

2005-04-21, 8:24 pm

On Thursday 21 April 2005 20:32, Kris Jurka wrote:
> On Thu, 21 Apr 2005, Oliver Siegmar wrote:
>
> You cannot use regex code in this class because it must compile with 1.2
> and 1.3 JDKs.


Can it be placed in the JDBC3 package, then? This requires JDK 1.4 anyway,
right?


Oliver

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Kris Jurka

2005-04-21, 8:24 pm



On Thu, 21 Apr 2005, Oliver Siegmar wrote:

> Well, actually there is almost no implementation at all. Parsing strings in
> Java in 2005 is a royal pain in the XXX - doing that for 0.x% users suck even
> more.


Well, just be thankful the 8.0 release finally dropped JDK 1.1 support.

> Let's assume I'd write a JDBC2 version with old-school string parsing - would
> you apply it to upstream, or are there any other show stoppers?
>


We definitely want something better for PGInterval. I do have some
questions about the implementation you've got.

1) You have an "int milliseconds" field. PG supports microsecond
precision in intervals. Is there any reason not to go with a plain "float
seconds" field instead of splitting these up?

2) getValue() calls nf.format(Math.abs(milliseconds)), if milliseconds is
2 won't the NumberFormat(ter) turn that into .02 ?

3) In general the whole "before" API is confusing. Do you have any better
ideas on how to handle this?
a) Note getValue() returns the wrong value if hours == 0 and minutes < 0.
b) Doesn't clone() need to copy the before setting?
c) After a setValue() if someone does setYear() don't they need to
know the before setting (which is protected).


Kris Jurka


---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com