Subject Re: [firebird-php] ibase_query and exceptions
Author Yves Glodt
On Tuesday 12 August 2008, Lester Caine wrote:
> Yves Glodt wrote:
> > Hello,
> >
> > I seem to have problems using exceptions:
> >
> > try {
> > $sth = call_user_func_array('ibase_query', array_merge(array($c(), $q),
> > $p)); } catch (Exception $e) {
> > echo 'Exception: '.$e->getMessage();
> > exit;
> > }
> >
> > This code never reaches the "catch" block, even I use an invalid SQL in
> > $q.
> >
> > Does anyone have experience in using exceptions with the ibase_*
> > functions?
>
> What exception would you expect to be returned?
> If there is a problem with the query, then the FUNCTION returns with an
> error code. It does not 'throw an exception'. You would have to create an
> exception from the error code to do this, but that is not how I would
> normally do it. I just handle the error returned.

I am aware that I can handle the error which the functions, but I would prefer
dealing with exceptions. As far as I understood, the ibase_* functions do not
raise any, so I guess I stick to boolean flags.

Regards,
Yves