Question regarding string returned from PQgetvalue - Mailing list pgsql-novice

From Louis Bouchard
Subject Question regarding string returned from PQgetvalue
Date
Msg-id 41861E13.9000009@charter.net
Whole thread Raw
Responses Re: Question regarding string returned from PQgetvalue
List 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 by date:

Previous
From: Markus Bertheau
Date:
Subject: Re: moving from MySQL to Postgres
Next
From: Tom Lane
Date:
Subject: Re: Question regarding string returned from PQgetvalue