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

Поиск
Список
Период
Сортировка
От Greg Sabino Mullane
Тема Re: How to retrieve how many rows are affected after doing an INSERT statement
Дата
Msg-id efaafe2b936b90461940846fd5268fbf@biglumber.com
обсуждение исходный текст
Ответ на How to retrieve how many rows are affected after doing an INSERT statement  (jing han <jing_han_66@yahoo.com>)
Список pgsql-interfaces
-----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-----




В списке pgsql-interfaces по дате отправления:

Предыдущее
От: Michael Fuhr
Дата:
Сообщение: Re: How to retrieve how many rows are affected after doing an INSERT statement
Следующее
От: jing han
Дата:
Сообщение: questions about transaction and rollback