Subject | Re: [firebird-php] How to capture exceptions? |
---|---|
Author | Jochem Maas |
Post date | 2005-05-25T23:26:21Z |
Thomas Beckmann wrote:
http://iamjochem.com/fbird.php.db.zip
you will 'need' to do/realise/engage the following:
1. change a couple of require_once statements to 'match'
whatever include_path you may or may not be using.
2. READ THE CODE. it's not a lot.
3. realise that some of the functionality present is specific
to further data abstraction layers I have - the functionality is
non-invasive - but means a few unused lines of code are being parsed,
actually the hooks are quite easy to use.
4. don't underestimate the power inherent in the DB::query()
function (in terms of the way you can pass args).
5. there are instructions at the top of DB.class.php on
creating a 'DBConfig' Class (which is nothing more than defining
a few class constants in a class named DBConfig)
6. I am not the author, I'm just the guy who has been refining,testing
& using the code for almost as long as the
php5 implementation of the ibase extension has been running
(around php5 beta3).
7. I might have missed a few dependencies which are only relevant to my own
code - at most undefined constants, which are easy to fix.
8. I never use the Blob class. that said its very simple so shouldn't
be a problem.
9. all your code should really occur inside a main try/catch block (atleast).
10. I only use firebird1.5, (1.0 might not behave the same with regard to
firebird exceptions).
11. if you end up using it you'll probably want to change the DB::conn()
implementation - something I keep meaning to do myself.
12. have fun, questions welcome :-)
13. unlucky for some. I discussed making this code and other stuff written
by Ard and myself GPL/OS or whatever and he was into it... I just haven't
got round to doing anything much about.
14. this might be a silly list.
> Hi Jochem,ok :-)
>
> thank you for your almost immediate response!
>
>
>>I can't get "select 1/0 from rdb$database;" to cause an exception.
>>given that you used double quotes the $ should have been backslashed,
>>also the semi-colon is not needed.
>
> Of course, I did "ibase_query('select 1/0 from rdb$database');"...
>
>you (and anyone else) can download my current version here:
>>I can get this to work (i.e. trap the exception in php)....
>>I have the following inside a custom DB class (written by the
>>guy who [re]wrote the firebird extension!)
>
> Ok, where can I get this class :-)...
>
http://iamjochem.com/fbird.php.db.zip
you will 'need' to do/realise/engage the following:
1. change a couple of require_once statements to 'match'
whatever include_path you may or may not be using.
2. READ THE CODE. it's not a lot.
3. realise that some of the functionality present is specific
to further data abstraction layers I have - the functionality is
non-invasive - but means a few unused lines of code are being parsed,
actually the hooks are quite easy to use.
4. don't underestimate the power inherent in the DB::query()
function (in terms of the way you can pass args).
5. there are instructions at the top of DB.class.php on
creating a 'DBConfig' Class (which is nothing more than defining
a few class constants in a class named DBConfig)
6. I am not the author, I'm just the guy who has been refining,testing
& using the code for almost as long as the
php5 implementation of the ibase extension has been running
(around php5 beta3).
7. I might have missed a few dependencies which are only relevant to my own
code - at most undefined constants, which are easy to fix.
8. I never use the Blob class. that said its very simple so shouldn't
be a problem.
9. all your code should really occur inside a main try/catch block (atleast).
10. I only use firebird1.5, (1.0 might not behave the same with regard to
firebird exceptions).
11. if you end up using it you'll probably want to change the DB::conn()
implementation - something I keep meaning to do myself.
12. have fun, questions welcome :-)
13. unlucky for some. I discussed making this code and other stuff written
by Ard and myself GPL/OS or whatever and he was into it... I just haven't
got round to doing anything much about.
14. this might be a silly list.
>thats a lie. there is almost zero dependency. (only the Exception classes)
> Hm, the main difference between the code you showed me and mine was that
> I checked the result against being empty, not "is_resource" - but
> actually, this makes no difference in my testsuite - conclusion: I need
> the class you mention :-)...
>
>
>>NOTE:
>>none of the code aboves works as is (your missing about 25,000 lines which make up
>>the framework within which it runs!) but you should be able to figure it out
>>... you are among the firebird/php elite ;-)indeed.
>
> Well, I did WAMP/LAMP for more than 10 years... during the last years
> firebird/Delphi got into my focus - of course you know what would
> happen: I miss too many firebird features to continue with MySQL in my
> web projects...