X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5386A5339B for ; Tue, 12 Apr 2005 12:42:10 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 38730-01 for ; Tue, 12 Apr 2005 15:41:33 +0000 (GMT) Received: from web53502.mail.yahoo.com (web53502.mail.yahoo.com [206.190.37.63]) by svr1.postgresql.org (Postfix) with SMTP id BAF7D53375 for ; Tue, 12 Apr 2005 12:41:26 -0300 (ADT) Received: (qmail 83437 invoked by uid 60001); 12 Apr 2005 15:41:24 -0000 Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; b=owyYOJDJVpbdXnpfMhB4RHgeRg1WHWnrVjrqdo5MQD3JXcOUAw/AOeAVzyukdGNJ1TN8+eQHnSQKk54oZiWjSB04U20RkeBOv0lo+xG4S5OO3OAXbAGhoFeDhP7OBcODMEw9vMxon3IydDXS/EMf/yNqCDzTBYvYgJC9UrT3vvQ= ; Message-ID: <20050412154124.83434.qmail@web53502.mail.yahoo.com> Received: from [209.87.238.132] by web53502.mail.yahoo.com via HTTP; Tue, 12 Apr 2005 08:41:24 PDT Date: Tue, 12 Apr 2005 08:41:24 -0700 (PDT) From: jing han Subject: How to retrieve how many rows are affected after doing an INSERT statement To: pgsql-interfaces@postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.251 tagged_above=0 required=5 tests=DNS_FROM_RFC_ABUSE, FROM_ENDS_IN_NUMS, FROM_HAS_ULINE_NUMS X-Spam-Level: * X-Archive-Number: 200504/53 X-Sequence-Number: 5469 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