Re: Timestamp with libpq

Поиск
Список
Период
Сортировка
От Jakob Lechner
Тема Re: Timestamp with libpq
Дата
Msg-id 1223901242.3502.54.camel@vie063.fabagl.fabasoft.com
обсуждение исходный текст
Ответ на Re: Timestamp with libpq  (Michael Meskes <meskes@postgresql.org>)
Ответы Re: Timestamp with libpq  (Michael Meskes <meskes@postgresql.org>)
Список pgsql-interfaces
Hi Michael,

Am Montag, den 13.10.2008, 12:46 +0200 schrieb Michael Meskes:

> Please keep in mind that there is no guarantee that your server sends a double
> in a binary query. This depens on whether integer-datatypes are configure or
> not. Or in other words, it might be a long long instead of a double.

Yes, you're right. The SLES postgres server transmits timestamps as long
long numbers (microseconds since 2000-01-01).

> Is there any reason to use a binary transfer?

If I use textual transfer I'm losing precision. E.g. for timestamps the
returned string from my table is "1955-06-08 00:00:00". Thus I'm
restricted to timestamps with a granularity of 1 second.

> I would not recommend this in a
> general setup. If you just want to avoid some ascii translation hassle, how
> about using ecpg instead of libpq?

The generic database interface I'm writing is part of a basic library
used in our project. The interface serves as an abstraction for
accessing different database servers (Postgres, MSSQL, ...). I'm
currently working on the postgres implementation of the interface.
As far as I've seen using ecpg means to hardcode SQL statements which of
course can't be done in a generic library.

Thanks for your helpful hints. But it's seems I don't have much choice
but to use ascii transfer mode.

Best regards
Jakob

--
Jakob Lechner
Research & Development
appl.strudl Software GmbH
Honauerstraße 4
A-4020 Linz
Tel.: [+43] (70) 60 61 62
Fax: [+43] (70) 60 61 62-609
E-Mail: jakob.lechner@applstrudl.com
Web: http://www.applstrudl.com
Handelsgericht Linz, FN 303988 t


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

Предыдущее
От: Michael Meskes
Дата:
Сообщение: Re: Timestamp with libpq
Следующее
От: Michael Meskes
Дата:
Сообщение: Re: Timestamp with libpq