dbTalk Databases Forums  

libpq API for PQcmdTuples()

comp.databases.postgresql.general comp.databases.postgresql.general


Discuss libpq API for PQcmdTuples() in the comp.databases.postgresql.general forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Mihai RUSU
 
Posts: n/a

Default libpq API for PQcmdTuples() - 03-01-2004 , 03:35 PM






-----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).

Thanks!

- --
Mihai RUSU Email: dizzy (AT) roedu (DOT) net
GPG : http://dizzy.roedu.net/dizzy-gpg.txt WWW: http://dizzy.roedu.net
"Linux is obsolete" -- AST
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFAQ6ybPZzOzrZY/1QRAp8TAJ9DM2g0dsWtRGAhh7/lNRDssX/A9wCgn7Zd
CXgCGtPx+Z8Fr+wIaQbPMC0=
=m369
-----END PGP SIGNATURE-----

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster


Reply With Quote
  #2  
Old   
Bruce Momjian
 
Posts: n/a

Default Re: libpq API for PQcmdTuples() - 03-03-2004 , 01:40 PM






Mihai RUSU wrote:
[ PGP not available, raw data follows ]
Quote:
-----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.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend



Reply With Quote
  #3  
Old   
Mihai RUSU
 
Posts: n/a

Default Re: libpq API for PQcmdTuples() - 03-04-2004 , 07:05 AM



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Wed, 3 Mar 2004, Bruce Momjian wrote:

Quote:
I think the reason it is a string is mostly historical. You should be
find just converting it to an int.
Ok thanks! However, its pretty dumb because probably libpq internally does
the int -> str conversion and then I do the reverse... A new libpq
function returning the numerical value would be nice

- --
Mihai RUSU Email: dizzy (AT) roedu (DOT) net
GPG : http://dizzy.roedu.net/dizzy-gpg.txt WWW: http://dizzy.roedu.net
"Linux is obsolete" -- AST
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFARymlPZzOzrZY/1QRAiLwAJ4pL8TkFisF/W97/fABfqyVBQQWdwCfSrFU
QPhQwizZQSx08iT+POG1tMY=
=L1PG
-----END PGP SIGNATURE-----

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.