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
0cdd144b
Commit
0cdd144b
authored
Nov 08, 2006
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added portable error code constants to Doctrine_Db, errorCodeMaps to sqlite and mysql drivers
parent
a0aa16bb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
94 additions
and
1 deletion
+94
-1
DB.php
draft/DB.php
+38
-0
Mysql.php
lib/Doctrine/Db/Mysql.php
+25
-1
Sqlite.php
lib/Doctrine/Db/Sqlite.php
+31
-0
No files found.
draft/DB.php
View file @
0cdd144b
...
...
@@ -28,6 +28,44 @@
* @package Doctrine
*/
class
Doctrine_DB2
implements
Countable
,
IteratorAggregate
,
Doctrine_Adapter_Interface
{
/**
* error constants
*/
const
ERR
=
-
1
;
const
ERR_SYNTAX
=
-
2
;
const
ERR_CONSTRAINT
=
-
3
;
const
ERR_NOT_FOUND
=
-
4
;
const
ERR_ALREADY_EXISTS
=
-
5
;
const
ERR_UNSUPPORTED
=
-
6
;
const
ERR_MISMATCH
=
-
7
;
const
ERR_INVALID
=
-
8
;
const
ERR_NOT_CAPABLE
=
-
9
;
const
ERR_TRUNCATED
=
-
10
;
const
ERR_INVALID_NUMBER
=
-
11
;
const
ERR_INVALID_DATE
=
-
12
;
const
ERR_DIVZERO
=
-
13
;
const
ERR_NODBSELECTED
=
-
14
;
const
ERR_CANNOT_CREATE
=
-
15
;
const
ERR_CANNOT_DELETE
=
-
16
;
const
ERR_CANNOT_DROP
=
-
17
;
const
ERR_NOSUCHTABLE
=
-
18
;
const
ERR_NOSUCHFIELD
=
-
19
;
const
ERR_NEED_MORE_DATA
=
-
20
;
const
ERR_NOT_LOCKED
=
-
21
;
const
ERR_VALUE_COUNT_ON_ROW
=
-
22
;
const
ERR_INVALID_DSN
=
-
23
;
const
ERR_CONNECT_FAILED
=
-
24
;
const
ERR_EXTENSION_NOT_FOUND
=
-
25
;
const
ERR_NOSUCHDB
=
-
26
;
const
ERR_ACCESS_VIOLATION
=
-
27
;
const
ERR_CANNOT_REPLACE
=
-
28
;
const
ERR_CONSTRAINT_NOT_NULL
=
-
29
;
const
ERR_DEADLOCK
=
-
30
;
const
ERR_CANNOT_ALTER
=
-
31
;
const
ERR_MANAGER
=
-
32
;
const
ERR_MANAGER_PARSE
=
-
33
;
const
ERR_LOADMODULE
=
-
34
;
const
ERR_INSUFFICIENT_DATA
=
-
35
;
/**
* @var array $instances all the instances of this class
*/
...
...
lib/Doctrine/Db/Mysql.php
View file @
0cdd144b
...
...
@@ -28,5 +28,29 @@ Doctrine::autoload('Doctrine_Db');
* @version $Id$
*/
class
Doctrine_Db_Mysql
extends
Doctrine_Db
{
protected
static
$errorCodeMap
=
array
(
1004
=>
Doctrine_Db
::
ERR_CANNOT_CREATE
,
1005
=>
Doctrine_Db
::
ERR_CANNOT_CREATE
,
1006
=>
Doctrine_Db
::
ERR_CANNOT_CREATE
,
1007
=>
Doctrine_Db
::
ERR_ALREADY_EXISTS
,
1008
=>
Doctrine_Db
::
ERR_CANNOT_DROP
,
1022
=>
Doctrine_Db
::
ERR_ALREADY_EXISTS
,
1044
=>
Doctrine_Db
::
ERR_ACCESS_VIOLATION
,
1046
=>
Doctrine_Db
::
ERR_NODBSELECTED
,
1048
=>
Doctrine_Db
::
ERR_CONSTRAINT
,
1049
=>
Doctrine_Db
::
ERR_NOSUCHDB
,
1050
=>
Doctrine_Db
::
ERR_ALREADY_EXISTS
,
1051
=>
Doctrine_Db
::
ERR_NOSUCHTABLE
,
1054
=>
Doctrine_Db
::
ERR_NOSUCHFIELD
,
1061
=>
Doctrine_Db
::
ERR_ALREADY_EXISTS
,
1062
=>
Doctrine_Db
::
ERR_ALREADY_EXISTS
,
1064
=>
Doctrine_Db
::
ERR_SYNTAX
,
1091
=>
Doctrine_Db
::
ERR_NOT_FOUND
,
1100
=>
Doctrine_Db
::
ERR_NOT_LOCKED
,
1136
=>
Doctrine_Db
::
ERR_VALUE_COUNT_ON_ROW
,
1142
=>
Doctrine_Db
::
ERR_ACCESS_VIOLATION
,
1146
=>
Doctrine_Db
::
ERR_NOSUCHTABLE
,
1216
=>
Doctrine_Db
::
ERR_CONSTRAINT
,
1217
=>
Doctrine_Db
::
ERR_CONSTRAINT
,
);
}
lib/Doctrine/Db/Sqlite.php
View file @
0cdd144b
...
...
@@ -28,5 +28,36 @@ Doctrine::autoload('Doctrine_Db');
* @version $Id$
*/
class
Doctrine_Db_Sqlite
extends
Doctrine_Db
{
protected
static
$errorRegexps
=
array
(
'/^no such table:/'
=>
Doctrine_Db
::
ERR_NOSUCHTABLE
,
'/^no such index:/'
=>
Doctrine_Db
::
ERR_NOT_FOUND
,
'/^(table|index) .* already exists$/'
=>
Doctrine_Db
::
ERR_ALREADY_EXISTS
,
'/PRIMARY KEY must be unique/i'
=>
Doctrine_Db
::
ERR_CONSTRAINT
,
'/is not unique/'
=>
Doctrine_Db
::
ERR_CONSTRAINT
,
'/columns .* are not unique/i'
=>
Doctrine_Db
::
ERR_CONSTRAINT
,
'/uniqueness constraint failed/'
=>
Doctrine_Db
::
ERR_CONSTRAINT
,
'/may not be NULL/'
=>
Doctrine_Db
::
ERR_CONSTRAINT_NOT_NULL
,
'/^no such column:/'
=>
Doctrine_Db
::
ERR_NOSUCHFIELD
,
'/column not present in both tables/i'
=>
Doctrine_Db
::
ERR_NOSUCHFIELD
,
'/^near ".*": syntax error$/'
=>
Doctrine_Db
::
ERR_SYNTAX
,
'/[0-9]+ values for [0-9]+ columns/i'
=>
Doctrine_Db
::
ERR_VALUE_COUNT_ON_ROW
,
);
/**
* This method is used to collect information about an error
*
* @param integer $error
* @return array
* @access public
*/
public
function
processErrorInfo
(
array
$errorInfo
)
{
foreach
(
self
::
$errorRegexps
as
$regexp
=>
$code
)
{
if
(
preg_match
(
$regexp
,
$native_msg
))
{
$error
=
$code
;
break
;
}
}
return
array
(
$error
,
$native_code
,
$native_msg
);
}
}
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