X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6003F53AD2 for ; Thu, 21 Apr 2005 18:07:07 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 98382-09 for ; Thu, 21 Apr 2005 21:03:57 +0000 (GMT) Received: from mail63.csoft.net (leary3.csoft.net [63.111.22.74]) by svr1.postgresql.org (Postfix) with SMTP id 422FF53B46 for ; Thu, 21 Apr 2005 18:00:58 -0300 (ADT) Received: (qmail 9453 invoked by uid 1112); 21 Apr 2005 21:00:59 -0000 Date: Thu, 21 Apr 2005 16:00:59 -0500 (EST) From: Kris Jurka X-X-Sender: books@leary.csoft.net To: Oliver Siegmar Cc: pgsql-jdbc@postgresql.org Subject: Re: Interval support for Postgres In-Reply-To: <200504212202.32460.o.siegmar@vitrado.de> Message-ID: References: <200504211107.01028.o.siegmar@vitrado.de> <200504212137.23827.o.siegmar@vitrado.de> <200504212202.32460.o.siegmar@vitrado.de> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.012 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200504/117 X-Sequence-Number: 12724 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 ass - 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