Re: isError Error?
| From: | Colin Viebrock | Date: | Fri, 04 May 2001 21:33:29 +0000 |
| Subject: | Re: isError Error? | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-120@lists.php.net to get a copy of this message | ||
> $myResult=$myDBConnection->query("SELECT * FROM ....");
> if($myResult->isError()){
> /// then fail
> }
>
> But this doesn't seem to work. Why would I need to call DB::isError()
> to see if I have an error. Why doesn't DB_common extend DB so my
> DB_mysql object can have direct access to isError without having to
> refernce DB?
DB is just a static class that creates other classes (DB_mysql, etc.) ...
and those classes extend DB_common.
In your case, $myResult is either a DB_Error or a DB_Result. What you are
asking is for these to be added:
class DB_Error {
...
function isError() {
return true;
}
}
And:
class DB_Result {
...
function isError() {
return false;
}
}
Which is kinda redundant.
Besides "if($myResult->isError()){" and "if(DB::isError($myResult)){" are
only 2 characters different in length. :)
- Colin