Re: DB: number of rows returned

From: 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,
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.
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....
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:
    // {{{ 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-

« previous php.pear (#442) next »