Flickr widget

www.flickr.com
padamati's items Go to padamati's photostream

Friday, December 5, 2008

perl mySql number of rows returned by a query

$sqlQuery->rows is very useful to find the number of rows returned when you execute this query.
This can also be used in the exceptional condition checking where a query must select or delete some rows.

$sqlQuery = $dbh->prepare($sql)
or die "Can't prepare $query: $dbh->errstr\n";

$rv = $sqlQuery->execute
or die "can't execute the query: $sqlQuery->errstr";

$noOfRowsDeleted = $sqlQuery->rows;

No comments: