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
7d746844
Commit
7d746844
authored
Jul 07, 2010
by
beberlei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DBAL-32 - Reconfigure any passed PDO instance to throw exceptions
parent
125f3b17
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
0 deletions
+16
-0
DriverManager.php
lib/Doctrine/DBAL/DriverManager.php
+1
-0
DriverManagerTest.php
tests/Doctrine/Tests/DBAL/DriverManagerTest.php
+15
-0
No files found.
lib/Doctrine/DBAL/DriverManager.php
View file @
7d746844
...
...
@@ -109,6 +109,7 @@ final class DriverManager
if
(
isset
(
$params
[
'pdo'
])
&&
!
$params
[
'pdo'
]
instanceof
\PDO
)
{
throw
DBALException
::
invalidPdoInstance
();
}
else
if
(
isset
(
$params
[
'pdo'
]))
{
$params
[
'pdo'
]
->
setAttribute
(
\PDO
::
ATTR_ERRMODE
,
\PDO
::
ERRMODE_EXCEPTION
);
$params
[
'driver'
]
=
'pdo_'
.
$params
[
'pdo'
]
->
getAttribute
(
\PDO
::
ATTR_DRIVER_NAME
);
}
else
{
self
::
_checkParams
(
$params
);
...
...
tests/Doctrine/Tests/DBAL/DriverManagerTest.php
View file @
7d746844
...
...
@@ -26,6 +26,21 @@ class DriverManagerTest extends \Doctrine\Tests\DbalTestCase
$this
->
assertEquals
(
'sqlite'
,
$conn
->
getDatabasePlatform
()
->
getName
());
}
/**
* @group DBAL-32
*/
public
function
testPdoInstanceSetErrorMode
()
{
$pdo
=
new
\PDO
(
'sqlite::memory:'
);
$pdo
->
setAttribute
(
\PDO
::
ATTR_ERRMODE
,
\PDO
::
ERRMODE_SILENT
);
$options
=
array
(
'pdo'
=>
$pdo
);
$conn
=
\Doctrine\DBAL\DriverManager
::
getConnection
(
$options
);
$this
->
assertEquals
(
\PDO
::
ERRMODE_EXCEPTION
,
$pdo
->
getAttribute
(
\PDO
::
ATTR_ERRMODE
));
}
/**
* @expectedException \Doctrine\DBAL\DBALException
*/
...
...
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