Re: Interval support for Postgres

From: Oliver Siegmar <o(dot)siegmar(at)vitrado(dot)de>
To: Kris Jurka <books(at)ejurka(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Interval support for Postgres
Date: 2005-04-22 11:01:49
Message-ID: 200504221301.49710.o.siegmar@vitrado.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
pgjdbc_interval2.diff.gz application/x-gzip 3.7 KB

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Dave Cramer 2005-04-22 11:29:42 Re: Threading problem
Previous Message Palle Girgensohn 2005-04-22 10:46:02 Threading problem