Commit be0d79c4 authored by zYne's avatar zYne

Updated transaction drivers

parent 2459f8f5
...@@ -84,7 +84,7 @@ class Doctrine_Transaction_Firebird extends Doctrine_Transaction { ...@@ -84,7 +84,7 @@ class Doctrine_Transaction_Firebird extends Doctrine_Transaction {
* @throws Doctrine_Transaction_Exception if using unknown isolation level or unknown wait option * @throws Doctrine_Transaction_Exception if using unknown isolation level or unknown wait option
* @return void * @return void
*/ */
public function setTransactionIsolation($isolation, $options = array()) { public function setIsolation($isolation, $options = array()) {
switch ($isolation) { switch ($isolation) {
case 'READ UNCOMMITTED': case 'READ UNCOMMITTED':
$nativeIsolation = 'READ COMMITTED RECORD_VERSION'; $nativeIsolation = 'READ COMMITTED RECORD_VERSION';
......
...@@ -30,4 +30,39 @@ Doctrine::autoload('Doctrine_Transaction'); ...@@ -30,4 +30,39 @@ Doctrine::autoload('Doctrine_Transaction');
* @since 1.0 * @since 1.0
* @version $Revision$ * @version $Revision$
*/ */
class Doctrine_Transaction_Mssql extends Doctrine_Transaction { } class Doctrine_Transaction_Mssql extends Doctrine_Transaction {
/**
* Set the transacton isolation level.
*
* @param string standard isolation level (SQL-92)
* portable modes:
* READ UNCOMMITTED (allows dirty reads)
* READ COMMITTED (prevents dirty reads)
* REPEATABLE READ (prevents nonrepeatable reads)
* SERIALIZABLE (prevents phantom reads)
* mssql specific modes:
* SNAPSHOT
*
* @link http://msdn2.microsoft.com/en-us/library/ms173763.aspx
* @throws PDOException if something fails at the PDO level
* @throws Doctrine_Transaction_Exception if using unknown isolation level or unknown wait option
* @return void
*/
public function setIsolation($isolation, $options = array()) {
switch ($isolation) {
case 'READ UNCOMMITTED':
case 'READ COMMITTED':
case 'REPEATABLE READ':
case 'SERIALIZABLE':
case 'SNAPSHOT':
break;
default:
throw new Doctrine_Transaction_Exception('isolation level is not supported: ' . $isolation);
}
$query = 'SET TRANSACTION ISOLATION LEVEL ' . $isolation;
$this->conn->getDbh()->query($query);
}
}
...@@ -80,7 +80,7 @@ class Doctrine_Transaction_Mysql extends Doctrine_Transaction { ...@@ -80,7 +80,7 @@ class Doctrine_Transaction_Mysql extends Doctrine_Transaction {
* @throws PDOException if something fails at the PDO level * @throws PDOException if something fails at the PDO level
* @return void * @return void
*/ */
public function setTransactionIsolation($isolation) { public function setIsolation($isolation) {
switch ($isolation) { switch ($isolation) {
case 'READ UNCOMMITTED': case 'READ UNCOMMITTED':
case 'READ COMMITTED': case 'READ COMMITTED':
......
...@@ -78,7 +78,7 @@ class Doctrine_Transaction_Oracle extends Doctrine_Transaction { ...@@ -78,7 +78,7 @@ class Doctrine_Transaction_Oracle extends Doctrine_Transaction {
* @throws Doctrine_Transaction_Exception if using unknown isolation level * @throws Doctrine_Transaction_Exception if using unknown isolation level
* @return void * @return void
*/ */
public function setTransactionIsolation($isolation) { public function setIsolation($isolation) {
switch($isolation) { switch($isolation) {
case 'READ UNCOMMITTED': case 'READ UNCOMMITTED':
$isolation = 'READ COMMITTED'; $isolation = 'READ COMMITTED';
......
...@@ -80,7 +80,7 @@ class Doctrine_Transaction_Pgsql extends Doctrine_Transaction { ...@@ -80,7 +80,7 @@ class Doctrine_Transaction_Pgsql extends Doctrine_Transaction {
* @throws Doctrine_Transaction_Exception if using unknown isolation level or unknown wait option * @throws Doctrine_Transaction_Exception if using unknown isolation level or unknown wait option
* @return void * @return void
*/ */
public function setTransactionIsolation($isolation) { public function setIsolation($isolation) {
switch ($isolation) { switch ($isolation) {
case 'READ UNCOMMITTED': case 'READ UNCOMMITTED':
case 'READ COMMITTED': case 'READ COMMITTED':
......
...@@ -43,7 +43,7 @@ class Doctrine_Transaction_Sqlite extends Doctrine_Transaction { ...@@ -43,7 +43,7 @@ class Doctrine_Transaction_Sqlite extends Doctrine_Transaction {
* @throws Doctrine_Transaction_Exception if using unknown isolation level * @throws Doctrine_Transaction_Exception if using unknown isolation level
* @return void * @return void
*/ */
public function setTransactionIsolation($isolation) { public function setIsolation($isolation) {
switch ($isolation) { switch ($isolation) {
case 'READ UNCOMMITTED': case 'READ UNCOMMITTED':
$isolation = 0; $isolation = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment