cvs: pear /MDB2/MDB2/Driver mysql.php mysqli.php oci8.php pgsql.php sqlite.php

From: Date: Sun, 18 Jun 2006 15:15:28 +0000
Subject: cvs: pear /MDB2/MDB2/Driver mysql.php mysqli.php oci8.php pgsql.php sqlite.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-40801@lists.php.net to get a copy of this message
lsmith Sun Jun 18 15:15:28 2006 UTC Modified files: /pear/MDB2/MDB2/Driver mysql.php mysqli.php oci8.php pgsql.php sqlite.php Log: - added setTransactionIsolation()

http://cvs.php.net/viewcvs.cgi/pear/MDB2/MDB2/Driver/mysql.php?r1=1.130&r2=1.131&diff_format=u Index: pear/MDB2/MDB2/Driver/mysql.php diff -u pear/MDB2/MDB2/Driver/mysql.php:1.130 pear/MDB2/MDB2/Driver/mysql.php:1.131 --- pear/MDB2/MDB2/Driver/mysql.php:1.130 Sun Jun 18 13:50:03 2006 +++ pear/MDB2/MDB2/Driver/mysql.php Sun Jun 18 15:15:28 2006 @@ -43,7 +43,7 @@ // | Author: Lukas Smith <smith@pooteeweet.org> | // +----------------------------------------------------------------------+ // -// $Id: mysql.php,v 1.130 2006/06/18 13:50:03 lsmith Exp $ +// $Id: mysql.php,v 1.131 2006/06/18 15:15:28 lsmith Exp $ // /** @@ -272,7 +272,43 @@ } $this->in_transaction = 0; return MDB2_OK; + } + + // }}} + // {{{ function setTransactionIsolation() + + /** + * Set the transacton isolation level. + * + * @param string standard isolation level + * READ UNCOMMITTED (allows dirty reads) + * READ COMMITTED (prevents dirty reads) + * REPEATABLE READ (prevents nonrepeatable reads) + * SERIALIZABLE (prevents phantom reads) + * @return mixed MDB2_OK on success, a MDB2 error on failure + * + * @access public + */ + function setTransactionIsolation($isolation) + { + $this->debug('setting transaction isolation level', 'setTransactionIsolation', false); + if (!$this->supports('transactions')) { + return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null, + 'setTransactionIsolation: transactions are not in use'); + } + switch ($isolation) { + case 'READ UNCOMMITTED': + case 'READ COMMITTED': + case 'REPEATABLE READ': + case 'SERIALIZABLE': + break; + default: + return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null, + 'setTransactionIsolation: isolation level is not supported: '.$isolation); + } + $query = "SET SESSION TRANSACTION ISOLATION LEVEL $isolation"; + return $this->_doQuery($query, true); } // }}} http://cvs.php.net/viewcvs.cgi/pear/MDB2/MDB2/Driver/mysqli.php?r1=1.108&r2=1.109&diff_format=u Index: pear/MDB2/MDB2/Driver/mysqli.php diff -u pear/MDB2/MDB2/Driver/mysqli.php:1.108 pear/MDB2/MDB2/Driver/mysqli.php:1.109 --- pear/MDB2/MDB2/Driver/mysqli.php:1.108 Sun Jun 18 13:50:03 2006 +++ pear/MDB2/MDB2/Driver/mysqli.php Sun Jun 18 15:15:28 2006 @@ -43,7 +43,7 @@ // | Author: Lukas Smith <smith@pooteeweet.org> | // +----------------------------------------------------------------------+ // -// $Id: mysqli.php,v 1.108 2006/06/18 13:50:03 lsmith Exp $ +// $Id: mysqli.php,v 1.109 2006/06/18 15:15:28 lsmith Exp $ // /** @@ -272,6 +272,43 @@ } // }}} + // {{{ function setTransactionIsolation() + + /** + * Set the transacton isolation level. + * + * @param string standard isolation level + * READ UNCOMMITTED (allows dirty reads) + * READ COMMITTED (prevents dirty reads) + * REPEATABLE READ (prevents nonrepeatable reads) + * SERIALIZABLE (prevents phantom reads) + * @return mixed MDB2_OK on success, a MDB2 error on failure + * + * @access public + */ + function setTransactionIsolation($isolation) + { + $this->debug('setting transaction isolation level', 'setTransactionIsolation', false); + if (!$this->supports('transactions')) { + return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null, + 'setTransactionIsolation: transactions are not in use'); + } + switch ($isolation) { + case 'READ UNCOMMITTED': + case 'READ COMMITTED': + case 'REPEATABLE READ': + case 'SERIALIZABLE': + break; + default: + return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null, + 'setTransactionIsolation: isolation level is not supported: '.$isolation); + } + + $query = "SET SESSION TRANSACTION ISOLATION LEVEL $isolation"; + return $this->_doQuery($query, true); + } + + // }}} // {{{ connect() /** http://cvs.php.net/viewcvs.cgi/pear/MDB2/MDB2/Driver/oci8.php?r1=1.155&r2=1.156&diff_format=u Index: pear/MDB2/MDB2/Driver/oci8.php diff -u pear/MDB2/MDB2/Driver/oci8.php:1.155 pear/MDB2/MDB2/Driver/oci8.php:1.156 --- pear/MDB2/MDB2/Driver/oci8.php:1.155 Sun Jun 18 13:50:04 2006 +++ pear/MDB2/MDB2/Driver/oci8.php Sun Jun 18 15:15:28 2006 @@ -43,7 +43,7 @@ // | Author: Lukas Smith <smith@pooteeweet.org> | // +----------------------------------------------------------------------+ -// $Id: oci8.php,v 1.155 2006/06/18 13:50:04 lsmith Exp $ +// $Id: oci8.php,v 1.156 2006/06/18 15:15:28 lsmith Exp $ /** * MDB2 OCI8 driver @@ -241,6 +241,41 @@ } // }}} + // {{{ function setTransactionIsolation() + + /** + * Set the transacton isolation level. + * + * @param string standard isolation level + * READ UNCOMMITTED (allows dirty reads) + * READ COMMITTED (prevents dirty reads) + * REPEATABLE READ (prevents nonrepeatable reads) + * SERIALIZABLE (prevents phantom reads) + * @return mixed MDB2_OK on success, a MDB2 error on failure + * + * @access public + */ + function setTransactionIsolation($isolation) + { + $this->debug('setting transaction isolation level', 'setTransactionIsolation', false); + switch ($isolation) { + case 'READ UNCOMMITTED': + $isolation = 'READ COMMITTED'; + case 'READ COMMITTED': + case 'REPEATABLE READ': + $isolation = 'SERIALIZABLE'; + case 'SERIALIZABLE': + break; + default: + return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null, + 'setTransactionIsolation: isolation level is not supported: '.$isolation); + } + + $query = "ALTER SESSION ISOLATION LEVEL $isolation"; + return $this->_doQuery($query, true); + } + + // }}} // {{{ _doConnect() /** http://cvs.php.net/viewcvs.cgi/pear/MDB2/MDB2/Driver/pgsql.php?r1=1.133&r2=1.134&diff_format=u Index: pear/MDB2/MDB2/Driver/pgsql.php diff -u pear/MDB2/MDB2/Driver/pgsql.php:1.133 pear/MDB2/MDB2/Driver/pgsql.php:1.134 --- pear/MDB2/MDB2/Driver/pgsql.php:1.133 Sun Jun 18 13:50:04 2006 +++ pear/MDB2/MDB2/Driver/pgsql.php Sun Jun 18 15:15:28 2006 @@ -43,7 +43,7 @@ // | Author: Paul Cooper <pgc@ucecom.com> | // +----------------------------------------------------------------------+ // -// $Id: pgsql.php,v 1.133 2006/06/18 13:50:04 lsmith Exp $ +// $Id: pgsql.php,v 1.134 2006/06/18 15:15:28 lsmith Exp $ /** * MDB2 PostGreSQL driver @@ -269,6 +269,39 @@ } // }}} + // {{{ function setTransactionIsolation() + + /** + * Set the transacton isolation level. + * + * @param string standard isolation level + * READ UNCOMMITTED (allows dirty reads) + * READ COMMITTED (prevents dirty reads) + * REPEATABLE READ (prevents nonrepeatable reads) + * SERIALIZABLE (prevents phantom reads) + * @return mixed MDB2_OK on success, a MDB2 error on failure + * + * @access public + */ + function setTransactionIsolation($isolation) + { + $this->debug('setting transaction isolation level', 'setTransactionIsolation', false); + switch ($isolation) { + case 'READ UNCOMMITTED': + case 'READ COMMITTED': + case 'REPEATABLE READ': + case 'SERIALIZABLE': + break; + default: + return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null, + 'setTransactionIsolation: isolation level is not supported: '.$isolation); + } + + $query = "SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL $isolation"; + return $this->_doQuery($query, true); + } + + // }}} // {{{ _doConnect() /** http://cvs.php.net/viewcvs.cgi/pear/MDB2/MDB2/Driver/sqlite.php?r1=1.119&r2=1.120&diff_format=u Index: pear/MDB2/MDB2/Driver/sqlite.php diff -u pear/MDB2/MDB2/Driver/sqlite.php:1.119 pear/MDB2/MDB2/Driver/sqlite.php:1.120 --- pear/MDB2/MDB2/Driver/sqlite.php:1.119 Sun Jun 18 13:50:04 2006 +++ pear/MDB2/MDB2/Driver/sqlite.php Sun Jun 18 15:15:28 2006 @@ -43,7 +43,7 @@ // | Author: Lukas Smith <smith@pooteeweet.org> | // +----------------------------------------------------------------------+ // -// $Id: sqlite.php,v 1.119 2006/06/18 13:50:04 lsmith Exp $ +// $Id: sqlite.php,v 1.120 2006/06/18 15:15:28 lsmith Exp $ // /** @@ -244,6 +244,46 @@ } // }}} + // {{{ function setTransactionIsolation() + + /** + * Set the transacton isolation level. + * + * @param string standard isolation level + * READ UNCOMMITTED (allows dirty reads) + * READ COMMITTED (prevents dirty reads) + * REPEATABLE READ (prevents nonrepeatable reads) + * SERIALIZABLE (prevents phantom reads) + * @return mixed MDB2_OK on success, a MDB2 error on failure + * + * @access public + */ + function setTransactionIsolation($isolation) + { + $this->debug('setting transaction isolation level', 'setTransactionIsolation', false); + if (!$this->supports('transactions')) { + return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null, + 'setTransactionIsolation: transactions are not in use'); + } + switch ($isolation) { + case 'READ UNCOMMITTED': + $isolation = 0; + break; + case 'READ COMMITTED': + case 'REPEATABLE READ': + case 'SERIALIZABLE': + $isolation = 1; + break; + default: + return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null, + 'setTransactionIsolation: isolation level is not supported: '.$isolation); + } + + $query = "PRAGMA read_uncommitted=$isolation"; + return $this->_doQuery($query, true); + } + + // }}} // {{{ getDatabaseFile() /**
« previous php.pear.cvs (#40801) next »