Subject Re: [firebird-php] How get firebird error code
Author Almond
At 17:37 03/10/29 +0000, you wrote:
> > Does anybody know how can I retrieve the error code returned from
> > firebird server?
>
>Pinched from ADOdb :)
>
>function _handleerror()
>{
>$this->_errorMsg = ibase_errmsg();
>}
>
>function ErrorNo()
>{
>if (preg_match('/error code = ([\-0-9]*)/i',
>$this->_errorMsg,$arr)) return (integer) $arr[1];
>else return 0;
>}

Or use PEAR.

<?php
function handle_pear_errors($error) {
echo "<H2>An error occurred while trying to run your query.</H2><br>";
echo "Error message: " . $error->getMessage() . "<br>";
echo "A more detailed error description: <br> ";
echo $error->getDebugInfo() . "<br>";
}
require_once "DB.php" ;
PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'handle_pear_errors');

/*-------------------------------- Open DB
-------------------------------*/
ibase_timefmt("%y.%m.%d");
$DSN = "ibase://$db_user:$db_passwd@$db_server$db_name";
$DB_Connect = DB::connect($DSN);
if (DB::isError($DB_Connect)) { die ($DB_Connect->getMessage()); }
?>


>--
>Lester Caine
>-----------------------------
>L.S.Caine Electronic Services
>
>
>Yahoo! Groups Sponsor
>ADVERTISEMENT
><http://rd.yahoo.com/M=243273.4089246.5300282.1261774/D=egroupweb/S=1705007183:HM/A=1750744/R=0/SIG=129iuvn04/*http://servedby.advertising.com/click/site=552006/bnum=1067449109340260>5fa203c.jpg<http://rd.yahoo.com/M=243273.4089246.5300282.1261774/D=egroupweb/S=1705007183:HM/A=1750744/R=0/SIG=129iuvn04/*http://servedby.advertising.com/click/site=552006/bnum=1067449109340260>
>
>5fa208c.jpg
>
>To unsubscribe from this group, send an email to:
>firebird-php-unsubscribe@yahoogroups.com
>
>
>
>Your use of Yahoo! Groups is subject to the
><http://docs.yahoo.com/info/terms/>Yahoo! Terms of Service.


[Non-text portions of this message have been removed]