Re: DB: number of rows returned
| From: | Tobias Michaelsen | Date: | Tue, 14 Nov 2000 23:07:49 +0000 |
| Subject: | Re: DB: number of rows returned | ||
| References: | 1 2 3 | Groups: | php.pear |
| Request: | Send a blank email to php-pear+get-442@lists.php.net to get a copy of this message | ||
Thomas Fromm wrote:
Hi,Well, affectedRows() would also be nice to have in mysql.php (it is already on the 'TODO list'), but what I want is similar to the numCols()-function, so couldn't I propose a numRows()-function to be implemented in as many (if not all is possible) of the db-classes as possible? In mysql.php it would be like:thats not correct. OCIRowNum returns only the affected rows by an update/insert. its not returned the number of rows of an select statement. .... thats one of some points why the phplib abstraction isnt DB independent....mysql_num_rows ($res);It sounds like he is looking for a DB independent function that would do that (otherwise why even use PEAR DB). Under OCI8 (Oracle 8) implementation there is a method called affectedRows that returns number of resulting rows.
// {{{ numRows()
/**
* Get the number of rows in a result set.
*
* @param $result MySQL result identifier
*
* @access public
*
* @return int the number of rows in $result
*/
function numRows($result) {
$rows = mysql_num_rows($result);
if (!$rows) {
return $this->raiseError($this->errorCode(mysql_errno($this->connection)));
}
return $rows;
}
// }}}So we just need the rest!? -Tobias-