ssb Sun Mar 25 02:34:31 2001 EDT Modified files: /php4/pear/DB ifx.php Log: * changed DB_ifx::errorCode to take a parameter, moved the error code map into the constructor Index: php4/pear/DB/ifx.php diff -u php4/pear/DB/ifx.php:1.2 php4/pear/DB/ifx.php:1.3 --- php4/pear/DB/ifx.php:1.2 Sat Mar 24 10:56:24 2001 +++ php4/pear/DB/ifx.php Sun Mar 25 02:34:31 2001 @@ -44,7 +44,18 @@ 'pconnect' => true, 'transactions' => false ); - $this->errorcode_map = array(); + $this->errorcode_map = array( + '-201' => DB_ERROR_SYNTAX, + '-206' => DB_ERROR_NOSUCHTABLE, + '-217' => DB_ERROR_NOSUCHFIELD, + '-329' => DB_ERROR_NODBSELECTED, + '-1204' => DB_ERROR_INVALID_DATE, + '-1205' => DB_ERROR_INVALID_DATE, + '-1206' => DB_ERROR_INVALID_DATE, + '-1209' => DB_ERROR_INVALID_DATE, + '-1210' => DB_ERROR_INVALID_DATE, + '-1212' => DB_ERROR_INVALID_DATE + ); } /** @@ -197,8 +208,8 @@ function ifxraiseError($errno = null) { - if ($errno == null) { - $errno = $this->errorCode(); + if ($errno === null) { + $errno = $this->errorCode(ifx_error()); } return $this->raiseError($errno, null, null, null, @@ -214,24 +225,12 @@ * implementation has no mapping for the given error code. */ - function errorCode() + function errorCode($nativecode) { - if (ereg('SQLCODE=(.*)]', ifx_error(), $match)) { + if (ereg('SQLCODE=(.*)]', $nativecode, $match)) { $code = $match[1]; - $codes = array( - '-201' => DB_ERROR_SYNTAX, - '-206' => DB_ERROR_NOSUCHTABLE, - '-217' => DB_ERROR_NOSUCHFIELD, - '-329' => DB_ERROR_NODBSELECTED, - '-1204' => DB_ERROR_INVALID_DATE, - '-1205' => DB_ERROR_INVALID_DATE, - '-1206' => DB_ERROR_INVALID_DATE, - '-1209' => DB_ERROR_INVALID_DATE, - '-1210' => DB_ERROR_INVALID_DATE, - '-1212' => DB_ERROR_INVALID_DATE - ); - if (isset($codes[$code])) { - return $codes[$code]; + if (isset($this->errorcode_map[$code])) { + return $this->errorcode_map[$code]; } } return DB_ERROR; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]