Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
drupal
Commits
6682ab93
Commit
6682ab93
authored
15 years ago
by
Dries Buytaert
Browse files
Options
Downloads
Patches
Plain Diff
- Patch
#517502
by Crell: make transaction API follow its own documentation.
parent
6dc5b544
No related branches found
No related tags found
2 merge requests
!7452
Issue #1797438. HTML5 validation is preventing form submit and not fully...
,
!789
Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
includes/database/database.inc
+22
-5
22 additions, 5 deletions
includes/database/database.inc
modules/simpletest/tests/database_test.test
+2
-2
2 additions, 2 deletions
modules/simpletest/tests/database_test.test
with
24 additions
and
7 deletions
includes/database/database.inc
+
22
−
5
View file @
6682ab93
...
@@ -225,7 +225,7 @@ abstract class DatabaseConnection extends PDO {
...
@@ -225,7 +225,7 @@ abstract class DatabaseConnection extends PDO {
*
*
* @var boolean
* @var boolean
*/
*/
protected
$willRoll
B
ack
;
protected
$willRoll
b
ack
;
/**
/**
* The name of the Select class for this connection.
* The name of the Select class for this connection.
...
@@ -849,12 +849,12 @@ public function startTransaction($required = FALSE) {
...
@@ -849,12 +849,12 @@ public function startTransaction($required = FALSE) {
*
*
* This method throws an exception if no transaction is active.
* This method throws an exception if no transaction is active.
*/
*/
public
function
roll
B
ack
()
{
public
function
roll
b
ack
()
{
if
(
$this
->
transactionLayers
==
0
)
{
if
(
$this
->
transactionLayers
==
0
)
{
throw
new
NoActiveTransactionException
();
throw
new
NoActiveTransactionException
();
}
}
$this
->
willRoll
B
ack
=
TRUE
;
$this
->
willRoll
b
ack
=
TRUE
;
}
}
/**
/**
...
@@ -867,12 +867,12 @@ public function rollBack() {
...
@@ -867,12 +867,12 @@ public function rollBack() {
* @return
* @return
* TRUE if the transaction will roll back, FALSE otherwise.
* TRUE if the transaction will roll back, FALSE otherwise.
*/
*/
public
function
willRoll
B
ack
()
{
public
function
willRoll
b
ack
()
{
if
(
$this
->
transactionLayers
==
0
)
{
if
(
$this
->
transactionLayers
==
0
)
{
throw
new
NoActiveTransactionException
();
throw
new
NoActiveTransactionException
();
}
}
return
$this
->
willRoll
B
ack
;
return
$this
->
willRoll
b
ack
;
}
}
/**
/**
...
@@ -1448,6 +1448,23 @@ public function __destruct() {
...
@@ -1448,6 +1448,23 @@ public function __destruct() {
$this
->
connection
->
popTransaction
();
$this
->
connection
->
popTransaction
();
}
}
/**
* Roll back the current transaction.
*
* This is just a wrapper method to rollback whatever transaction stack we
* are currently in, which is managed by the connection object itself.
*/
public
function
rollback
()
{
$this
->
connection
->
rollback
();
}
/**
* Determine if this transaction will roll back.
*/
public
function
willRollback
()
{
return
$this
->
connection
->
willRollback
();
}
}
}
/**
/**
...
...
This diff is collapsed.
Click to expand it.
modules/simpletest/tests/database_test.test
+
2
−
2
View file @
6682ab93
...
@@ -2624,8 +2624,8 @@ class DatabaseTransactionTestCase extends DatabaseTestCase {
...
@@ -2624,8 +2624,8 @@ class DatabaseTransactionTestCase extends DatabaseTestCase {
if
(
$rollback
)
{
if
(
$rollback
)
{
// Roll back the transaction, if requested.
// Roll back the transaction, if requested.
// This rollback should propagate to the the outer transaction, if present.
// This rollback should propagate to the the outer transaction, if present.
$
connectio
n
->
roll
B
ack
();
$
tx
n
->
roll
b
ack
();
$this
->
assertTrue
(
$
connectio
n
->
willRoll
B
ack
(),
t
(
'Transaction is scheduled to roll back after calling roll
B
ack().'
));
$this
->
assertTrue
(
$
tx
n
->
willRoll
b
ack
(),
t
(
'Transaction is scheduled to roll back after calling roll
b
ack().'
));
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment