Re: [HACKERS] libpq++ doc error? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [HACKERS] libpq++ doc error?
Date
Msg-id 13509.939219017@sss.pgh.pa.us
Whole thread Raw
In response to libpq++ doc error?  (Vince Vielhaber <vev@michvhf.com>)
Responses Re: [HACKERS] libpq++ doc error?  (Vince Vielhaber <vev@michvhf.com>)
List pgsql-hackers
Vince Vielhaber <vev@michvhf.com> writes:
> I just sent patches for libpq++ to return an int (I'll also submit changes
> to the sgml docs) and return a -1 if PQcmdTuples() returns a NULL pointer.
> I just haven't been able to convince it to return a NULL.

It won't.  If you look at the source, it's quite clear that it never
returns NULL.  It will return an empty string ("") if it notices a
problem.

Also, if you wanted to be really paranoid you'd check that what it
returns actually looks like it is a number, because PQcmdTuples doesn't
check that there is a number in the right spot in the command status
returned by the backend.

These two points together are why I suggested testing for an initial
digit...
        regards, tom lane


pgsql-hackers by date:

Previous
From: Thomas Lockhart
Date:
Subject: psql and comments
Next
From: Vince Vielhaber
Date:
Subject: Re: [HACKERS] Re: [GENERAL] Re: [PHP3] Re: PostgreSQL vs Mysql comparison