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
80122862
Unverified
Commit
80122862
authored
Oct 14, 2019
by
Sergei Morozov
Committed by
GitHub
Oct 14, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3679 from kalinin-k-a/fix_begin_transaction_after_reconnect
fix begin trasaction after reconnect
parents
7241a651
b5508798
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 @
80122862
...
@@ -354,6 +354,8 @@ class Connection implements DriverConnection
...
@@ -354,6 +354,8 @@ class Connection implements DriverConnection
$this
->
_conn
=
$this
->
_driver
->
connect
(
$this
->
params
,
$user
,
$password
,
$driverOptions
);
$this
->
_conn
=
$this
->
_driver
->
connect
(
$this
->
params
,
$user
,
$password
,
$driverOptions
);
$this
->
isConnected
=
true
;
$this
->
isConnected
=
true
;
$this
->
transactionNestingLevel
=
0
;
if
(
$this
->
autoCommit
===
false
)
{
if
(
$this
->
autoCommit
===
false
)
{
$this
->
beginTransaction
();
$this
->
beginTransaction
();
}
}
...
...
tests/Doctrine/Tests/DBAL/Functional/ConnectionTest.php
View file @
80122862
...
@@ -70,6 +70,40 @@ class ConnectionTest extends DbalFunctionalTestCase
...
@@ -70,6 +70,40 @@ class ConnectionTest extends DbalFunctionalTestCase
$this
->
connection
->
rollBack
();
$this
->
connection
->
rollBack
();
self
::
assertEquals
(
0
,
$this
->
connection
->
getTransactionNestingLevel
());
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
()
:
void
public
function
testTransactionNestingBehaviorWithSavepoints
()
:
void
...
...
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