1
0
mirror of synced 2024-12-14 07:06:04 +03:00

Updated transaction drivers

This commit is contained in:
zYne 2006-11-14 21:57:11 +00:00
parent 2459f8f593
commit be0d79c48f
6 changed files with 42 additions and 7 deletions

View File

@ -84,7 +84,7 @@ class Doctrine_Transaction_Firebird extends Doctrine_Transaction {
* @throws Doctrine_Transaction_Exception if using unknown isolation level or unknown wait option
* @return void
*/
public function setTransactionIsolation($isolation, $options = array()) {
public function setIsolation($isolation, $options = array()) {
switch ($isolation) {
case 'READ UNCOMMITTED':
$nativeIsolation = 'READ COMMITTED RECORD_VERSION';

View File

@ -30,4 +30,39 @@ Doctrine::autoload('Doctrine_Transaction');
* @since 1.0
* @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);
}
}

View File

@ -80,7 +80,7 @@ class Doctrine_Transaction_Mysql extends Doctrine_Transaction {
* @throws PDOException if something fails at the PDO level
* @return void
*/
public function setTransactionIsolation($isolation) {
public function setIsolation($isolation) {
switch ($isolation) {
case 'READ UNCOMMITTED':
case 'READ COMMITTED':
@ -93,7 +93,7 @@ class Doctrine_Transaction_Mysql extends Doctrine_Transaction {
}
$query = "SET SESSION TRANSACTION ISOLATION LEVEL $isolation";
return $this->conn->getDbh()->query($query);
}
/**

View File

@ -78,7 +78,7 @@ class Doctrine_Transaction_Oracle extends Doctrine_Transaction {
* @throws Doctrine_Transaction_Exception if using unknown isolation level
* @return void
*/
public function setTransactionIsolation($isolation) {
public function setIsolation($isolation) {
switch($isolation) {
case 'READ UNCOMMITTED':
$isolation = 'READ COMMITTED';

View File

@ -80,7 +80,7 @@ class Doctrine_Transaction_Pgsql extends Doctrine_Transaction {
* @throws Doctrine_Transaction_Exception if using unknown isolation level or unknown wait option
* @return void
*/
public function setTransactionIsolation($isolation) {
public function setIsolation($isolation) {
switch ($isolation) {
case 'READ UNCOMMITTED':
case 'READ COMMITTED':

View File

@ -43,7 +43,7 @@ class Doctrine_Transaction_Sqlite extends Doctrine_Transaction {
* @throws Doctrine_Transaction_Exception if using unknown isolation level
* @return void
*/
public function setTransactionIsolation($isolation) {
public function setIsolation($isolation) {
switch ($isolation) {
case 'READ UNCOMMITTED':
$isolation = 0;