mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-03 23:37:39 +02:00
ok, this one is rather large... the most important change:
re-introduce append_sid: old style continues to work, not a performance hog as it was in 2.0.x -> structure is different apart from this, code cleanage, bug fixing, etc. git-svn-id: file:///svn/phpbb/trunk@6015 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
@@ -120,6 +120,48 @@ class dbal
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* SQL Transaction
|
||||
* @private
|
||||
*/
|
||||
function sql_transaction($status = 'begin')
|
||||
{
|
||||
switch ($status)
|
||||
{
|
||||
case 'begin':
|
||||
// Commit previously opened transaction before opening another transaction
|
||||
if ($this->transaction)
|
||||
{
|
||||
$this->_sql_transaction('commit');
|
||||
}
|
||||
|
||||
$result = $this->_sql_transaction('begin');
|
||||
$this->transaction = true;
|
||||
break;
|
||||
|
||||
case 'commit':
|
||||
$result = $this->_sql_transaction('commit');
|
||||
$this->transaction = false;
|
||||
|
||||
if (!$result)
|
||||
{
|
||||
$this->_sql_transaction('rollback');
|
||||
}
|
||||
break;
|
||||
|
||||
case 'rollback':
|
||||
$result = $this->_sql_transaction('rollback');
|
||||
$this->transaction = false;
|
||||
break;
|
||||
|
||||
default:
|
||||
$result = $this->_sql_transaction($status);
|
||||
break;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build sql statement from array for insert/update/select statements
|
||||
*
|
||||
@@ -328,7 +370,7 @@ class dbal
|
||||
*/
|
||||
function sql_report($mode, $query = '')
|
||||
{
|
||||
global $cache, $starttime, $phpbb_root_path, $user, $SID;
|
||||
global $cache, $starttime, $phpbb_root_path, $user;
|
||||
|
||||
if (empty($_GET['explain']))
|
||||
{
|
||||
|
@@ -49,37 +49,27 @@ class dbal_firebird extends dbal
|
||||
}
|
||||
|
||||
/**
|
||||
* sql transaction
|
||||
* SQL Transaction
|
||||
* @private
|
||||
*/
|
||||
function sql_transaction($status = 'begin')
|
||||
function _sql_transaction($status = 'begin')
|
||||
{
|
||||
switch ($status)
|
||||
{
|
||||
case 'begin':
|
||||
$result = true;
|
||||
$this->transaction = true;
|
||||
return true;
|
||||
break;
|
||||
|
||||
case 'commit':
|
||||
$result = @ibase_commit();
|
||||
$this->transaction = false;
|
||||
|
||||
if (!$result)
|
||||
{
|
||||
@ibase_rollback();
|
||||
}
|
||||
return @ibase_commit();
|
||||
break;
|
||||
|
||||
case 'rollback':
|
||||
$result = @ibase_rollback();
|
||||
$this->transaction = false;
|
||||
return @ibase_rollback();
|
||||
break;
|
||||
|
||||
default:
|
||||
$result = true;
|
||||
}
|
||||
|
||||
return $result;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -56,37 +56,27 @@ class dbal_mssql extends dbal
|
||||
}
|
||||
|
||||
/**
|
||||
* sql transaction
|
||||
* SQL Transaction
|
||||
* @private
|
||||
*/
|
||||
function sql_transaction($status = 'begin')
|
||||
function _sql_transaction($status = 'begin')
|
||||
{
|
||||
switch ($status)
|
||||
{
|
||||
case 'begin':
|
||||
$result = @mssql_query('BEGIN TRANSACTION', $this->db_connect_id);
|
||||
$this->transaction = true;
|
||||
return @mssql_query('BEGIN TRANSACTION', $this->db_connect_id);
|
||||
break;
|
||||
|
||||
case 'commit':
|
||||
$result = @mssql_query('commit', $this->db_connect_id);
|
||||
$this->transaction = false;
|
||||
|
||||
if (!$result)
|
||||
{
|
||||
@mssql_query('ROLLBACK', $this->db_connect_id);
|
||||
}
|
||||
return @mssql_query('commit', $this->db_connect_id);
|
||||
break;
|
||||
|
||||
case 'rollback':
|
||||
$result = @mssql_query('ROLLBACK', $this->db_connect_id);
|
||||
$this->transaction = false;
|
||||
return @mssql_query('ROLLBACK', $this->db_connect_id);
|
||||
break;
|
||||
|
||||
default:
|
||||
$result = true;
|
||||
}
|
||||
|
||||
return $result;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -50,40 +50,31 @@ class dbal_mssql_odbc extends dbal
|
||||
}
|
||||
|
||||
/**
|
||||
* sql transaction
|
||||
* SQL Transaction
|
||||
* @private
|
||||
*/
|
||||
function sql_transaction($status = 'begin')
|
||||
function _sql_transaction($status = 'begin')
|
||||
{
|
||||
switch ($status)
|
||||
{
|
||||
case 'begin':
|
||||
$result = @odbc_autocommit($this->db_connect_id, false);
|
||||
$this->transaction = true;
|
||||
return @odbc_autocommit($this->db_connect_id, false);
|
||||
break;
|
||||
|
||||
case 'commit':
|
||||
$result = @odbc_commit($this->db_connect_id);
|
||||
@odbc_autocommit($this->db_connect_id, true);
|
||||
$this->transaction = false;
|
||||
|
||||
if (!$result)
|
||||
{
|
||||
@odbc_rollback($this->db_connect_id);
|
||||
@odbc_autocommit($this->db_connect_id, true);
|
||||
}
|
||||
return $result;
|
||||
break;
|
||||
|
||||
case 'rollback':
|
||||
$result = @odbc_rollback($this->db_connect_id);
|
||||
@odbc_autocommit($this->db_connect_id, true);
|
||||
$this->transaction = false;
|
||||
return $result;
|
||||
break;
|
||||
|
||||
default:
|
||||
$result = true;
|
||||
}
|
||||
|
||||
return $result;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -56,37 +56,27 @@ class dbal_mysql extends dbal
|
||||
}
|
||||
|
||||
/**
|
||||
* sql transaction
|
||||
* SQL Transaction
|
||||
* @private
|
||||
*/
|
||||
function sql_transaction($status = 'begin')
|
||||
function _sql_transaction($status = 'begin')
|
||||
{
|
||||
switch ($status)
|
||||
{
|
||||
case 'begin':
|
||||
$result = @mysql_query('BEGIN', $this->db_connect_id);
|
||||
$this->transaction = true;
|
||||
return @mysql_query('BEGIN', $this->db_connect_id);
|
||||
break;
|
||||
|
||||
case 'commit':
|
||||
$result = @mysql_query('COMMIT', $this->db_connect_id);
|
||||
$this->transaction = false;
|
||||
|
||||
if (!$result)
|
||||
{
|
||||
@mysql_query('ROLLBACK', $this->db_connect_id);
|
||||
}
|
||||
return @mysql_query('COMMIT', $this->db_connect_id);
|
||||
break;
|
||||
|
||||
case 'rollback':
|
||||
$result = @mysql_query('ROLLBACK', $this->db_connect_id);
|
||||
$this->transaction = false;
|
||||
return @mysql_query('ROLLBACK', $this->db_connect_id);
|
||||
break;
|
||||
|
||||
default:
|
||||
$result = true;
|
||||
}
|
||||
|
||||
return $result;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -58,37 +58,27 @@ class dbal_mysql4 extends dbal
|
||||
}
|
||||
|
||||
/**
|
||||
* sql transaction
|
||||
* SQL Transaction
|
||||
* @private
|
||||
*/
|
||||
function sql_transaction($status = 'begin')
|
||||
function _sql_transaction($status = 'begin')
|
||||
{
|
||||
switch ($status)
|
||||
{
|
||||
case 'begin':
|
||||
$result = @mysql_query('BEGIN', $this->db_connect_id);
|
||||
$this->transaction = true;
|
||||
return @mysql_query('BEGIN', $this->db_connect_id);
|
||||
break;
|
||||
|
||||
case 'commit':
|
||||
$result = @mysql_query('COMMIT', $this->db_connect_id);
|
||||
$this->transaction = false;
|
||||
|
||||
if (!$result)
|
||||
{
|
||||
@mysql_query('ROLLBACK', $this->db_connect_id);
|
||||
}
|
||||
return @mysql_query('COMMIT', $this->db_connect_id);
|
||||
break;
|
||||
|
||||
case 'rollback':
|
||||
$result = @mysql_query('ROLLBACK', $this->db_connect_id);
|
||||
$this->transaction = false;
|
||||
return @mysql_query('ROLLBACK', $this->db_connect_id);
|
||||
break;
|
||||
|
||||
default:
|
||||
$result = true;
|
||||
}
|
||||
|
||||
return $result;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -58,40 +58,31 @@ class dbal_mysqli extends dbal
|
||||
}
|
||||
|
||||
/**
|
||||
* sql transaction
|
||||
* SQL Transaction
|
||||
* @private
|
||||
*/
|
||||
function sql_transaction($status = 'begin')
|
||||
function _sql_transaction($status = 'begin')
|
||||
{
|
||||
switch ($status)
|
||||
{
|
||||
case 'begin':
|
||||
$result = @mysqli_autocommit($this->db_connect_id, false);
|
||||
$this->transaction = true;
|
||||
return @mysqli_autocommit($this->db_connect_id, false);
|
||||
break;
|
||||
|
||||
case 'commit':
|
||||
$result = @mysqli_commit($this->db_connect_id);
|
||||
@mysqli_autocommit($this->db_connect_id, true);
|
||||
$this->transaction = false;
|
||||
|
||||
if (!$result)
|
||||
{
|
||||
@mysqli_rollback($this->db_connect_id);
|
||||
@mysqli_autocommit($this->db_connect_id, true);
|
||||
}
|
||||
return $result;
|
||||
break;
|
||||
|
||||
case 'rollback':
|
||||
$result = @mysqli_rollback($this->db_connect_id);
|
||||
@mysqli_autocommit($this->db_connect_id, true);
|
||||
$this->transaction = false;
|
||||
return $result;
|
||||
break;
|
||||
|
||||
default:
|
||||
$result = true;
|
||||
}
|
||||
|
||||
return $result;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -48,37 +48,27 @@ class dbal_oracle extends dbal
|
||||
}
|
||||
|
||||
/**
|
||||
* sql transaction
|
||||
* SQL Transaction
|
||||
* @private
|
||||
*/
|
||||
function sql_transaction($status = 'begin')
|
||||
function _sql_transaction($status = 'begin')
|
||||
{
|
||||
switch ($status)
|
||||
{
|
||||
case 'begin':
|
||||
$result = true;
|
||||
$this->transaction = true;
|
||||
return true;
|
||||
break;
|
||||
|
||||
case 'commit':
|
||||
$result = @ocicommit($this->db_connect_id);
|
||||
$this->transaction = false;
|
||||
|
||||
if (!$result)
|
||||
{
|
||||
@ocirollback($this->db_connect_id);
|
||||
}
|
||||
return @ocicommit($this->db_connect_id);
|
||||
break;
|
||||
|
||||
case 'rollback':
|
||||
$result = @ocirollback($this->db_connect_id);
|
||||
$this->transaction = false;
|
||||
return @ocirollback($this->db_connect_id);
|
||||
break;
|
||||
|
||||
default:
|
||||
$result = true;
|
||||
}
|
||||
|
||||
return $result;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -355,7 +345,7 @@ class dbal_oracle extends dbal
|
||||
*/
|
||||
function sql_escape($msg)
|
||||
{
|
||||
return str_replace("'", "''", str_replace('\\', '\\\\', $msg));
|
||||
return str_replace("'", "''", $msg);
|
||||
}
|
||||
|
||||
function _sql_custom_build($stage, $data)
|
||||
|
@@ -85,37 +85,27 @@ class dbal_postgres extends dbal
|
||||
}
|
||||
|
||||
/**
|
||||
* sql transaction
|
||||
* SQL Transaction
|
||||
* @private
|
||||
*/
|
||||
function sql_transaction($status = 'begin')
|
||||
function _sql_transaction($status = 'begin')
|
||||
{
|
||||
switch ($status)
|
||||
{
|
||||
case 'begin':
|
||||
$result = @pg_query($this->db_connect_id, 'BEGIN');
|
||||
$this->transaction = true;
|
||||
return @pg_query($this->db_connect_id, 'BEGIN');
|
||||
break;
|
||||
|
||||
case 'commit':
|
||||
$result = @pg_query($this->db_connect_id, 'COMMIT');
|
||||
$this->transaction = false;
|
||||
|
||||
if (!$result)
|
||||
{
|
||||
@pg_query($this->db_connect_id, 'ROLLBACK');
|
||||
}
|
||||
return @pg_query($this->db_connect_id, 'COMMIT');
|
||||
break;
|
||||
|
||||
case 'rollback':
|
||||
$result = @pg_query($this->db_connect_id, 'ROLLBACK');
|
||||
$this->transaction = false;
|
||||
return @pg_query($this->db_connect_id, 'ROLLBACK');
|
||||
break;
|
||||
|
||||
default:
|
||||
$result = true;
|
||||
}
|
||||
|
||||
return $result;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -52,37 +52,27 @@ class dbal_sqlite extends dbal
|
||||
}
|
||||
|
||||
/**
|
||||
* sql transaction
|
||||
* SQL Transaction
|
||||
* @private
|
||||
*/
|
||||
function sql_transaction($status = 'begin')
|
||||
function _sql_transaction($status = 'begin')
|
||||
{
|
||||
switch ($status)
|
||||
{
|
||||
case 'begin':
|
||||
$result = @sqlite_query('BEGIN', $this->db_connect_id);
|
||||
$this->transaction = true;
|
||||
return @sqlite_query('BEGIN', $this->db_connect_id);
|
||||
break;
|
||||
|
||||
case 'commit':
|
||||
$result = @sqlite_query('COMMIT', $this->db_connect_id);
|
||||
$this->transaction = false;
|
||||
|
||||
if (!$result)
|
||||
{
|
||||
@sqlite_query('ROLLBACK', $this->db_connect_id);
|
||||
}
|
||||
return @sqlite_query('COMMIT', $this->db_connect_id);
|
||||
break;
|
||||
|
||||
case 'rollback':
|
||||
$result = @sqlite_query('ROLLBACK', $this->db_connect_id);
|
||||
$this->transaction = false;
|
||||
return @sqlite_query('ROLLBACK', $this->db_connect_id);
|
||||
break;
|
||||
|
||||
default:
|
||||
$result = true;
|
||||
}
|
||||
|
||||
return $result;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user