Re: [INTERFACES] [libpq] Return value of int

Поиск
Список
Период
Сортировка
От D'Arcy" "J.M." Cain
Тема Re: [INTERFACES] [libpq] Return value of int
Дата
Msg-id m10e211-0000bIC@druid.net
обсуждение исходный текст
Ответ на Re: [INTERFACES] [libpq] Return value of int  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Field types (was Re: Return value of int)  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-interfaces
Thus spake Tom Lane
> Henk Jan Barendregt <henkjan@barendregt.xs4all.nl> writes:
> > How can i use libpq to return an int value when i access an INT or INT4
> > value
> 
> Use atoi() ... what comes out of libpq is a character string always.
> It's up to you to convert it to whatever form you want it in.

Regarding this, it would be nice if libpq had some official, documented
way of determining the type of the field.  Currently I deal with this
in PyGreSQL by stealing some #defines from src/include/catalog/pg_type.h,
something that isn't normally available to application programmers.  In
fact, maybe we just have to move those #defines into postgres.h or
something that is in the public include directory.

Just thinking out loud.

-- 
D'Arcy J.M. Cain <darcy@{druid|vex}.net>   |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 424 2871     (DoD#0082)    (eNTP)   |  what's for dinner.


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

Предыдущее
От: barreiro@arrakis.es
Дата:
Сообщение: Error linking C++ code.
Следующее
От: Tom Lane
Дата:
Сообщение: Field types (was Re: Return value of int)