|
From: Paul S. O. <ps...@us...> - 2002-03-05 02:19:42
|
Update of /cvsroot/phpbb/phpBB2/db
In directory usw-pr-cvs1:/tmp/cvs-serv30790/db
Modified Files:
msaccess.php mssql-odbc.php mssql.php mysql4.php postgres7.php
Log Message:
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 ...
Index: msaccess.php
===================================================================
RCS file: /cvsroot/phpbb/phpBB2/db/msaccess.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** msaccess.php 28 Jan 2002 17:24:45 -0000 1.6
--- msaccess.php 5 Mar 2002 02:19:38 -0000 1.7
***************
*** 95,99 ****
$this->num_queries++;
! if( $transaction == BEGIN_TRANSACTION )
{
if( !odbc_autocommit($this->db_connect_id, false) )
--- 95,99 ----
$this->num_queries++;
! if( $transaction == BEGIN_TRANSACTION && !$this->in_transaction )
{
if( !odbc_autocommit($this->db_connect_id, false) )
***************
*** 196,202 ****
if( $transaction == END_TRANSACTION && $this->in_transaction )
{
- odbc_commit($this->db_connect_id);
- odbc_autocommit($this->db_connect_id, true);
$this->in_transaction = FALSE;
}
--- 196,208 ----
if( $transaction == END_TRANSACTION && $this->in_transaction )
{
$this->in_transaction = FALSE;
+
+ if ( !@odbc_commit($this->db_connect_id) )
+ {
+ odbc_rollback($this->db_connect_id);
+ odbc_autocommit($this->db_connect_id, true);
+ return false;
+ }
+ odbc_autocommit($this->db_connect_id, true);
}
***************
*** 205,209 ****
else
{
! return false;
}
}
--- 211,228 ----
else
{
! if( $transaction == END_TRANSACTION && $this->in_transaction )
! {
! $this->in_transaction = FALSE;
!
! if ( !@odbc_commit($this->db_connect_id) )
! {
! odbc_rollback($this->db_connect_id);
! odbc_autocommit($this->db_connect_id, true);
! return false;
! }
! odbc_autocommit($this->db_connect_id, true);
! }
!
! return true;
}
}
Index: mssql-odbc.php
===================================================================
RCS file: /cvsroot/phpbb/phpBB2/db/mssql-odbc.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** mssql-odbc.php 28 Jan 2002 17:24:45 -0000 1.5
--- mssql-odbc.php 5 Mar 2002 02:19:38 -0000 1.6
***************
*** 23,27 ****
{
! define("SQL_LAYER","mssql");
class sql_db
--- 23,27 ----
{
! define("SQL_LAYER","mssql-odbc");
class sql_db
***************
*** 94,98 ****
$this->num_queries++;
! if( $transaction == BEGIN_TRANSACTION )
{
if( !odbc_autocommit($this->db_connect_id, false) )
--- 94,98 ----
$this->num_queries++;
! if( $transaction == BEGIN_TRANSACTION && !$this->in_transaction )
{
if( !odbc_autocommit($this->db_connect_id, false) )
***************
*** 191,197 ****
if( $transaction == END_TRANSACTION && $this->in_transaction )
{
- odbc_commit($this->db_connect_id);
- odbc_autocommit($this->db_connect_id, true);
$this->in_transaction = FALSE;
}
--- 191,203 ----
if( $transaction == END_TRANSACTION && $this->in_transaction )
{
$this->in_transaction = FALSE;
+
+ if ( !odbc_commit($this->db_connect_id) )
+ {
+ odbc_rollback($this->db_connect_id);
+ odbc_autocommit($this->db_connect_id, true);
+ return false;
+ }
+ odbc_autocommit($this->db_connect_id, true);
}
***************
*** 202,206 ****
else
{
! return false;
}
}
--- 208,225 ----
else
{
! if( $transaction == END_TRANSACTION && $this->in_transaction )
! {
! $this->in_transaction = FALSE;
!
! if ( !@odbc_commit($this->db_connect_id) )
! {
! odbc_rollback($this->db_connect_id);
! odbc_autocommit($this->db_connect_id, true);
! return false;
! }
! odbc_autocommit($this->db_connect_id, true);
! }
!
! return true;
}
}
Index: mssql.php
===================================================================
RCS file: /cvsroot/phpbb/phpBB2/db/mssql.php,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -r1.21 -r1.22
*** mssql.php 28 Jan 2002 17:24:45 -0000 1.21
--- mssql.php 5 Mar 2002 02:19:38 -0000 1.22
***************
*** 101,111 ****
unset($this->row);
! if( $query != "" )
{
$this->num_queries++;
! if($transaction == BEGIN_TRANSACTION)
{
! if( !mssql_query("BEGIN TRANSACTION", $this->db_connect_id) )
{
return false;
--- 101,111 ----
unset($this->row);
! if ( $query != "" )
{
$this->num_queries++;
! if ( $transaction == BEGIN_TRANSACTION && !$this->in_transaction )
{
! if ( !mssql_query("BEGIN TRANSACTION", $this->db_connect_id) )
{
return false;
***************
*** 197,205 ****
if( $transaction == END_TRANSACTION && $this->in_transaction )
{
- mssql_query("COMMIT", $this->db_connect_id);
$this->in_transaction = FALSE;
}
return $this->result;
}
}
--- 197,225 ----
if( $transaction == END_TRANSACTION && $this->in_transaction )
{
$this->in_transaction = FALSE;
+
+ if( !@mssql_query("COMMIT", $this->db_connect_id) )
+ {
+ @mssql_query("ROLLBACK", $this->db_connect_id);
+ return false;
+ }
}
return $this->result;
+ }
+ else
+ {
+ if( $transaction == END_TRANSACTION && $this->in_transaction )
+ {
+ $this->in_transaction = FALSE;
+
+ if( !@mssql_query("COMMIT", $this->db_connect_id) )
+ {
+ @mssql_query("ROLLBACK", $this->db_connect_id);
+ return false;
+ }
+ }
+
+ return true;
}
}
Index: mysql4.php
===================================================================
RCS file: /cvsroot/phpbb/phpBB2/db/mysql4.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** mysql4.php 12 Feb 2002 16:59:49 -0000 1.3
--- mysql4.php 5 Mar 2002 02:19:38 -0000 1.4
***************
*** 106,110 ****
{
$this->num_queries++;
! if( $transaction == BEGIN_TRANSACTION )
{
$result = mysql_query("BEGIN", $this->db_connect_id);
--- 106,110 ----
{
$this->num_queries++;
! if( $transaction == BEGIN_TRANSACTION && !$this->in_transaction )
{
$result = mysql_query("BEGIN", $this->db_connect_id);
***************
*** 118,121 ****
--- 118,128 ----
$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 )
***************
*** 124,130 ****
unset($this->rowset[$this->query_result]);
! if( $transaction == END_TRANSACTION )
{
! $result = mysql_query("COMMIT", $this->db_connect_id);
}
--- 131,143 ----
unset($this->rowset[$this->query_result]);
! if( $transaction == END_TRANSACTION && $this->in_transaction )
{
! $this->in_transaction = FALSE;
!
! if ( !mysql_query("COMMIT", $this->db_connect_id) )
! {
! mysql_query("ROLLBACK", $this->db_connect_id);
! return false;
! }
}
Index: postgres7.php
===================================================================
RCS file: /cvsroot/phpbb/phpBB2/db/postgres7.php,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -r1.18 -r1.19
*** postgres7.php 11 Feb 2002 12:46:18 -0000 1.18
--- postgres7.php 5 Mar 2002 02:19:38 -0000 1.19
***************
*** 110,114 ****
}
-
//
// Query method
--- 110,113 ----
***************
*** 126,137 ****
$query = preg_replace("/LIMIT ([0-9]+),([ 0-9]+)/", "LIMIT \\2 OFFSET \\1", $query);
! if( $transaction == BEGIN_TRANSACTION )
{
! $result = @pg_exec($this->db_connect_id, "BEGIN");
! if( !$result )
{
return false;
}
- $this->in_transaction = TRUE;
}
--- 125,136 ----
$query = preg_replace("/LIMIT ([0-9]+),([ 0-9]+)/", "LIMIT \\2 OFFSET \\1", $query);
! if( $transaction == BEGIN_TRANSACTION && !$this->in_transaction )
{
! $this->in_transaction = TRUE;
!
! if( !@pg_exec($this->db_connect_id, "BEGIN") )
{
return false;
}
}
***************
*** 141,151 ****
if( $transaction == END_TRANSACTION )
{
! $result = @pg_exec($this->db_connect_id, "COMMIT");
! if( !$result )
{
@pg_exec($this->db_connect_id, "ROLLBACK");
return false;
}
- $this->in_transaction = FALSE;
}
--- 140,150 ----
if( $transaction == END_TRANSACTION )
{
! $this->in_transaction = FALSE;
!
! if( !@pg_exec($this->db_connect_id, "COMMIT") )
{
@pg_exec($this->db_connect_id, "ROLLBACK");
return false;
}
}
***************
*** 171,186 ****
else
{
! if( $transaction == END_TRANSACTION )
{
! $result = @pg_exec($this->db_connect_id, "COMMIT");
! if( !$result )
{
@pg_exec($this->db_connect_id, "ROLLBACK");
return false;
}
- $this->in_transaction = FALSE;
}
! return false;
}
}
--- 170,185 ----
else
{
! if( $transaction == END_TRANSACTION && $this->in_transaction )
{
! $this->in_transaction = FALSE;
!
! if( !@pg_exec($this->db_connect_id, "COMMIT") )
{
@pg_exec($this->db_connect_id, "ROLLBACK");
return false;
}
}
! return true;
}
}
|