From: Greg Sabino Mullane <greg@turnstep.com>
To: pgsql-interfaces@postgresql.org
Subject: Re: How to retrieve how many rows are affected after doing an INSERT statement
Date: Wed, 13 Apr 2005 02:00:34 -0000
Message-ID: <efaafe2b936b90461940846fd5268fbf@biglumber.com> (raw)
In-Reply-To: <20050412154124.83434.qmail@web53502.mail.yahoo.com>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
> Is there a way to retriever from $dbh how many rows
> are affected after doing an insert statement, and how
> to present this?
You can grab it directly from the execute, or use the rows() method:
$sth = $dbh->prepare("INSERT INTO mytable SELECT * FROM mytable");
$count = $sth->execute();
print "Count is $count\n";
$count = $sth->rows;
print "Count is still $count\n";
- --
Greg Sabino Mullane greg@turnstep.com
PGP Key: 0x14964AC8 200504122200
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
-----BEGIN PGP SIGNATURE-----
iD8DBQFCXH1TvJuQZxSWSsgRAtmzAKDWF3HFWNDl0ITAB/vJkdSSBjW2nACfWqXA
vqi47yulZB40WF7w6WuibeQ=
=QI53
-----END PGP SIGNATURE-----
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-interfaces@postgresql.org
Cc: greg@turnstep.com
Subject: Re: How to retrieve how many rows are affected after doing an INSERT statement
In-Reply-To: <efaafe2b936b90461940846fd5268fbf@biglumber.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox