Question regarding string returned from PQgetvalue

Поиск
Список
Период
Сортировка
От Louis Bouchard
Тема Question regarding string returned from PQgetvalue
Дата
Msg-id 41861E13.9000009@charter.net
обсуждение исходный текст
Ответы Re: Question regarding string returned from PQgetvalue
Список pgsql-novice
I run this query and put the result into a PGresult variable caller result:

SELECT COUNT(*) FROM driver WHERE driverID = :driverID

I then grab the value using PQgetvalue and put it into a string.

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"

When I put a record in the table with driverID of 1 and run the query
again, I get this value:

49 "1"

This tells me that the value is put into the string correctly but I am
getting extra information. Is there a way to get rid of this extra
information without having to parse the string?

Thank You

--
Louis J Bouchard
de KC2FNN
Rochester Minnesota USA
louisjbouchard@charter.net
--
"I wanted you to see what real courage is, instead of getting the idea that
courage is a man with a gun in hand. It's when you know you're licked before
you begin but you begin anyway and you see it through no matter what. You
rarely win, but sometimes you do."
-----------------------------
Atticus Finch            To Kill a Mockingbird


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

Предыдущее
От: Markus Bertheau
Дата:
Сообщение: Re: moving from MySQL to Postgres
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Question regarding string returned from PQgetvalue