Re: Getting oid with libpq

Поиск
Список
Период
Сортировка
От jtv@xs4all.nl
Тема Re: Getting oid with libpq
Дата
Msg-id 22138.203.170.164.130.1123914002.squirrel@203.170.164.130
обсуждение исходный текст
Ответ на Re: Getting oid with libpq  ("Johan C. de Koning" <johan.de.koning@geodan.nl>)
Список pgsql-interfaces
> I tried to use atol but i get always 0 as result. Is this because I use a
> binary cursor to select the data (there are some PostGIS datatypes inside
> my resultset which are binary data).

That changes everything.

With a binary cursor you get all data in a binary format which "I'm sure
is documented somewhere."  I believe in the case of oids it's a 32-bit
integer in network (big-endian) byte order.  If that is indeed the case,
you should be able to read the oid as "ntohl(*(uint32_t
*)PQgetValue(...))".

On a side note, I don't think you actually need a binary cursor to
transfer binary data (apart from the fact that it's likely to improve
performance).


Jeroen




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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: [BUGS] BUG #1815: ECPGdebug causes crash on Windows XP
Следующее
От: Michael Fuhr
Дата:
Сообщение: Re: [HACKERS] ECPG ignores SAVEPOINT if first statement of a transaction