3
* $Id: Mysql.php 4252 2008-04-19 07:37:53Z jwage $
5
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
6
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
7
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
8
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
9
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
10
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
11
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
12
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
13
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
14
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
15
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
17
* This software consists of voluntary contributions made by many individuals
18
* and is licensed under the LGPL. For more information, see
19
* <http://www.phpdoctrine.org>.
24
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
25
* @author Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library)
26
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
28
* @subpackage Transaction
29
* @link www.phpdoctrine.org
31
* @version $Revision: 4252 $
33
class Doctrine_Transaction_Mysql extends Doctrine_Transaction
37
* creates a new savepoint
39
* @param string $savepoint name of a savepoint to set
42
protected function createSavePoint($savepoint)
44
$query = 'SAVEPOINT ' . $savepoint;
46
return $this->conn->execute($query);
51
* releases given savepoint
53
* @param string $savepoint name of a savepoint to release
56
protected function releaseSavePoint($savepoint)
58
$query = 'RELEASE SAVEPOINT ' . $savepoint;
60
return $this->conn->execute($query);
65
* releases given savepoint
67
* @param string $savepoint name of a savepoint to rollback to
70
protected function rollbackSavePoint($savepoint)
72
$query = 'ROLLBACK TO SAVEPOINT ' . $savepoint;
74
return $this->conn->execute($query);
78
* Set the transacton isolation level.
80
* @param string standard isolation level
81
* READ UNCOMMITTED (allows dirty reads)
82
* READ COMMITTED (prevents dirty reads)
83
* REPEATABLE READ (prevents nonrepeatable reads)
84
* SERIALIZABLE (prevents phantom reads)
86
* @throws Doctrine_Transaction_Exception if using unknown isolation level
87
* @throws PDOException if something fails at the PDO level
90
public function setIsolation($isolation)
93
case 'READ UNCOMMITTED':
94
case 'READ COMMITTED':
95
case 'REPEATABLE READ':
99
throw new Doctrine_Transaction_Exception('Isolation level ' . $isolation . ' is not supported.');
102
$query = 'SET SESSION TRANSACTION ISOLATION LEVEL ' . $isolation;
104
return $this->conn->execute($query);
108
* getTransactionIsolation
110
* @return string returns the current session transaction isolation level
112
public function getIsolation()
114
return $this->conn->fetchOne('SELECT @@tx_isolation');
b'\\ No newline at end of file'