473,811 Members | 3,300 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

libpq API for PQcmdTuples()

-----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(PQcmdT uples()) 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: di***@roedu.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)

iD8DBQFAQ6ybPZz OzrZY/1QRAp8TAJ9DM2g0 dsWtRGAhh7/lNRDssX/A9wCgn7Zd
CXgCGtPx+Z8Fr+w IaQbPMC0=
=m369
-----END PGP SIGNATURE-----

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

Nov 23 '05 #1
2 2589
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(PQcmdT uples()) 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
pg***@candle.ph a.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

Nov 23 '05 #2
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Wed, 3 Mar 2004, Bruce Momjian wrote:
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: di***@roedu.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)

iD8DBQFARymlPZz OzrZY/1QRAiLwAJ4pL8Tk FisF/W97/fABfqyVBQQWdwCf SrFU
QPhQwizZQSx08iT +POG1tMY=
=L1PG
-----END PGP SIGNATURE-----

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

Nov 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1393
by: Marco Vezzoli | last post by:
Hi all, I'm using solaris 8 gcc 3.0.1 postgres 7.3.4 psycopg 1.1.2 apache 1.3.19 python 2.1.1 mod_python 2.7.8 compiled with DSO
1
5707
by: Phil Campaigne | last post by:
Hi All, Took a break from developing on pgsql 7.3 to set up network printing where I added another host(localhost 193.168.1.2) in red hat network settings. Later, I could start postmaster but when I started psql I got the following error when I issue this command: psql -h localhost -U postgres nba -bash-2.05b$ psql -h localhost -U postgres nba psql: error while loading shared libraries: libpq.so.3: cannot open
175
11529
by: Sai Hertz And Control Systems | last post by:
Dear all, Their was a huge rore about MySQL recently for something in java functions now theirs one more http://www.mysql.com/doc/en/News-5.0.x.html Does this concern anyone. What I think is PostgreSQL would have less USP's (Uniqe Selling Points
2
2402
by: Jim Crate | last post by:
I'm trying to build a client program to access a database using the libpq interface on MacOS X 10.3.3 using CodeWarrior 9. PostgreSQL is at version 7.4.2. It compiles ok, but I get a link error. I have linked to libpq.a, because I got different errors before I did that. Here is the error I'm getting right now: Link Error: undefined: '@_1' (code) Referenced from 'pqSetenvPoll' in libpq.a Referenced from 'pqSetenvPoll' in libpq.a
2
2272
by: Adam Smith | last post by:
Installation of 7.4.2, even with just ./configure : gmake step ==> _________________________________________________ gmake: Leaving directory `/usr/home/smith/Temp_holding/staging-area/postgresql/postgresql-7.4.2/src/backend/parser' gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes -Wmissing-declarations pg_dump.o common.o pg_backup_archiver.o pg_backup_db.o pg_backup_custom.o pg_backup_files.o pg_backup_null.o
2
2383
by: alltest1 | last post by:
Hi, I am wondering if it is thread-safe to use both JDBC and libpq simultaneously. On a Linux, JDBC is used by Tomcat and libpq is used by a client software written in C language. So JDBC and libpq are used by two different programs. If the same row in the same table is updated (update SQL command) through libpq and
1
2346
by: Otto Blomqvist | last post by:
Hello ! I'm in dire need of a compiled libpq.dll with ssl support for win32. I don't know how do complile it myself. (My guess is it requires at least a couple Magic tricks) Thanks a lot /Otto Blomqvist Secom International, Los Angeles CA
15
2519
by: Dino Vliet | last post by:
Hi folks, probably this is a question you've heard so many times but I wasn't able to find a solution to it. I'm using a shell script to create a textfile for me. It looks like #!/usr/local/bin/bash psql -c "select foo from bar;" -d database1 -t psql -c "\q" -d database1 exit 0
4
1607
by: Wayne Fang | last post by:
Hi, For various reasons (parallel structure with existing code, commonality of concepts, etc), we have C language functions implemented that use libpq to make a new connection to the same Postgres server. Yes, I realize libpq is meant for clients and SPI for backends. The question is, are there any technical problems with this? Will using libpq in the backend do Bad Things in unexpected areas/ways? The environment ranges from: Postgres...
0
9734
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9607
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10652
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10395
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10408
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9211
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7673
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5700
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3874
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.