Re: libpq API for PQcmdTuples()

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Mihai RUSU <dizzy(at)roedu(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: libpq API for PQcmdTuples()
Date: 2004-03-03 19:40:15
Message-ID: 200403031940.i23JeFF21770@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Mihai RUSU wrote:
[ PGP not available, raw data follows ]
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi
>
> I was working recently on a mid-layer in my current projects for
> abstraction of SQL backends (curently for mysql and pgsql only) and found
> out that the libpq synonime of mysql_affected_rows is PQcmdTuples. However
> I really dont see why does it return char * ?? Is there any practical
> reason for this ?
>
> Curently I do (unsigned int)atoi(PQcmdTuples()) but I really dont feel
> very confortable with strings which might change their format at any time,
> not to mention the overhead to convert from str to int each time (and I
> dont expect to use this atoi rare heh).

I think the reason it is a string is mostly historical. You should be
find just converting it to an int.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bill Moran 2004-03-03 21:42:34 Shouldn't B'1' = 1::bit be true?
Previous Message Eric Davies 2004-03-03 19:34:13 gist index build produces corrupt result on first access to table.