Re: Question regarding string returned from PQgetvalue

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Question regarding string returned from PQgetvalue
Дата
Msg-id 13929.1099323529@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Question regarding string returned from PQgetvalue  (Louis Bouchard <louisjbouchard@charter.net>)
Список pgsql-novice
Louis Bouchard <louisjbouchard@charter.net> writes:
> The query should return 0 because there are no records in the table as
> of yet. When I run the program however, the value returned is 48.
> I used GDB to look at what was in the string and I saw this information:
> 48 "0"

You seem to have a fundamental confusion between text strings and
machine integers.  PQgetvalue is going to return a pointer to a text
string.  Use strtol or atoi or some such to convert the string to
an integer.

            regards, tom lane

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

Предыдущее
От: Louis Bouchard
Дата:
Сообщение: Question regarding string returned from PQgetvalue
Следующее
От: Kumar S
Дата:
Сообщение: three table join