Re: [HACKERS] libpq++ doc error?

From: Vince Vielhaber <vev(at)michvhf(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] libpq++ doc error?
Date: 1999-10-06 14:52:34
Message-ID: Pine.BSF.4.05.9910061040590.11236-100000@paprika.michvhf.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, 6 Oct 1999, Tom Lane wrote:

> Vince Vielhaber <vev(at)michvhf(dot)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...

Ok, I'm looking for an empty string now and that will return a -1. The
other return possibilities *should* be handled correctly by atoi() since
it doesn't care if there's any leading blanks/spaces, as long as it's
not a non-numeric non-space character. If it's going to get that crazy
with differing possibilities then we'd be further ahead to fix it in
either the backend or in libpq (by adding a new function and letting
this one fade away). Is there an atoi() out there that would not return
a 123 if passed the string " 123 " ?? It does the right thing in
hpux8 and in FreeBSD 3.2.

Vince.
--
==========================================================================
Vince Vielhaber -- KA8CSH email: vev(at)michvhf(dot)com flame-mail: /dev/null
# include <std/disclaimers.h> Have you seen http://www.pop4.net?
Online Campground Directory http://www.camping-usa.com
Online Giftshop Superstore http://www.cloudninegifts.com
==========================================================================

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Don Baccus 1999-10-06 15:11:49 Re: [HACKERS] Re: [GENERAL] Re: [PHP3] Re: PostgreSQL vs Mysql comparison
Previous Message Bruce Momjian 1999-10-06 14:39:18 Re: [HACKERS] Re: [GENERAL] Re: [PHP3] Re: PostgreSQL vs Mysql comparison