Thread: getting out boolean value from PQgetValue function

getting out boolean value from PQgetValue function

From
"Arunachalam Parthasarathy"
Date:
Hello all,
 
I am using pg advisory locks in my application using libpq. When lock is obtained, the result set contains boolean value for the row locked in result set.
 
When i iterate over the result set, i am unable to get the return boolean value in my code. The ptr returned by PQGetValue is valid, but contains nothing. why is it so?
 
do i need to use ntohl to convert / see the proper binary value?
 
Please reply me regarding this.
 
thanks a lot,
Arunachalam.

Re: getting out boolean value from PQgetValue function

From
Tom Lane
Date:
"Arunachalam Parthasarathy" <arunachalamamsam@gmail.com> writes:
> When i iterate over the result set, i am unable to get the return boolean
> value in my code. The ptr returned by PQGetValue is valid, but contains
> nothing. why is it so?

Did you check PQgetisnull()?  IIRC PQgetvalue() will return a
zero-length string for a null field.
        regards, tom lane