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
1590749b
Commit
1590749b
authored
Dec 29, 2013
by
Steve Müller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add missing driver exception subclasses
parent
d473423d
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
302 additions
and
10 deletions
+302
-10
DBALException.php
lib/Doctrine/DBAL/DBALException.php
+28
-0
AccessDeniedException.php
lib/Doctrine/DBAL/Exception/AccessDeniedException.php
+33
-0
FailedToOpenException.php
lib/Doctrine/DBAL/Exception/FailedToOpenException.php
+33
-0
InvalidFieldNameException.php
lib/Doctrine/DBAL/Exception/InvalidFieldNameException.php
+33
-0
NonUniqueFieldNameException.php
lib/Doctrine/DBAL/Exception/NonUniqueFieldNameException.php
+33
-0
ReadOnlyException.php
lib/Doctrine/DBAL/Exception/ReadOnlyException.php
+33
-0
SyntaxErrorException.php
lib/Doctrine/DBAL/Exception/SyntaxErrorException.php
+33
-0
TableExistsException.php
lib/Doctrine/DBAL/Exception/TableExistsException.php
+33
-0
TableNotFoundException.php
lib/Doctrine/DBAL/Exception/TableNotFoundException.php
+33
-0
ExceptionTest.php
tests/Doctrine/Tests/DBAL/Functional/ExceptionTest.php
+10
-10
No files found.
lib/Doctrine/DBAL/DBALException.php
View file @
1590749b
...
@@ -130,6 +130,10 @@ class DBALException extends \Exception
...
@@ -130,6 +130,10 @@ class DBALException extends \Exception
/**
/**
* Factory method for subclasses of DBALException based on exception code.
* Factory method for subclasses of DBALException based on exception code.
*
*
* @param string $msg The driver error message.
* @param integer $code The DBAL driver error code. One of the DBALException::ERROR_* constants.
* @param \Exception $driverEx The underlying driver exception to wrap.
*
* @return \Doctrine\DBAL\DBALException
* @return \Doctrine\DBAL\DBALException
*/
*/
private
static
function
createDriverException
(
$msg
,
$code
,
$driverEx
)
private
static
function
createDriverException
(
$msg
,
$code
,
$driverEx
)
...
@@ -144,6 +148,30 @@ class DBALException extends \Exception
...
@@ -144,6 +148,30 @@ class DBALException extends \Exception
case
self
::
ERROR_FOREIGN_KEY_CONSTRAINT
:
case
self
::
ERROR_FOREIGN_KEY_CONSTRAINT
:
return
new
Exception\ForeignKeyConstraintViolationException
(
$msg
,
$code
,
$driverEx
);
return
new
Exception\ForeignKeyConstraintViolationException
(
$msg
,
$code
,
$driverEx
);
case
self
::
ERROR_ACCESS_DENIED
:
return
new
Exception\AccessDeniedException
(
$msg
,
$code
,
$driverEx
);
case
self
::
ERROR_BAD_FIELD_NAME
:
return
new
Exception\InvalidFieldNameException
(
$msg
,
$code
,
$driverEx
);
case
self
::
ERROR_NON_UNIQUE_FIELD_NAME
:
return
new
Exception\NonUniqueFieldNameException
(
$msg
,
$code
,
$driverEx
);
case
self
::
ERROR_SYNTAX
:
return
new
Exception\SyntaxErrorException
(
$msg
,
$code
,
$driverEx
);
case
self
::
ERROR_TABLE_ALREADY_EXISTS
:
return
new
Exception\TableExistsException
(
$msg
,
$code
,
$driverEx
);
case
self
::
ERROR_UNABLE_TO_OPEN
:
return
new
Exception\FailedToOpenException
(
$msg
,
$code
,
$driverEx
);
case
self
::
ERROR_UNKNOWN_TABLE
:
return
new
Exception\TableNotFoundException
(
$msg
,
$code
,
$driverEx
);
case
self
::
ERROR_WRITE_READONLY
:
return
new
Exception\ReadOnlyException
(
$msg
,
$code
,
$driverEx
);
default
:
default
:
return
new
self
(
$msg
,
$code
,
$driverEx
);
return
new
self
(
$msg
,
$code
,
$driverEx
);
}
}
...
...
lib/Doctrine/DBAL/Exception/AccessDeniedException.php
0 → 100644
View file @
1590749b
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace
Doctrine\DBAL\Exception
;
use
Doctrine\DBAL\DBALException
;
/**
* Thrown when {@link DBALException::ERROR_ACCESS_DENIED} is detected in driver.
*
* @author Steve Müller <st.mueller@dzh-online.de>
* @link www.doctrine-project.org
* @since 2.5
*/
class
AccessDeniedException
extends
DBALException
{
}
lib/Doctrine/DBAL/Exception/FailedToOpenException.php
0 → 100644
View file @
1590749b
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace
Doctrine\DBAL\Exception
;
use
Doctrine\DBAL\DBALException
;
/**
* Thrown when {@link DBALException::ERROR_UNABLE_TO_OPEN} is detected in driver.
*
* @author Steve Müller <st.mueller@dzh-online.de>
* @link www.doctrine-project.org
* @since 2.5
*/
class
FailedToOpenException
extends
DBALException
{
}
lib/Doctrine/DBAL/Exception/InvalidFieldNameException.php
0 → 100644
View file @
1590749b
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace
Doctrine\DBAL\Exception
;
use
Doctrine\DBAL\DBALException
;
/**
* Thrown when {@link DBALException::ERROR_BAD_FIELD_NAME} is detected in driver.
*
* @author Steve Müller <st.mueller@dzh-online.de>
* @link www.doctrine-project.org
* @since 2.5
*/
class
InvalidFieldNameException
extends
DBALException
{
}
lib/Doctrine/DBAL/Exception/NonUniqueFieldNameException.php
0 → 100644
View file @
1590749b
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace
Doctrine\DBAL\Exception
;
use
Doctrine\DBAL\DBALException
;
/**
* Thrown when {@link DBALException::ERROR_NON_UNIQUE_FIELD_NAME} is detected in driver.
*
* @author Steve Müller <st.mueller@dzh-online.de>
* @link www.doctrine-project.org
* @since 2.5
*/
class
NonUniqueFieldNameException
extends
DBALException
{
}
lib/Doctrine/DBAL/Exception/ReadOnlyException.php
0 → 100644
View file @
1590749b
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace
Doctrine\DBAL\Exception
;
use
Doctrine\DBAL\DBALException
;
/**
* Thrown when {@link DBALException::ERROR_WRITE_READONLY} is detected in driver.
*
* @author Steve Müller <st.mueller@dzh-online.de>
* @link www.doctrine-project.org
* @since 2.5
*/
class
ReadOnlyException
extends
DBALException
{
}
lib/Doctrine/DBAL/Exception/SyntaxErrorException.php
0 → 100644
View file @
1590749b
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace
Doctrine\DBAL\Exception
;
use
Doctrine\DBAL\DBALException
;
/**
* Thrown when {@link DBALException::ERROR_SYNTAX} is detected in driver.
*
* @author Steve Müller <st.mueller@dzh-online.de>
* @link www.doctrine-project.org
* @since 2.5
*/
class
SyntaxErrorException
extends
DBALException
{
}
lib/Doctrine/DBAL/Exception/TableExistsException.php
0 → 100644
View file @
1590749b
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace
Doctrine\DBAL\Exception
;
use
Doctrine\DBAL\DBALException
;
/**
* Thrown when {@link DBALException::ERROR_TABLE_ALREADY_EXISTS} is detected in driver.
*
* @author Steve Müller <st.mueller@dzh-online.de>
* @link www.doctrine-project.org
* @since 2.5
*/
class
TableExistsException
extends
DBALException
{
}
lib/Doctrine/DBAL/Exception/TableNotFoundException.php
0 → 100644
View file @
1590749b
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace
Doctrine\DBAL\Exception
;
use
Doctrine\DBAL\DBALException
;
/**
* Thrown when {@link DBALException::ERROR_UNKNOWN_TABLE} is detected in driver.
*
* @author Steve Müller <st.mueller@dzh-online.de>
* @link www.doctrine-project.org
* @since 2.5
*/
class
TableNotFoundException
extends
DBALException
{
}
tests/Doctrine/Tests/DBAL/Functional/ExceptionTest.php
View file @
1590749b
...
@@ -35,7 +35,7 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase
...
@@ -35,7 +35,7 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase
{
{
$sql
=
"SELECT * FROM unknown_table"
;
$sql
=
"SELECT * FROM unknown_table"
;
$this
->
setExpectedException
(
'\Doctrine\DBAL\
DBAL
Exception'
,
null
,
DBALException
::
ERROR_UNKNOWN_TABLE
);
$this
->
setExpectedException
(
'\Doctrine\DBAL\
Exception\TableNotFound
Exception'
,
null
,
DBALException
::
ERROR_UNKNOWN_TABLE
);
$this
->
_conn
->
executeQuery
(
$sql
);
$this
->
_conn
->
executeQuery
(
$sql
);
}
}
...
@@ -45,7 +45,7 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase
...
@@ -45,7 +45,7 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase
$table
->
addColumn
(
'id'
,
'integer'
,
array
());
$table
->
addColumn
(
'id'
,
'integer'
,
array
());
$table
->
setPrimaryKey
(
array
(
'id'
));
$table
->
setPrimaryKey
(
array
(
'id'
));
$this
->
setExpectedException
(
'\Doctrine\DBAL\
DBAL
Exception'
,
null
,
DBALException
::
ERROR_TABLE_ALREADY_EXISTS
);
$this
->
setExpectedException
(
'\Doctrine\DBAL\
Exception\TableExists
Exception'
,
null
,
DBALException
::
ERROR_TABLE_ALREADY_EXISTS
);
foreach
(
$this
->
_conn
->
getDatabasePlatform
()
->
getCreateTableSQL
(
$table
)
AS
$sql
)
{
foreach
(
$this
->
_conn
->
getDatabasePlatform
()
->
getCreateTableSQL
(
$table
)
AS
$sql
)
{
$this
->
_conn
->
executeQuery
(
$sql
);
$this
->
_conn
->
executeQuery
(
$sql
);
}
}
...
@@ -111,7 +111,7 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase
...
@@ -111,7 +111,7 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase
$this
->
_conn
->
executeQuery
(
$sql
);
$this
->
_conn
->
executeQuery
(
$sql
);
}
}
$this
->
setExpectedException
(
'\Doctrine\DBAL\
DBAL
Exception'
,
null
,
DBALException
::
ERROR_BAD_FIELD_NAME
);
$this
->
setExpectedException
(
'\Doctrine\DBAL\
Exception\InvalidFieldName
Exception'
,
null
,
DBALException
::
ERROR_BAD_FIELD_NAME
);
$this
->
_conn
->
insert
(
"bad_fieldname_table"
,
array
(
'name'
=>
5
));
$this
->
_conn
->
insert
(
"bad_fieldname_table"
,
array
(
'name'
=>
5
));
}
}
...
@@ -130,7 +130,7 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase
...
@@ -130,7 +130,7 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase
}
}
$sql
=
'SELECT id FROM ambiguous_list_table, ambiguous_list_table_2'
;
$sql
=
'SELECT id FROM ambiguous_list_table, ambiguous_list_table_2'
;
$this
->
setExpectedException
(
'\Doctrine\DBAL\
DBAL
Exception'
,
null
,
DBALException
::
ERROR_NON_UNIQUE_FIELD_NAME
);
$this
->
setExpectedException
(
'\Doctrine\DBAL\
Exception\NonUniqueFieldName
Exception'
,
null
,
DBALException
::
ERROR_NON_UNIQUE_FIELD_NAME
);
$this
->
_conn
->
executeQuery
(
$sql
);
$this
->
_conn
->
executeQuery
(
$sql
);
}
}
...
@@ -147,7 +147,7 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase
...
@@ -147,7 +147,7 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase
}
}
$this
->
_conn
->
insert
(
"unique_field_table"
,
array
(
'id'
=>
5
));
$this
->
_conn
->
insert
(
"unique_field_table"
,
array
(
'id'
=>
5
));
$this
->
setExpectedException
(
'\Doctrine\DBAL\
DBAL
Exception'
,
null
,
DBALException
::
ERROR_DUPLICATE_KEY
);
$this
->
setExpectedException
(
'\Doctrine\DBAL\
Exception\DuplicateKey
Exception'
,
null
,
DBALException
::
ERROR_DUPLICATE_KEY
);
$this
->
_conn
->
insert
(
"unique_field_table"
,
array
(
'id'
=>
5
));
$this
->
_conn
->
insert
(
"unique_field_table"
,
array
(
'id'
=>
5
));
}
}
...
@@ -162,14 +162,14 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase
...
@@ -162,14 +162,14 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase
}
}
$sql
=
'SELECT id FRO syntax_error_table'
;
$sql
=
'SELECT id FRO syntax_error_table'
;
$this
->
setExpectedException
(
'\Doctrine\DBAL\
DBAL
Exception'
,
null
,
DBALException
::
ERROR_SYNTAX
);
$this
->
setExpectedException
(
'\Doctrine\DBAL\
Exception\SyntaxError
Exception'
,
null
,
DBALException
::
ERROR_SYNTAX
);
$this
->
_conn
->
executeQuery
(
$sql
);
$this
->
_conn
->
executeQuery
(
$sql
);
}
}
/**
/**
* @dataProvider getSqLiteOpenConnection
* @dataProvider getSqLiteOpenConnection
*/
*/
public
function
testConnectionExceptionSqLite
(
$mode
,
$exceptionCode
)
public
function
testConnectionExceptionSqLite
(
$mode
,
$exceptionC
lass
,
$exceptionC
ode
)
{
{
if
(
$this
->
_conn
->
getDatabasePlatform
()
->
getName
()
!=
'sqlite'
)
{
if
(
$this
->
_conn
->
getDatabasePlatform
()
->
getName
()
!=
'sqlite'
)
{
$this
->
markTestSkipped
(
"Only fails this way on sqlite"
);
$this
->
markTestSkipped
(
"Only fails this way on sqlite"
);
...
@@ -194,7 +194,7 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase
...
@@ -194,7 +194,7 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase
$table
=
$schema
->
createTable
(
"no_connection"
);
$table
=
$schema
->
createTable
(
"no_connection"
);
$table
->
addColumn
(
'id'
,
'integer'
);
$table
->
addColumn
(
'id'
,
'integer'
);
$this
->
setExpectedException
(
'\Doctrine\DBAL\DBALException'
,
null
,
$exceptionCode
);
$this
->
setExpectedException
(
$exceptionClass
,
null
,
$exceptionCode
);
foreach
(
$schema
->
toSql
(
$conn
->
getDatabasePlatform
())
AS
$sql
)
{
foreach
(
$schema
->
toSql
(
$conn
->
getDatabasePlatform
())
AS
$sql
)
{
$conn
->
executeQuery
(
$sql
);
$conn
->
executeQuery
(
$sql
);
}
}
...
@@ -203,8 +203,8 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase
...
@@ -203,8 +203,8 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase
public
function
getSqLiteOpenConnection
()
public
function
getSqLiteOpenConnection
()
{
{
return
array
(
return
array
(
array
(
0000
,
DBALException
::
ERROR_UNABLE_TO_OPEN
),
array
(
0000
,
'\Doctrine\DBAL\Exception\FailedToOpenException'
,
DBALException
::
ERROR_UNABLE_TO_OPEN
),
array
(
0444
,
DBALException
::
ERROR_WRITE_READONLY
),
array
(
0444
,
'\Doctrine\DBAL\Exception\ReadOnlyException'
,
DBALException
::
ERROR_WRITE_READONLY
),
);
);
}
}
...
...
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