cvs: pear /MDB2/MDB2/Driver fbsql.php ibase.php mssql.php mysql.php oci8.php pgsql.php sqlite.php /MDB2/MDB2/Driver/Datatype ibase.php pgsql.php

From: Date: Thu, 25 Nov 2004 14:28:38 +0000
Subject: cvs: pear /MDB2/MDB2/Driver fbsql.php ibase.php mssql.php mysql.php oci8.php pgsql.php sqlite.php /MDB2/MDB2/Driver/Datatype ibase.php pgsql.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-26491@lists.php.net to get a copy of this message
lsmith Thu Nov 25 09:28:38 2004 EDT Modified files: /pear/MDB2/MDB2/Driver fbsql.php ibase.php mssql.php mysql.php oci8.php pgsql.php sqlite.php /pear/MDB2/MDB2/Driver/Datatype ibase.php pgsql.php Log: - removed destructor .. we will leave closing of open transactions to the given RDBMS (ext) - use in_transaction property instead of auto_commit property to determine if inside a transaction

http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/fbsql.php?r1=1.35&r2=1.36&ty=u Index: pear/MDB2/MDB2/Driver/fbsql.php diff -u pear/MDB2/MDB2/Driver/fbsql.php:1.35 pear/MDB2/MDB2/Driver/fbsql.php:1.36 --- pear/MDB2/MDB2/Driver/fbsql.php:1.35 Thu Nov 25 06:11:33 2004 +++ pear/MDB2/MDB2/Driver/fbsql.php Thu Nov 25 09:28:38 2004 @@ -43,7 +43,7 @@ // | Author: Lukas Smith <smith@backendmedia.com> | // +----------------------------------------------------------------------+ // -// $Id: fbsql.php,v 1.35 2004/11/25 11:11:33 quipo Exp $ +// $Id: fbsql.php,v 1.36 2004/11/25 14:28:38 lsmith Exp $ // /** @@ -154,10 +154,6 @@ if ($this->in_transaction) { return MDB2_OK; //nothing to do } - if (!$this->destructor_registered) { - $this->destructor_registered = true; - $this->PEAR(); - } $result = $this->_doQuery('SET COMMIT FALSE'); if (MDB2::isError($result)) { return $result; @@ -271,15 +267,7 @@ $this->connected_dsn = $this->dsn; $this->connected_database_name = ''; $this->opened_persistent = $this->options['persistent']; - /* - if ($this->supports('transactions') && !$this->auto_commit) { - if (!@fbsql_query('SET AUTOCOMMIT FALSE;', $this->connection)) { - $this->_close(); - return $this->raiseError(); - } - $this->in_transaction = true; - } - */ + return MDB2_OK; } @@ -294,12 +282,6 @@ function _close() { if ($this->connection != 0) { - if ($this->supports('transactions') && !$this->auto_commit) { - $result = $this->rollback(); - if (MDB2::isError($result)) { - return $result; - } - } @fbsql_close($this->connection); $this->connection = 0; } http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/ibase.php?r1=1.62&r2=1.63&ty=u Index: pear/MDB2/MDB2/Driver/ibase.php diff -u pear/MDB2/MDB2/Driver/ibase.php:1.62 pear/MDB2/MDB2/Driver/ibase.php:1.63 --- pear/MDB2/MDB2/Driver/ibase.php:1.62 Thu Nov 25 06:11:33 2004 +++ pear/MDB2/MDB2/Driver/ibase.php Thu Nov 25 09:28:38 2004 @@ -43,7 +43,7 @@ // | Author: Lorenzo Alberton <l.alberton@quipo.it> | // +----------------------------------------------------------------------+ // -// $Id: ibase.php,v 1.62 2004/11/25 11:11:33 quipo Exp $ +// $Id: ibase.php,v 1.63 2004/11/25 14:28:38 lsmith Exp $ /** * MDB2 FireBird/InterBase driver @@ -220,10 +220,6 @@ if ($this->in_transaction) { return MDB2_OK; //nothing to do } - if (!$this->destructor_registered) { - $this->destructor_registered = true; - $this->PEAR(); - } $result = ibase_trans(); if (!$result) { return $this->raiseError(MDB2_ERROR, null, null, @@ -386,12 +382,6 @@ $this->connected_dsn = $this->dsn; $this->connected_database_name = $database_file; $this->opened_persistent = $this->options['persistent']; -/* - if (!$this->in_transaction && MDB2::isError($trans_result = $this->beginTransaction())) { - $this->_close(); - return $trans_result; - } -*/ } return MDB2_OK; } @@ -408,22 +398,8 @@ function _close() { if ($this->connection != 0) { - /* - //done automatically by ibase_close(); - if ($this->supports('transactions') && $this->in_transaction) { - $result = $this->rollback(); - if (MDB2::isError($result)) { - return $result; - } - } - */ ibase_close($this->connection); $this->connection = 0; - /* - if (isset($result) && MDB2::isError($result)) { - return $result; - } - */ } return MDB2_OK; } @@ -456,9 +432,11 @@ $connection = $this->transaction_id; } else { $err = $this->connect(); + if (MDB2::isError($err)) { + return $err; + } $connection = $this->connection; } - //$connection = ($this->in_transaction ? $this->transaction_id : $this->connection); } $result = ibase_query($connection, $query); @@ -559,7 +537,7 @@ } $connection = ($this->in_transaction ? $this->transaction_id : $this->connection); $statement = ibase_prepare($connection, $query); - + $class_name = 'MDB2_Statement_'.$this->phptype; $obj =& new $class_name($this, $statement, $query, $types, $result_types); return $obj; http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/mssql.php?r1=1.42&r2=1.43&ty=u Index: pear/MDB2/MDB2/Driver/mssql.php diff -u pear/MDB2/MDB2/Driver/mssql.php:1.42 pear/MDB2/MDB2/Driver/mssql.php:1.43 --- pear/MDB2/MDB2/Driver/mssql.php:1.42 Thu Nov 25 06:11:33 2004 +++ pear/MDB2/MDB2/Driver/mssql.php Thu Nov 25 09:28:38 2004 @@ -43,7 +43,7 @@ // | Author: Frank M. Kromann <frank@kromann.info> | // +----------------------------------------------------------------------+ // -// $Id: mssql.php,v 1.42 2004/11/25 11:11:33 quipo Exp $ +// $Id: mssql.php,v 1.43 2004/11/25 14:28:38 lsmith Exp $ // /** @@ -172,10 +172,6 @@ if ($this->in_transaction) { return MDB2_OK; //nothing to do } - if (!$this->destructor_registered) { - $this->destructor_registered = true; - $this->PEAR(); - } $result = $this->_doQuery('BEGIN TRANSACTION'); if (MDB2::isError($result)) { return $result; @@ -284,14 +280,6 @@ $this->connected_database_name = ''; $this->opened_persistent = $this->options['persistent']; - if ($this->supports('transactions') - && !$this->auto_commit - && !@mssql_query('BEGIN TRANSACTION', $this->connection) - ) { - $this->_close(); - return $this->raiseError('connect: Could not begin the initial transaction'); - } - if ((bool) ini_get('mssql.datetimeconvert')) { ini_set('mssql.datetimeconvert', '0'); } @@ -311,7 +299,7 @@ function _close() { if ($this->connection != 0) { - if ($this->supports('transactions') && !$this->auto_commit) { + if ($this->supports('transactions') && !$this->in_transaction) { $result = $this->rollback(); if (MDB2::isError($result)) { return $result; http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/mysql.php?r1=1.38&r2=1.39&ty=u Index: pear/MDB2/MDB2/Driver/mysql.php diff -u pear/MDB2/MDB2/Driver/mysql.php:1.38 pear/MDB2/MDB2/Driver/mysql.php:1.39 --- pear/MDB2/MDB2/Driver/mysql.php:1.38 Thu Nov 25 06:11:33 2004 +++ pear/MDB2/MDB2/Driver/mysql.php Thu Nov 25 09:28:38 2004 @@ -43,7 +43,7 @@ // | Author: Lukas Smith <smith@backendmedia.com> | // +----------------------------------------------------------------------+ // -// $Id: mysql.php,v 1.38 2004/11/25 11:11:33 quipo Exp $ +// $Id: mysql.php,v 1.39 2004/11/25 14:28:38 lsmith Exp $ // /** @@ -355,15 +355,6 @@ ' is not a supported default table type'; } } - /* - if ($this->supports('transactions') && !$this->in_transaction) { - if (!@mysql_query('SET AUTOCOMMIT = 0', $this->connection)) { - $this->_close(); - return $this->raiseError(); - } - $this->in_transaction = true; - } - */ return MDB2_OK; } @@ -379,12 +370,6 @@ function _close() { if ($this->connection != 0) { - if ($this->supports('transactions') && !$this->auto_commit) { - $result = $this->rollback(); - if (MDB2::isError($result)) { - return $result; - } - } @mysql_close($this->connection); $this->connection = 0; } http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/oci8.php?r1=1.46&r2=1.47&ty=u Index: pear/MDB2/MDB2/Driver/oci8.php diff -u pear/MDB2/MDB2/Driver/oci8.php:1.46 pear/MDB2/MDB2/Driver/oci8.php:1.47 --- pear/MDB2/MDB2/Driver/oci8.php:1.46 Thu Nov 25 06:11:33 2004 +++ pear/MDB2/MDB2/Driver/oci8.php Thu Nov 25 09:28:38 2004 @@ -43,7 +43,7 @@ // | Author: Lukas Smith <smith@backendmedia.com> | // +----------------------------------------------------------------------+ -// $Id: oci8.php,v 1.46 2004/11/25 11:11:33 quipo Exp $ +// $Id: oci8.php,v 1.47 2004/11/25 14:28:38 lsmith Exp $ /** * MDB2 OCI8 driver @@ -161,10 +161,6 @@ if ($this->in_transaction) { return MDB2_OK; //nothing to do } - if (!$this->destructor_registered) { - $this->destructor_registered = true; - $this->PEAR(); - } $this->in_transaction = true; return MDB2_OK; } @@ -325,12 +321,6 @@ function _close() { if ($this->connection != 0) { - if ($this->supports('transactions') && !$this->auto_commit) { - $result = $this->rollback(); - if (MDB2::isError($result)) { - return $result; - } - } @OCILogOff($this->connection); $this->connection = 0; $this->uncommitedqueries = 0; @@ -435,7 +425,7 @@ 'Could not create statement'); } - $mode = $this->auto_commit ? OCI_COMMIT_ON_SUCCESS : OCI_DEFAULT; + $mode = $this->in_transaction ? OCI_DEFAULT : OCI_COMMIT_ON_SUCCESS; $return = @OCIExecute($result, $mode); if (!$return) { return $this->raiseError($result); @@ -1028,7 +1018,7 @@ } } - $mode = (empty($lobs) && $this->db->auto_commit) ? OCI_COMMIT_ON_SUCCESS : OCI_DEFAULT; + $mode = (empty($lobs) && $this->db->in_transaction) ? OCI_DEFAULT : OCI_COMMIT_ON_SUCCESS; $return = @OCIExecute($this->statement, $mode); if (!$return) { return $this->db->raiseError($this->statement); @@ -1049,15 +1039,9 @@ } if (!MDB2::isError($success)) { - if ($this->db->auto_commit) { - if (MDB2::isError($success)) { - if (!OCIRollback($this->db->connection)) { - $success = $this->db->raiseError(); - } - } else { - if (!OCICommit($this->db->connection)) { - $success = $this->db->raiseError(); - } + if (!$this->db->in_transaction) { + if (!OCICommit($this->db->connection)) { + $success = $this->db->raiseError(); } } else { ++$this->db->uncommitedqueries; http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/pgsql.php?r1=1.40&r2=1.41&ty=u Index: pear/MDB2/MDB2/Driver/pgsql.php diff -u pear/MDB2/MDB2/Driver/pgsql.php:1.40 pear/MDB2/MDB2/Driver/pgsql.php:1.41 --- pear/MDB2/MDB2/Driver/pgsql.php:1.40 Thu Nov 25 06:11:33 2004 +++ pear/MDB2/MDB2/Driver/pgsql.php Thu Nov 25 09:28:38 2004 @@ -43,7 +43,7 @@ // | Author: Paul Cooper <pgc@ucecom.com> | // +----------------------------------------------------------------------+ // -// $Id: pgsql.php,v 1.40 2004/11/25 11:11:33 quipo Exp $ +// $Id: pgsql.php,v 1.41 2004/11/25 14:28:38 lsmith Exp $ /** * MDB2 PostGreSQL driver @@ -148,16 +148,12 @@ * @return mixed MDB2_OK on success, a MDB2 error on failure * @access public */ - function beginTransaction($auto_commit) + function beginTransaction() { $this->debug('starting transaction', 'beginTransaction'); if ($this->in_transaction) { return MDB2_OK; //nothing to do } - if (!$this->destructor_registered) { - $this->destructor_registered = true; - $this->PEAR(); - } $result = $this->_doQuery('BEGIN'); if (MDB2::isError($result)) { return $result; @@ -319,14 +315,6 @@ $this->connected_dsn = $this->dsn; $this->connected_database_name = $this->database_name; $this->opened_persistent = $this->options['persistent']; - /* - if (!$this->auto_commit - && MDB2::isError($trans_result = $this->_doQuery('BEGIN')) - ) { - $this->_close(); - return $trans_result; - } - */ } return MDB2_OK; } @@ -342,12 +330,6 @@ function _close() { if ($this->connection != 0) { - if ($this->supports('transactions') && !$this->auto_commit) { - $result = $this->rollback(); - if (MDB2::isError($result)) { - return $result; - } - } @pg_close($this->connection); $this->connection = 0; } http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/sqlite.php?r1=1.38&r2=1.39&ty=u Index: pear/MDB2/MDB2/Driver/sqlite.php diff -u pear/MDB2/MDB2/Driver/sqlite.php:1.38 pear/MDB2/MDB2/Driver/sqlite.php:1.39 --- pear/MDB2/MDB2/Driver/sqlite.php:1.38 Thu Nov 25 06:11:33 2004 +++ pear/MDB2/MDB2/Driver/sqlite.php Thu Nov 25 09:28:38 2004 @@ -43,7 +43,7 @@ // | Author: Lukas Smith <smith@backendmedia.com> | // +----------------------------------------------------------------------+ // -// $Id: sqlite.php,v 1.38 2004/11/25 11:11:33 quipo Exp $ +// $Id: sqlite.php,v 1.39 2004/11/25 14:28:38 lsmith Exp $ // /** @@ -175,10 +175,6 @@ if ($this->in_transaction) { return MDB2_OK; //nothing to do } - if (!$this->destructor_registered) { - $this->destructor_registered = true; - $this->PEAR(); - } $query = 'BEGIN TRANSACTION '.$this->options['base_transaction_name']; $result = $this->_doQuery($query); if (MDB2::isError($result)) { @@ -324,15 +320,6 @@ $this->connected_dsn = $this->dsn; $this->connected_database_name = $database_file; $this->opened_persistent = $this->getoption('persistent'); - - if (!$this->auto_commit) { - $query = 'BEGIN TRANSACTION '.$this->options['base_transaction_name']; - if (!@sqlite_query($query, $this->connection)) { - $this->_close(); - return $this->raiseError('connect: Could not start transaction'); - } - $this->in_transaction = true; - } } return MDB2_OK; } @@ -348,12 +335,6 @@ function _close() { if ($this->connection != 0) { - if ($this->supports('transactions') && !$this->auto_commit) { - $result = $this->rollback(); - if (MDB2::isError($result)) { - return $result; - } - } @sqlite_close($this->connection); $this->connection = 0; } @@ -405,6 +386,7 @@ $result = @$function($query.';', $connection); ini_restore('track_errors'); $this->_lasterror = isset($php_errormsg) ? $php_errormsg : ''; + if (!$result) { return $this->raiseError(); } http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/Datatype/ibase.php?r1=1.18&r2=1.19&ty=u Index: pear/MDB2/MDB2/Driver/Datatype/ibase.php diff -u pear/MDB2/MDB2/Driver/Datatype/ibase.php:1.18 pear/MDB2/MDB2/Driver/Datatype/ibase.php:1.19 --- pear/MDB2/MDB2/Driver/Datatype/ibase.php:1.18 Fri Oct 29 15:47:23 2004 +++ pear/MDB2/MDB2/Driver/Datatype/ibase.php Thu Nov 25 09:28:38 2004 @@ -43,7 +43,7 @@ // | Author: Lukas Smith <smith@backendmedia.com> | // +----------------------------------------------------------------------+ // -// $Id: ibase.php,v 1.18 2004/10/29 19:47:23 lsmith Exp $ +// $Id: ibase.php,v 1.19 2004/11/25 14:28:38 lsmith Exp $ // require_once 'MDB2/Driver/Datatype/Common.php'; @@ -428,7 +428,7 @@ @rewind($fp); $value = $fp; } - $handle = @ibase_blob_create($db->auto_commit ? $db->connection : $db->transaction_id); + $handle = @ibase_blob_create($db->in_transaction ? $db->transaction_id : $db->connection); if ($handle) { while (!@feof($value)) { $data = @fread($value, $db->options['lob_buffer_length']); @@ -451,7 +451,7 @@ $result = $db->raiseError(); } - if (!$db->auto_commit) { + if ($db->in_transaction) { $db->commit(); } return $value; http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/Datatype/pgsql.php?r1=1.11&r2=1.12&ty=u Index: pear/MDB2/MDB2/Driver/Datatype/pgsql.php diff -u pear/MDB2/MDB2/Driver/Datatype/pgsql.php:1.11 pear/MDB2/MDB2/Driver/Datatype/pgsql.php:1.12 --- pear/MDB2/MDB2/Driver/Datatype/pgsql.php:1.11 Wed Oct 27 12:56:57 2004 +++ pear/MDB2/MDB2/Driver/Datatype/pgsql.php Thu Nov 25 09:28:38 2004 @@ -42,7 +42,7 @@ // | Author: Paul Cooper <pgc@ucecom.com> | // +----------------------------------------------------------------------+ // -// $Id: pgsql.php,v 1.11 2004/10/27 16:56:57 lsmith Exp $ +// $Id: pgsql.php,v 1.12 2004/11/25 14:28:38 lsmith Exp $ require_once 'MDB2/Driver/Datatype/Common.php'; @@ -389,7 +389,7 @@ if (MDB2::isError($connect)) { return $connect; } - if ($db->auto_commit && !@pg_exec($db->connection, 'BEGIN')) { + if (!$db->in_transaction && !@pg_exec($db->connection, 'BEGIN')) { return $db->raiseError(MDB2_ERROR, null, null, 'error starting transaction'); } @@ -432,7 +432,7 @@ } else { $result = $db->raiseError(); } - if ($db->auto_commit) { + if (!$db->in_transaction) { @pg_exec($db->connection, 'END'); } if (MDB2::isError($result)) { @@ -547,7 +547,7 @@ 'did not specified a valid lob'); } if (!isset($db->lobs[$lob]['handle'])) { - if ($db->auto_commit) { + if (!$db->in_transaction) { if (!pg_exec($db->connection, 'BEGIN')) { return $db->raiseError(); }
« previous php.pear.cvs (#26491) next »