From: Kris Jurka <books@ejurka.com>
To: r.trommer@open-factory.org <r.trommer@googlemail.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Understanding PGInterval
Date: Sun, 22 Mar 2009 00:12:46 -0400 (EDT)
Message-ID: <Pine.BSO.4.64.0903220010250.17095@leary.csoft.net> (raw)
In-Reply-To: <e25af22b-a772-4eaa-963e-0ca2897bb3bd@h28g2000yqd.googlegroups.com>
References: <e25af22b-a772-4eaa-963e-0ca2897bb3bd@h28g2000yqd.googlegroups.com>
On Sat, 21 Mar 2009, r.trommer@open-factory.org wrote:
> i try to understand how i can use the PGInterval Object. I have to
> solve a little issue in Java. I have created a SQL-statement which
> give me a resultset like this:
>
> id | duration
> 1 | 01:49:00
> 2 | 00:30:00
>
> The datetypes id = int and duration = PGInterval. I would like to sum
> the both duration values in Java. I can“t use a SQL sum because i need
> the results later to report some details.
>
The 8.3 driver series has an enhancement to PGInterval which supports
adding them together. So you can do interval1.add(interval2) to sum
things up. What it doesn't support is justifying the results, so in the
example you've shown above the total would be 1 hour, 79 minutes rather
than 2 hours and 19 minutes.
Kris Jurka
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: books@ejurka.com, r.trommer@googlemail.com
Subject: Re: Understanding PGInterval
In-Reply-To: <Pine.BSO.4.64.0903220010250.17095@leary.csoft.net>
References: <e25af22b-a772-4eaa-963e-0ca2897bb3bd@h28g2000yqd.googlegroups.com> <Pine.BSO.4.64.0903220010250.17095@leary.csoft.net>
* 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