Re: DB Exeptions and DataObject

From: Date: Mon, 11 Oct 2004 23:30:21 +0000
Subject: Re: DB Exeptions and DataObject
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-14860@lists.php.net to get a copy of this message
On Mon, 11 Oct 2004 16:45:56 +0200 (MEST), kundert@mysunrise.ch <kundert@mysunrise.ch> wrote: > Hi > > I'v got a big understanding problem with DataObject and Database Exceptions (e.g. > Unique Key violation, wrong atribute name and so on). If an exception raise after > calling ->find() because of an invalid SQL, no error will occoure, even in debug > mode not! > The method find() execute the folling statement: > $this-_query('SELECT ' . > $this-_query['data_select'] . > ' FROM ' . ($quoteIdentifiers ? $DB-quoteIdentifier($this-__table) : > $this-__table) . " " . $this-_join . > $this-_query['condition'] . ' '. > $this-_query['group_by'] . ' '. > $this-_query['having'] . ' '. > $this-_query['order_by'] . ' '. > > In case of an error, _query() returns an Pear Error object, but it goes to nowhere. > No error occoure, it looks like the query doesn't return a row, because there is no > data. How can I find out, if there was an SELECT error or the query returns no > error? > First of all, DB doesn't use Exceptions, it uses PEAR_Error for now. If DB_DataObject isn't handling that error condition maybe it should. But if you really want to see if there are any PEAR errors, set a callback at the beginning of your script. function handlePearError($err) { die($err->getMessage()."<br/>\n".$err->getUserInfo()); } PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'handlePearError'); -- paperCrane --Justin Patrin--

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