Re: MDB2 errors
| From: | Daniel Convissor | Date: | Tue, 03 Jul 2012 12:54:41 +0000 |
| Subject: | Re: MDB2 errors | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-31588@lists.php.net to get a copy of this message | ||
Hi Bernhard:
On Sun, Jul 01, 2012 at 09:57:02AM +0200, Bernhard wrote:
>
> i want to ask if PEAR::isError(connection) is correct, because the PEAR
> class has a method isError but it is not static.
Yeah, the existing MDB2 releases are not E_STRICT compliant. But the
version in SVN is! Plus it has loads of other bug fixes.
> Second, can you tell me if this cod is right:
What you have below is definitely not a fish. :) [Bad joke about "cod".]
> public static function find_all() {
> $req = $db->select("SELECT * FROM ".self::$table);
> if (MDB2::isError($req) == -18){
isError() is boolean.
if (MDB2::isError($req)){
Once you know $req is an error, you can then call $req->getCode() to get
the error code number. Then you should compare that against the
MDB2_ERROR_* constant, not the raw integer.
--Dan
--
T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
data intensive web and database programming
http://www.AnalysisAndSolutions.com/
4015 7th Ave #4, Brooklyn NY 11232 v: 718-854-0335