Re: Understanding PGInterval

Поиск
Список
Период
Сортировка
От Kris Jurka
Тема Re: Understanding PGInterval
Дата
Msg-id Pine.BSO.4.64.0903220010250.17095@leary.csoft.net
обсуждение исходный текст
Ответ на Understanding PGInterval  ("r.trommer@open-factory.org" <r.trommer@googlemail.com>)
Список pgsql-jdbc

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

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: "r.trommer@open-factory.org"
Дата:
Сообщение: Understanding PGInterval
Следующее
От: Maciek Sakrejda
Дата:
Сообщение: Test suite failures?