pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oliver Siegmar <o.siegmar@vitrado.de>
To: Kris Jurka <books@ejurka.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Interval support for Postgres
Date: Fri, 22 Apr 2005 13:01:49 +0200
Message-ID: <200504221301.49710.o.siegmar@vitrado.de> (raw)
In-Reply-To: <Pine.BSO.4.56.0504211551070.10463@leary.csoft.net>
References: <200504211107.01028.o.siegmar@vitrado.de>
	<200504212202.32460.o.siegmar@vitrado.de>
	<Pine.BSO.4.56.0504211551070.10463@leary.csoft.net>

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

Attachments:

  pgjdbc_interval2.diff.gz (application/x-gzip, 3.7K) download

view thread (18+ messages)  latest in thread

Message-ID: <200504221301.49710.o.siegmar@vitrado.de>
Permalink:  ../200504221301.49710.o.siegmar@vitrado.de/
Also on:    postgresql.org/message-id/200504221301.49710.o.siegmar@vitrado.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: o.siegmar@vitrado.de, books@ejurka.com
  Subject: Re: Interval support for Postgres
  In-Reply-To: <200504221301.49710.o.siegmar@vitrado.de>
  References: <200504211107.01028.o.siegmar@vitrado.de> <200504212202.32460.o.siegmar@vitrado.de> <Pine.BSO.4.56.0504211551070.10463@leary.csoft.net> <200504221301.49710.o.siegmar@vitrado.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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