Fix: Suppression de nombreux warnings en mode php error_reporting E_ALL

This commit is contained in:
Laurent Destailleur
2005-03-21 20:06:55 +00:00
parent 3aa76de884
commit de03819323
2 changed files with 25 additions and 24 deletions

View File

@@ -52,21 +52,22 @@ class DoliDb
// Constantes pour conversion code erreur MySql en code erreur g<>n<EFBFBD>rique // Constantes pour conversion code erreur MySql en code erreur g<>n<EFBFBD>rique
var $errorcode_map = array( var $errorcode_map = array(
1004 => DB_ERROR_CANNOT_CREATE, 1004 => 'DB_ERROR_CANNOT_CREATE',
1005 => DB_ERROR_CANNOT_CREATE, 1005 => 'DB_ERROR_CANNOT_CREATE',
1006 => DB_ERROR_CANNOT_CREATE, 1006 => 'DB_ERROR_CANNOT_CREATE',
1007 => DB_ERROR_ALREADY_EXISTS, 1007 => 'DB_ERROR_ALREADY_EXISTS',
1008 => DB_ERROR_CANNOT_DROP, 1008 => 'DB_ERROR_CANNOT_DROP',
1046 => DB_ERROR_NODBSELECTED, 1046 => 'DB_ERROR_NODBSELECTED',
1050 => DB_ERROR_TABLE_ALREADY_EXISTS, 1050 => 'DB_ERROR_TABLE_ALREADY_EXISTS',
1051 => DB_ERROR_NOSUCHTABLE, 1051 => 'DB_ERROR_NOSUCHTABLE',
1054 => DB_ERROR_NOSUCHFIELD, 1054 => 'DB_ERROR_NOSUCHFIELD',
1062 => DB_ERROR_RECORD_ALREADY_EXISTS, 1062 => 'DB_ERROR_RECORD_ALREADY_EXISTS',
1064 => DB_ERROR_SYNTAX, 1064 => 'DB_ERROR_SYNTAX',
1100 => DB_ERROR_NOT_LOCKED, 1100 => 'DB_ERROR_NOT_LOCKED',
1136 => DB_ERROR_VALUE_COUNT_ON_ROW, 1136 => 'DB_ERROR_VALUE_COUNT_ON_ROW',
1146 => DB_ERROR_NOSUCHTABLE, 1146 => 'DB_ERROR_NOSUCHTABLE',
1048 => DB_ERROR_CONSTRAINT, 1048 => 'DB_ERROR_CONSTRAINT',
1217 => 'DB_ERROR_CHILD_EXISTS'
); );
/** /**
@@ -473,7 +474,7 @@ class DoliDb
if (isset($this->errorcode_map[mysql_errno($this->db)])) { if (isset($this->errorcode_map[mysql_errno($this->db)])) {
return $this->errorcode_map[mysql_errno($this->db)]; return $this->errorcode_map[mysql_errno($this->db)];
} }
return DB_ERROR; return 'DB_ERROR_'.mysql_errno($this->db);
} }
/** /**

View File

@@ -467,14 +467,14 @@ class DoliDb
static $error_regexps; static $error_regexps;
if (empty($error_regexps)) { if (empty($error_regexps)) {
$error_regexps = array( $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\.|Relation [\"\'].*[\"\'] does not exist|sequence does not exist|class ".+" not found)$/' => 'DB_ERROR_NOSUCHTABLE',
'/table [\"\'].*[\"\'] does not exist/' => DB_ERROR_NOSUCHTABLE, '/table [\"\'].*[\"\'] does not exist/' => 'DB_ERROR_NOSUCHTABLE',
'/Relation [\"\'].*[\"\'] already exists|Cannot insert a duplicate key into (a )?unique index.*/' => DB_ERROR_RECORD_ALREADY_EXISTS, '/Relation [\"\'].*[\"\'] already exists|Cannot insert a duplicate key into (a )?unique index.*/' => 'DB_ERROR_RECORD_ALREADY_EXISTS',
'/divide by zero$/' => DB_ERROR_DIVZERO, '/divide by zero$/' => 'DB_ERROR_DIVZERO',
'/pg_atoi: error in .*: can\'t parse /' => DB_ERROR_INVALID_NUMBER, '/pg_atoi: error in .*: can\'t parse /' => 'DB_ERROR_INVALID_NUMBER',
'/ttribute [\"\'].*[\"\'] not found$|Relation [\"\'].*[\"\'] does not have attribute [\"\'].*[\"\']/' => DB_ERROR_NOSUCHFIELD, '/ttribute [\"\'].*[\"\'] not found$|Relation [\"\'].*[\"\'] does not have attribute [\"\'].*[\"\']/' => 'DB_ERROR_NOSUCHFIELD',
'/parser: parse error at or near \"/' => DB_ERROR_SYNTAX, '/parser: parse error at or near \"/' => 'DB_ERROR_SYNTAX',
'/referential integrity violation/' => DB_ERROR_CONSTRAINT '/referential integrity violation/' => 'DB_ERROR_CONSTRAINT'
); );
} }
foreach ($error_regexps as $regexp => $code) { foreach ($error_regexps as $regexp => $code) {