Re: PEAR DB - some suggested improvements
| From: | Tomas V.V.Cox | Date: | Sat, 27 Oct 2001 23:14:34 +0000 |
| Subject: | Re: PEAR DB - some suggested improvements | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-2418@lists.php.net to get a copy of this message | ||
John Lim wrote:
>
> Hello,
>
> While reviewing PEAR DB for a book I'm writing,
Oh yes? nice, please advice us when it get published :-)
> I found a few issues that can be improved in PEAR DB.
>
> 1. PEAR DB's error handling does not capture the error
> message, only the error number. I would suggest including
> the error message, because it often contains info specific
> to the error, such as in what column the SQL syntax error
> occurred.
In Pear DB we offer two kind of error messages, both accesible from the
Pear Error object:
$res = $db->query($sql);
if (DB::isError($res)) {
//Pear DB error
echo $res->getMessage();
//BackEnd native error plus the last query launched
echo $res->getDebugInfo();
}
> 2. The oci8 driver attempts to return the numRows() by
> changing the select statement to a select count(*). This
> will only work in a single-user or read-only environment.
> Better to accept defeat and just return -1.
This is not the default behavoir of the driver and by default it will
return a "not capable" error message. But if you really needed it you
can use it any way. What's the problem of the count() stuff?
> 3. The isManip() function will not work properly with some
> databases that allow stored procedures to return recordsets.
> I would suggest deprecating it.
Not all the drivers makes the use of this function, and perhaps is true
we should review those that use it and support stored procedures.
Thanks for the feedback.
Tomas V.V.Cox