Re: C++: get value for integral types?

Поиск
Список
Период
Сортировка
От Tommi Maekitalo
Тема Re: C++: get value for integral types?
Дата
Msg-id 200211110853.01940.t.maekitalo@epgmbh.de
обсуждение исходный текст
Ответ на Re: C++: get value for integral types?  (Frank Miles <fpm@u.washington.edu>)
Ответы Re: C++: get value for integral types?  (Vassil Kriakov <vassilk@yahoo.com>)
Список pgsql-general
Hi,

it would be hard to interpret the binary value. I think it is not specified,
how a specific type is represented as a binary value. The programmers guide
just tells: "But if PQbinaryTuples() is 1, the value returned by PQgetvalue
is the binary representation of the type in the internal format of the
backend server". So its internal and platformspecific. It is even hard to get
usable type-information. The types are defined in a systemtable (pg_type).
But new types are created in some situations, when you just create a new
table.

I think the safest way to retrieve values in C++ is to convert the
stringrepresentation.

It might be helpful to define some api-functions to retrieve some integral
types (PGgetLong, PGgetDouble). The backendprocess knows better about
datatypes. What do you think?


Tommi

Am Sonntag, 10. November 2002 23:56 schrieb Frank Miles:
> On Sun, 10 Nov 2002, Vassil Kriakov wrote:
> > Does anyone know whether it is possible to get a tuple's value as an
> > int, float, bool, etc. using the C++ postgresql library?
> >
> > Getting floats as string representations (via char* GetValue(...)) of
> > the value is not acceptable! Using strings and streams to convert the
> > values to the corresponding integral type may cause problems!
> >
> > Any ideas, workarounds? Is BinaryTuples really not implemnted yet?
>
> Doesn't the C++ version work?  Have you DECLAREd a binary cursor and
> used FETCH to get the data?  (It works with libpq)
>
> HTH--
>
>     -frank
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)

--
Dr. Eckhardt + Partner GmbH
http://www.epgmbh.de

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

Предыдущее
От: Justin Clift
Дата:
Сообщение: Re: PostgreySQl.
Следующее
От: "scott.marlowe"
Дата:
Сообщение: Re: Hardware estimation