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
cbf0120f
Commit
cbf0120f
authored
Dec 02, 2006
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixes #240
parent
127ad3a9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
87 additions
and
0 deletions
+87
-0
Transactions - Isolation levels.php
manual/docs/Transactions - Isolation levels.php
+31
-0
Transactions - Savepoints.php
manual/docs/Transactions - Savepoints.php
+56
-0
No files found.
manual/docs/Transactions - Isolation levels.php
0 → 100644
View file @
cbf0120f
<?php
?>
A transaction isolation level sets the default transactional behaviour.
As the name 'isolation level' suggests, the setting determines how isolated each transation is,
or what kind of locks are associated with queries inside a transaction.
The four availible levels are (in ascending order of strictness):
<br
\
><br
\
>
<i>
READ UNCOMMITTED
</i>
: Barely transactional, this setting allows for so-called 'dirty reads',
where queries inside one transaction are affected by uncommitted changes in another transaction.
<br
\
><br
\
>
<i>
READ COMMITTED
</i>
: Committed updates are visible within another transaction.
This means identical queries within a transaction can return differing results. This is the default in some DBMS's.
<br
\
>
<br
\
>
<i>
REPEATABLE READ
</i>
: Within a transaction, all reads are consistent. This is the default of Mysql INNODB engine.
<br
\
><br
\
>
<i>
SERIALIZABLE
</i>
: Updates are not permitted in other transactions if a transaction has run an ordinary SELECT query.
<br
\
><br
\
>
<?php
renderCode
(
"<?php
\$
tx =
\$
conn->transaction; // get the transaction module
// sets the isolation level to READ COMMITTED
\$
tx->setIsolation('READ COMMITTED');
// sets the isolation level to SERIALIZABLE
\$
tx->setIsolation('SERIALIZABLE');
// Some drivers (like Mysql) support the fetching of current transaction
// isolation level. It can be done as follows:
\$
level =
\$
tx->getIsolation();
?>"
);
?>
manual/docs/Transactions - Savepoints.php
0 → 100644
View file @
cbf0120f
<?php
?>
Doctrine supports transaction savepoints. This means you can set named transactions and have them nested.
<br
\
><br
\
>
The Doctrine_Transaction::beginTransaction(
<i>
$savepoint
</i>
) sets a named transaction savepoint with a name of
<i>
$savepoint
</i>
.
If the current transaction has a savepoint with the same name, the old savepoint is deleted and a new one is set.
<br
\
><br
\
>
<?php
renderCode
(
"<?php
try {
\$
conn->beginTransaction();
// do some operations here
// creates a new savepoint called mysavepoint
\$
conn->beginTransaction('mysavepoint');
try {
// do some operations here
\$
conn->commit('mysavepoint');
} catch(Exception
\$
e) {
\$
conn->rollback('mysavepoint');
}
\$
conn->commit();
} catch(Exception
\$
e) {
\$
conn->rollback();
}
?>"
);
?>
<br
\
><br
\
>
The Doctrine_Transaction::rollback(
<i>
$savepoint
</i>
) rolls back a transaction to the named savepoint.
Modifications that the current transaction made to rows after the savepoint was set are undone in the rollback.
NOTE: Mysql, for example, does not release the row locks that were stored in memory after the savepoint.
<br
\
><br
\
>
Savepoints that were set at a later time than the named savepoint are deleted.
<br
\
><br
\
>
The Doctrine_Transaction::commit(
<i>
$savepoint
</i>
) removes the named savepoint from the set of savepoints of the current transaction.
<br
\
><br
\
>
All savepoints of the current transaction are deleted if you execute a commit or rollback is being called without savepoint name parameter.
<?php
renderCode
(
"<?php
try {
\$
conn->beginTransaction();
// do some operations here
// creates a new savepoint called mysavepoint
\$
conn->beginTransaction('mysavepoint');
// do some operations here
\$
conn->commit(); // deletes all savepoints
} catch(Exception
\$
e) {
\$
conn->rollback(); // deletes all savepoints
}
?>"
);
?>
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