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
38a18169
Commit
38a18169
authored
Nov 10, 2006
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Doctrine_Connection_Sqlite_Exception : added portable error codes
parent
1e464e98
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
4 deletions
+49
-4
Exception.php
lib/Doctrine/Connection/Sqlite/Exception.php
+49
-4
No files found.
lib/Doctrine/Connection/Sqlite/Exception.php
View file @
38a18169
...
...
@@ -22,8 +22,53 @@ Doctrine::autoload('Doctrine_Connection_Exception');
/**
* Doctrine_Connection_Sqlite_Exception
*
* @package Doctrine ORM
* @url www.phpdoctrine.com
* @license LGPL
* @package Doctrine
* @url http://www.phpdoctrine.com
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @author Konsta Vesterinen
* @author Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library)
* @since 1.0
* @version $Id$
*/
class
Doctrine_Connection_Sqlite_Exception
extends
Doctrine_Connection_Exception
{
}
class
Doctrine_Connection_Sqlite_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
(
'/^no such table:/'
=>
Doctrine
::
ERR_NOSUCHTABLE
,
'/^no such index:/'
=>
Doctrine
::
ERR_NOT_FOUND
,
'/^(table|index) .* already exists$/'
=>
Doctrine
::
ERR_ALREADY_EXISTS
,
'/PRIMARY KEY must be unique/i'
=>
Doctrine
::
ERR_CONSTRAINT
,
'/is not unique/'
=>
Doctrine
::
ERR_CONSTRAINT
,
'/columns .* are not unique/i'
=>
Doctrine
::
ERR_CONSTRAINT
,
'/uniqueness constraint failed/'
=>
Doctrine
::
ERR_CONSTRAINT
,
'/may not be NULL/'
=>
Doctrine
::
ERR_CONSTRAINT_NOT_NULL
,
'/^no such column:/'
=>
Doctrine
::
ERR_NOSUCHFIELD
,
'/column not present in both tables/i'
=>
Doctrine
::
ERR_NOSUCHFIELD
,
'/^near ".*": syntax error$/'
=>
Doctrine
::
ERR_SYNTAX
,
'/[0-9]+ values for [0-9]+ 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
* @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