Re: Interval support for Postgres - Mailing list pgsql-jdbc

From Oliver Siegmar
Subject Re: Interval support for Postgres
Date
Msg-id 200504221301.49710.o.siegmar@vitrado.de
Whole thread Raw
In response to Re: Interval support for Postgres  (Kris Jurka <books@ejurka.com>)
List pgsql-jdbc
Hi Kris,

On Thursday 21 April 2005 23:00, Kris Jurka wrote:
> 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?

Working with floating points is more difficult because of the requirements of
Calendar's roll() - but see the new patch, it uses double for seconds (and
microseconds).

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

Right, fixed.

> 3) In general the whole "before" API is confusing.  Do you have any better
> ideas on how to handle this?

Yes, done.

>   a) Note getValue() returns the wrong value if hours == 0 and minutes < 0.

Right, fixed.

>   b) Doesn't clone() need to copy the before setting?

No, because it was only used to initialize the values - "before" is dropped
anyway.

>   c) After a setValue() if someone does setYear() don't they need to
>      know the before setting (which is protected).

I thought these setters only for internal use (they all were protected). Now
they're public and "before" has gone.



Take a look at the new patch, I'm sure you'll find tons of things you don't
like... ;-)



Oliver

Attachment

pgsql-jdbc by date:

Previous
From: Palle Girgensohn
Date:
Subject: Threading problem
Next
From: Dave Cramer
Date:
Subject: Re: Threading problem