|
Posted by petersprc on 11/24/07 10:19
Hi,
You can get more info using $err->getUserInfo().
PAER error handling can also be triggered without checking isError:
PHP 5:
function Php5PearErrorHandler($err)
{
$ui = $err->getUserInfo();
$str = $err->getMessage();
if ($ui != '') {
$str .= ' (' . $ui . ')';
}
throw new PEAR_Exception($str, $err->getCode());
}
PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'Php5PearErrorHandler');
PHP 4:
function Php4PearErrorHandler($err)
{
$ui = $err->getUserInfo();
$str = $err->getMessage();
if ($ui != '') {
$str .= ' (' . $ui . ')';
}
trigger_error($str, E_USER_ERROR);
}
PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'Php4PearErrorHandler');
On Nov 23, 2:04 pm, Rob Wilkerson <r.d.wilker...@gmail.com> wrote:
> Hey all -
>
> I'm bumping into an issue with my installation of the MDB2 package
> that I'm hoping someone else has seen. I'm trying to execute a query,
> but get an "unknown error" exception that I can't seem to track down
> (exact message is "MDB2 Error: unknown error").
>
> I have an ObjectDAO class (which I'm creating via a factory) that
> extends an abstract DataAccessObject class. The database connection
> is created in the parent class' constructor and a connection *is*
> being established. I just can't seem to query against it. Here's the
> code I'm trying to execute:
>
> =======================================================
>
> $dao = DAOFactory::createDAO ( 'Object' );
> $result = $dao->conn->query ( 'SELECT COUNT(1) FROM object' );
> if ( PEAR::isError ( $result ) ) {
> echo '<p>SQL Error</p>';
> throw new Exception ( $result->getMessage() );}
>
> new PHPDump ( $result->fetchRow() );
>
> exit();
>
> =======================================================
>
> A dump of the $dao variable indicates that all properties and members
> are public, as expected. Executing "./pear version" reveals:
>
> PEAR Version: 1.6.2
> PHP Version: 5.2.3
> Zend Engine Version: 2.2.0
>
> I've been fighting this all day and can't think of anything else to
> try, nor can I find any additional information via Google. If
> anyone's seen this, I'd really appreciate any insight.
>
> Thanks.
>
> Rob
Navigation:
[Reply to this message]
|