Re: numRows()
| From: | Tobias H. Michaelsen | Date: | Thu, 07 Dec 2000 22:19:41 +0000 |
| Subject: | Re: numRows() | ||
| References: | 1 | Groups: | php.pear |
| Request: | Send a blank email to php-pear+get-606@lists.php.net to get a copy of this message | ||
I wrote a similar message some weeks ago, but nothing has happened. There were
some responses, but not much, and nothing has been implemented.
Can anybody give a reason for not implementing this (only the numRows)?
There are no php functions for ibase and oci8, but could they not return a
DB_FUNCTION_NOT_IMPLEMENTED or something?
-Tobias-
-------- Original Message --------
Message-ID: <3A1BF69F.F7F57F3C@michaelsen.as>
Date: Wed, 22 Nov 2000 17:38:55 +0100
From: "Tobias H. Michaelsen" <tobias@michaelsen.as>
Newsgroups: php.pear
Subject: DB: numRows()
I realy nead a numRows() function to be implemented in the DB classes, so that
I can change some applications to begin using PEAR.
I don't think that it should be any problem -- I have implemented it in my
local files for most of the databases, and it is mostly just a copy of the
numCols() function. Only two databases didn't have an existing function ready
in php, according to the online manual.
Is there any reason that they should not be put in there ???
If not; would somebody with cvs-write privileges then please do it ???
This is what needs to be added:
<DB.php>
/* in class DB_result */
/**
* Get the the number of rows in a result set.
*
* @return int the number of rows, or a DB error code
*/
function numRows() {
return $this->dbh->numRows($this->result);
}
</DB.php>
<DB/mysql.php>
// {{{ 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;
}
// }}}
</DB/mysql.php>
<DB/pgsql.php>
function numRows($result) {
$rows = pg_numrows($result);
if (!$rows) {
return $this->raiseError();
}
return $rows;
}
</DB/pgsql.php>
<DB/odbc.php>
function numRows($result) {
$rows = odbs_num_rows($result);
if (!$rows) {
return $this->raiseError();
}
return $rows;
}
</DB/odbc.php>
<DB/msql.php>
function numRows($result) {
$rows = @msql_num_rows($result);
if (!$rows) {
return $this->raiseError();
}
return $rows;
}
</DB/msql.php>
<DB/mssql.php>
function numRows($result) {
$rows = @mssql_num_rows($result);
if (!$rows) {
return $this->raiseError();
}
return $rows;
}
</DB/mssql.php>
<DB/sybase.php>
function numRows($result) {
$rows = @sybase_num_rows($result);
if (!$rows) {
return $this->raiseError();
}
return $rows;
}
</DB/sybase.php>
<DB/ibase.php>
I don't know? There is no ibase_num_rows() in php at this moment.
<DB/oci8.php>
There is no OCINumRows() in php so far -- only a Ora_Numrows() from the
old set of Oracle functions.
Maybe functions for these two could be added, if we ask in news://php.db
???
-Tobias-