From 28b38f054786014f436eefa019308eb8658cb711 Mon Sep 17 00:00:00 2001 From: "Paul S. Owen" Date: Tue, 5 Mar 2002 02:19:38 +0000 Subject: Fixed various transaction related issues and changed mssql-odbc name to ... mssql-odbc, hopefully this hasn't been (and won't be) responsible for any problems ... git-svn-id: file:///svn/phpbb/trunk@2269 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/db/mysql4.php | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'phpBB/db/mysql4.php') diff --git a/phpBB/db/mysql4.php b/phpBB/db/mysql4.php index a712265ff0..de01f42b09 100644 --- a/phpBB/db/mysql4.php +++ b/phpBB/db/mysql4.php @@ -105,7 +105,7 @@ class sql_db if( $query != "" ) { $this->num_queries++; - if( $transaction == BEGIN_TRANSACTION ) + if( $transaction == BEGIN_TRANSACTION && !$this->in_transaction ) { $result = mysql_query("BEGIN", $this->db_connect_id); if(!$result) @@ -117,15 +117,28 @@ class sql_db $this->query_result = mysql_query($query, $this->db_connect_id); } + else + { + if( $transaction == END_TRANSACTION && $this->in_transaction ) + { + $result = mysql_query("COMMIT", $this->db_connect_id); + } + } if( $this->query_result ) { unset($this->row[$this->query_result]); unset($this->rowset[$this->query_result]); - if( $transaction == END_TRANSACTION ) + if( $transaction == END_TRANSACTION && $this->in_transaction ) { - $result = mysql_query("COMMIT", $this->db_connect_id); + $this->in_transaction = FALSE; + + if ( !mysql_query("COMMIT", $this->db_connect_id) ) + { + mysql_query("ROLLBACK", $this->db_connect_id); + return false; + } } return $this->query_result; -- cgit v1.2.1