Re: Proper error handling with DB_DataObject

From: Date: Fri, 30 Dec 2005 10:51:25 +0000
Subject: Re: Proper error handling with DB_DataObject
References: 1 2 3  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-22381@lists.php.net to get a copy of this message
Markus Fischer wrote:
For example, I'm in a remote called service and this method gets called: [...] function doSomething($aData) { require_once 'Other/Framework.php'; require 'Other/Framework/DataObjectGlobalConfig.php'; $oTable =& DB_DataObject::factory('table'); # first place where to check for errors if (PEAR::isError( $oTable )) {
    return new RpcError($oTable->getMessage());
} $oTable->someCol1 = $data[0]; $oTable->someCol2 = $data[1]; $oTable->someCol3 = $data[2]; $oTable->find(true); # how to properly check for any errors here now? # call a handler somewhere else?! } [...]
Another thing I wondered: when I need to send a raw query (e.g. to manually update a mysql timestamp), how can I find out whether the query was successful or not? The documentation says it doesn't return a value (void). OTOH, the update() method at least returns false when an error occured. How can I check for an error condition in this case? thanks, - Markus

« previous php.pear.general (#22381) next »