Subject | Re: [firebird-php] How to capture exceptions? |
---|---|
Author | Milan Babuskov |
Post date | 2005-05-25T22:18:30Z |
Thomas Beckmann wrote:
records. The reason is that the expresion isn't calculated until you try to fetch.
The main problem is the way PHP handles stuff. There is apparently no way to
determine the error while fetching data. ibase_fetch_object() return FALSE,
but it also returns FALSE when there are no more records.
I have seen this before. Try connecting with wrong character set and select
some data. You will see translation warning (if error_reporting allows) but
ibase_fetch_row() would return FALSE, and you'll be missing other records,
that might be available.
All this is problem that should be solved better in PHP. I believe that you
can install a custom error handler for these warnings, but it is really an
overkill to have to do so for simple scripts.
ibase_errmsg(). I tried on PHP 4.3.4. The script you wrote above is isql
script, not PHP one. You should do something like:
$res = ibase_query('execute procedure e_test_ex');
if (!$res)
echo ibase_errmsg();
--
Milan Babuskov
http://fbexport.sourceforge.net
http://www.flamerobin.org
> The problem is that firebird exceptions (as raised by "select 1/0 fromThis does raise an error. Not on prepare, but when you try to fetch the
> rdb$database;"
records. The reason is that the expresion isn't calculated until you try to fetch.
The main problem is the way PHP handles stuff. There is apparently no way to
determine the error while fetching data. ibase_fetch_object() return FALSE,
but it also returns FALSE when there are no more records.
I have seen this before. Try connecting with wrong character set and select
some data. You will see translation warning (if error_reporting allows) but
ibase_fetch_row() would return FALSE, and you'll be missing other records,
that might be available.
All this is problem that should be solved better in PHP. I believe that you
can install a custom error handler for these warnings, but it is really an
overkill to have to do so for simple scripts.
> create exception E_TEST_EX 'Puff';I don't see this. I get the error and correct error message with
> set term ^ ;
> create procedure P_TEST_EX as begin exception E_TEST_EX; end ^
> set term ; ^
> execute procedure P_TEST_EX;
> are silently ignored by PHP.
ibase_errmsg(). I tried on PHP 4.3.4. The script you wrote above is isql
script, not PHP one. You should do something like:
$res = ibase_query('execute procedure e_test_ex');
if (!$res)
echo ibase_errmsg();
--
Milan Babuskov
http://fbexport.sourceforge.net
http://www.flamerobin.org