Skip site navigation (1) Skip section navigation (2)

How to retrieve how many rows are affected after doing an INSERT statement

From: jing han <jing_han_66(at)yahoo(dot)com>
To: pgsql-interfaces(at)postgresql(dot)org
Subject: How to retrieve how many rows are affected after doing an INSERT statement
Date: 2005-04-12 15:41:24
Message-ID: 20050412154124.83434.qmail@web53502.mail.yahoo.com (view raw or flat)
Thread:
Lists: pgsql-interfaces
Hello,

When we use PostgreSQL with Perl, we can retrieve
Error messages from database handler, say, if my
database handler is presented as $dbh, then I use
$dbh->errstr() can get error message like:

ERROR: Cannot insert a duplicate key into unique index
a_dbtable_pkey.

Is there a way to retriever from $dbh how many rows
are affected after doing an insert statement, and how
to present this? 

I tried $dbh->rowcount(), it doesn't work, So what's
the exact expression?

Any help will be appreciated.


jing 


		
__________________________________ 
Yahoo! Mail Mobile 
Take Yahoo! Mail with you! Check email on your mobile phone. 
http://mobile.yahoo.com/learn/mail 

Responses

pgsql-interfaces by date

Next:From: Michael FuhrDate: 2005-04-12 15:56:40
Subject: Re: How to retrieve how many rows are affected after doing an INSERT statement
Previous:From: mpsDate: 2005-04-11 22:34:39
Subject: Re: pg.py under Mac OS X

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group