prepare psql error message
| From: | Som Gábor Imre | Date: | Thu, 03 Jul 2003 13:13:39 +0000 |
| Subject: | prepare psql error message | ||
| Groups: | php.pear.webmaster | ||
| Request: | Send a blank email to pear-webmaster+get-407@lists.php.net to get a copy of this message | ||
please write code in pgsql.php file.
function errorCode($errormsg)
{
static $error_regexps;
if (empty($error_regexps)) {
$error_regexps = array(
'/(Table does not exist\.|Relation [\"\'].*[\"\'] does not
exist|sequence does not exist|class ".+" not found)$/' =>
DB_ERROR_NOSUCHTABLE,
'/table [\"\'].*[\"\'] does not exist/' =>
DB_ERROR_NOSUCHTABLE,
'/Relation [\"\'].*[\"\'] already exists|Cannot insert a
duplicate key into (a )?unique index.*/' => DB_ERROR_ALREADY_EXISTS,
'/divide by zero$/' => DB_ERROR_DIVZERO,
'/pg_atoi: error in .*: can\'t parse /' =>
DB_ERROR_INVALID_NUMBER,
'/ttribute [\"\'].*[\"\'] not found$|Relation
[\"\'].*[\"\']
does not have attribute [\"\'].*[\"\']/' => DB_ERROR_NOSUCHFIELD,
'/parser: parse error at or near \"/' => DB_ERROR_SYNTAX,
'/referential integrity violation/' =>
DB_ERROR_CONSTRAINT,
----> '/value too long/' => DB_VALUE_ERROR
);
plus database error informacio.
Som Gabor Imre
sgi@s-s.vac.hu