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