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
24170d37
Unverified
Commit
24170d37
authored
Oct 14, 2019
by
Sergei Morozov
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'bpo/2.9/#3679' into 2.9
parents
a2bfa40b
a9b7bf85
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
0 deletions
+36
-0
Connection.php
lib/Doctrine/DBAL/Connection.php
+2
-0
ConnectionTest.php
tests/Doctrine/Tests/DBAL/Functional/ConnectionTest.php
+34
-0
No files found.
lib/Doctrine/DBAL/Connection.php
View file @
24170d37
...
...
@@ -356,6 +356,8 @@ class Connection implements DriverConnection
$this
->
_conn
=
$this
->
_driver
->
connect
(
$this
->
params
,
$user
,
$password
,
$driverOptions
);
$this
->
isConnected
=
true
;
$this
->
transactionNestingLevel
=
0
;
if
(
$this
->
autoCommit
===
false
)
{
$this
->
beginTransaction
();
}
...
...
tests/Doctrine/Tests/DBAL/Functional/ConnectionTest.php
View file @
24170d37
...
...
@@ -69,6 +69,40 @@ class ConnectionTest extends DbalFunctionalTestCase
$this
->
connection
->
rollBack
();
self
::
assertEquals
(
0
,
$this
->
connection
->
getTransactionNestingLevel
());
}
$this
->
connection
->
beginTransaction
();
$this
->
connection
->
close
();
$this
->
connection
->
beginTransaction
();
self
::
assertEquals
(
1
,
$this
->
connection
->
getTransactionNestingLevel
());
}
public
function
testTransactionNestingLevelIsResetOnReconnect
()
:
void
{
if
(
$this
->
connection
->
getDatabasePlatform
()
->
getName
()
===
'sqlite'
)
{
$params
=
$this
->
connection
->
getParams
();
$params
[
'memory'
]
=
false
;
$params
[
'path'
]
=
'/tmp/test_nesting.sqlite'
;
$connection
=
DriverManager
::
getConnection
(
$params
,
$this
->
connection
->
getConfiguration
(),
$this
->
connection
->
getEventManager
()
);
}
else
{
$connection
=
$this
->
connection
;
}
$connection
->
executeQuery
(
'CREATE TABLE test_nesting(test int not null)'
);
$this
->
connection
->
beginTransaction
();
$this
->
connection
->
beginTransaction
();
$connection
->
close
();
// connection closed in runtime (for example if lost or another application logic)
$connection
->
beginTransaction
();
$connection
->
executeQuery
(
'insert into test_nesting values (33)'
);
$connection
->
rollback
();
self
::
assertEquals
(
0
,
$connection
->
fetchColumn
(
'select count(*) from test_nesting'
));
}
public
function
testTransactionNestingBehaviorWithSavepoints
()
...
...
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