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
Views: Raw Message | Whole Thread | Download mbox | Resend email
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

Browse pgsql-interfaces by date

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