Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
3ee90a51
Commit
3ee90a51
authored
Nov 13, 2006
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Portable error code updates
parent
b83d0ab3
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
108 additions
and
37 deletions
+108
-37
Exception.php
lib/Doctrine/Connection/Firebird/Exception.php
+1
-1
Exception.php
lib/Doctrine/Connection/Informix/Exception.php
+0
-0
Exception.php
lib/Doctrine/Connection/Mssql/Exception.php
+9
-9
Exception.php
lib/Doctrine/Connection/Mysql/Exception.php
+9
-9
Exception.php
lib/Doctrine/Connection/Oracle/Exception.php
+9
-9
Exception.php
lib/Doctrine/Connection/Pgsql/Exception.php
+80
-9
No files found.
lib/Doctrine/Connection/Firebird/Exception.php
View file @
3ee90a51
...
...
@@ -34,7 +34,7 @@ Doctrine::autoload('Doctrine_Connection_Exception');
*/
class
Doctrine_Connection_Firebird_Exception
extends
Doctrine_Connection_Exception
{
/**
* @var array $error
Regexps an array that is used for determining portable
* @var array $error
CodeMap an array that is used for determining portable
* error code from a native database error code
*/
protected
static
$errorCodeMap
=
array
(
...
...
lib/Doctrine/Connection/Informix/
Informix
.php
→
lib/Doctrine/Connection/Informix/
Exception
.php
View file @
3ee90a51
File moved
lib/Doctrine/Connection/Mssql/
Mssql
.php
→
lib/Doctrine/Connection/Mssql/
Exception
.php
View file @
3ee90a51
...
...
@@ -22,18 +22,18 @@ Doctrine::autoload('Doctrine_Connection_Exception');
/**
* Doctrine_Connection_Mssql_Exception
*
* @package Doctrine
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @package Doctrine
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library)
* @since 1.0
* @version $Revision$
* @category Object Relational Mapping
* @link www.phpdoctrine.com
*/
* @since 1.0
* @version $Revision$
* @category Object Relational Mapping
* @link www.phpdoctrine.com
*/
class
Doctrine_Connection_Mssql_Exception
extends
Doctrine_Connection_Exception
{
/**
* @var array $error
Regexps an array that is used for determining portable
* @var array $error
CodeMap an array that is used for determining portable
* error code from a native database error code
*/
protected
static
$errorCodeMap
=
array
(
...
...
lib/Doctrine/Connection/Mysql/Exception.php
View file @
3ee90a51
...
...
@@ -22,18 +22,18 @@ Doctrine::autoload('Doctrine_Connection_Exception');
/**
* Doctrine_Connection_Mysql_Exception
*
* @package Doctrine
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @package Doctrine
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library)
* @since 1.0
* @version $Revision$
* @category Object Relational Mapping
* @link www.phpdoctrine.com
*/
* @since 1.0
* @version $Revision$
* @category Object Relational Mapping
* @link www.phpdoctrine.com
*/
class
Doctrine_Connection_Mysql_Exception
extends
Doctrine_Connection_Exception
{
/**
* @var array $error
Regexps an array that is used for determining portable
* @var array $error
CodeMap an array that is used for determining portable
* error code from a native database error code
*/
protected
static
$errorCodeMap
=
array
(
...
...
lib/Doctrine/Connection/Oracle/Exception.php
View file @
3ee90a51
...
...
@@ -22,18 +22,18 @@ Doctrine::autoload('Doctrine_Connection_Exception');
/**
* Doctrine_Connection_Oracle_Exception
*
* @package Doctrine
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @package Doctrine
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library)
* @since 1.0
* @version $Revision$
* @category Object Relational Mapping
* @link www.phpdoctrine.com
*/
* @since 1.0
* @version $Revision$
* @category Object Relational Mapping
* @link www.phpdoctrine.com
*/
class
Doctrine_Connection_Oracle_Exception
extends
Doctrine_Connection_Exception
{
/**
* @var array $error
Regexps
an array that is used for determining portable
* @var array $error
CodeMap
an array that is used for determining portable
* error code from a native database error code
*/
protected
static
$errorCodeMap
=
array
(
...
...
lib/Doctrine/Connection/Pgsql/Exception.php
View file @
3ee90a51
...
...
@@ -22,12 +22,83 @@ Doctrine::autoload('Doctrine_Connection_Exception');
/**
* Doctrine_Connection_Pgsql_Exception
*
* @package Doctrine
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @category Object Relational Mapping
* @link www.phpdoctrine.com
* @since 1.0
* @version $Revision$
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
*/
class
Doctrine_Connection_Pgsql_Exception
extends
Doctrine_Connection_Exception
{
}
* @package Doctrine
* @category Object Relational Mapping
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.com
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Paul Cooper <pgc@ucecom.com> (PEAR MDB2 Pgsql driver)
* @author Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library)
* @since 1.0
* @version $Revision$
*/
class
Doctrine_Connection_Pgsql_Exception
extends
Doctrine_Connection_Exception
{
/**
* @var array $errorRegexps an array that is used for determining portable
* error code from a native database error message
*/
protected
static
$errorRegexps
=
array
(
'/column .* (of relation .*)?does not exist/i'
=>
Doctrine
::
ERR_NOSUCHFIELD
,
'/(relation|sequence|table).*does not exist|class .* not found/i'
=>
Doctrine
::
ERR_NOSUCHTABLE
,
'/index .* does not exist/'
=>
Doctrine
::
ERR_NOT_FOUND
,
'/relation .* already exists/i'
=>
Doctrine
::
ERR_ALREADY_EXISTS
,
'/(divide|division) by zero$/i'
=>
Doctrine
::
ERR_DIVZERO
,
'/pg_atoi: error in .*: can\'t parse /i'
=>
Doctrine
::
ERR_INVALID_NUMBER
,
'/invalid input syntax for( type)? (integer|numeric)/i'
=>
Doctrine
::
ERR_INVALID_NUMBER
,
'/value .* is out of range for type \w*int/i'
=>
Doctrine
::
ERR_INVALID_NUMBER
,
'/integer out of range/i'
=>
Doctrine
::
ERR_INVALID_NUMBER
,
'/value too long for type character/i'
=>
Doctrine
::
ERR_INVALID
,
'/attribute .* not found|relation .* does not have attribute/i'
=>
Doctrine
::
ERR_NOSUCHFIELD
,
'/column .* specified in USING clause does not exist in (left|right) table/i'
=>
Doctrine
::
ERR_NOSUCHFIELD
,
'/parser: parse error at or near/i'
=>
Doctrine
::
ERR_SYNTAX
,
'/syntax error at/'
=>
Doctrine
::
ERR_SYNTAX
,
'/column reference .* is ambiguous/i'
=>
Doctrine
::
ERR_SYNTAX
,
'/permission denied/'
=>
Doctrine
::
ERR_ACCESS_VIOLATION
,
'/violates not-null constraint/'
=>
Doctrine
::
ERR_CONSTRAINT_NOT_NULL
,
'/violates [\w ]+ constraint/'
=>
Doctrine
::
ERR_CONSTRAINT
,
'/referential integrity violation/'
=>
Doctrine
::
ERR_CONSTRAINT
,
'/more expressions than target columns/i'
=>
Doctrine
::
ERR_VALUE_COUNT_ON_ROW
,
);
/**
* This method checks if native error code/message can be
* converted into a portable code and then adds this
* portable error code to errorInfo array and returns the modified array
*
* the portable error code is added at the end of array
*
* @param array $errorInfo error info array
* @since 1.0
* @return array
*/
public
function
processErrorInfo
(
array
$errorInfo
)
{
foreach
(
self
::
$errorRegexps
as
$regexp
=>
$code
)
{
if
(
preg_match
(
$regexp
,
$errorInfo
[
2
]))
{
$errorInfo
[
3
]
=
$code
;
break
;
}
}
return
$errorInfo
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment