Question regarding string returned from PQgetvalue

From: Louis Bouchard <louisjbouchard(at)charter(dot)net>
To: pgsql-novice(at)postgresql(dot)org
Subject: Question regarding string returned from PQgetvalue
Date: 2004-11-01 11:29:23
Message-ID: 41861E13.9000009@charter.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)charter(dot)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

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2004-11-01 15:38:49 Re: Question regarding string returned from PQgetvalue
Previous Message Markus Bertheau 2004-11-01 07:46:57 Re: moving from MySQL to Postgres