diff options
Diffstat (limited to 'phpBB/includes/db')
-rw-r--r-- | phpBB/includes/db/dbal.php | 7 | ||||
-rw-r--r-- | phpBB/includes/db/firebird.php | 10 | ||||
-rw-r--r-- | phpBB/includes/db/mssql.php | 14 | ||||
-rw-r--r-- | phpBB/includes/db/mssql_odbc.php | 8 | ||||
-rw-r--r-- | phpBB/includes/db/mysql.php | 6 | ||||
-rw-r--r-- | phpBB/includes/db/mysqli.php | 2 | ||||
-rw-r--r-- | phpBB/includes/db/oracle.php | 4 | ||||
-rw-r--r-- | phpBB/includes/db/postgres.php | 4 | ||||
-rw-r--r-- | phpBB/includes/db/sqlite.php | 2 |
9 files changed, 27 insertions, 30 deletions
diff --git a/phpBB/includes/db/dbal.php b/phpBB/includes/db/dbal.php index da649ed812..77b5b46ffc 100644 --- a/phpBB/includes/db/dbal.php +++ b/phpBB/includes/db/dbal.php @@ -103,12 +103,9 @@ class dbal $this->sql_transaction('commit'); } - if (sizeof($this->open_queries)) + foreach ($this->open_queries as $query_id) { - foreach ($this->open_queries as $i_query_id => $query_id) - { - $this->sql_freeresult($query_id); - } + $this->sql_freeresult($query_id); } return $this->_sql_close(); diff --git a/phpBB/includes/db/firebird.php b/phpBB/includes/db/firebird.php index 5ce4949956..317054d978 100644 --- a/phpBB/includes/db/firebird.php +++ b/phpBB/includes/db/firebird.php @@ -31,7 +31,7 @@ class dbal_firebird extends dbal /** * Connect to server */ - function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false) + function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false) { $this->persistency = $persistency; $this->user = $sqluser; @@ -273,19 +273,19 @@ class dbal_firebird extends dbal if ($query_id !== false && $this->last_query_text != '') { - if ($this->query_result && preg_match('#^INSERT[\t\n ]+INTO[\t\n ]+([a-z0-9\_\-]+)#is', $this->last_query_text, $tablename)) + if ($this->query_result && preg_match('#^INSERT[\t\n ]+INTO[\t\n ]+([a-z0-9\_\-]+)#i', $this->last_query_text, $tablename)) { - $sql = "SELECT GEN_ID(" . $tablename[1] . "_gen, 0) AS new_id FROM RDB\$DATABASE"; + $sql = 'SELECT GEN_ID(' . $tablename[1] . '_gen, 0) AS new_id FROM RDB$DATABASE'; if (!($temp_q_id = @ibase_query($this->db_connect_id, $sql))) { return false; } - $temp_result = @ibase_fetch_object($temp_q_id); + $temp_result = @ibase_fetch_assoc($temp_q_id); @ibase_free_result($temp_q_id); - return ($temp_result) ? $temp_result->NEW_ID : false; + return ($temp_result) ? $temp_result['NEW_ID'] : false; } } diff --git a/phpBB/includes/db/mssql.php b/phpBB/includes/db/mssql.php index 6429d4be41..0af6514322 100644 --- a/phpBB/includes/db/mssql.php +++ b/phpBB/includes/db/mssql.php @@ -28,7 +28,7 @@ class dbal_mssql extends dbal /** * Connect to server */ - function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false) + function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false) { $this->persistency = $persistency; $this->user = $sqluser; @@ -37,7 +37,7 @@ class dbal_mssql extends dbal @ini_set('mssql.charset', 'UTF-8'); - $this->db_connect_id = ($this->persistency) ? @mssql_pconnect($this->server, $this->user, $sqlpassword) : @mssql_connect($this->server, $this->user, $sqlpassword); + $this->db_connect_id = ($this->persistency) ? @mssql_pconnect($this->server, $this->user, $sqlpassword, $new_link) : @mssql_connect($this->server, $this->user, $sqlpassword, $new_link); if ($this->db_connect_id && $this->dbname != '') { @@ -86,11 +86,11 @@ class dbal_mssql extends dbal break; case 'commit': - return @mssql_query('commit', $this->db_connect_id); + return @mssql_query('COMMIT TRANSACTION', $this->db_connect_id); break; case 'rollback': - return @mssql_query('ROLLBACK', $this->db_connect_id); + return @mssql_query('ROLLBACK TRANSACTION', $this->db_connect_id); break; } @@ -258,7 +258,7 @@ class dbal_mssql extends dbal */ function sql_nextid() { - $result_id = @mssql_query('SELECT @@IDENTITY', $this->db_connect_id); + $result_id = @mssql_query('SELECT SCOPE_IDENTITY()', $this->db_connect_id); if ($result_id) { if ($row = @mssql_fetch_assoc($result_id)) @@ -385,7 +385,7 @@ class dbal_mssql extends dbal if (preg_match('/^SELECT/', $explain_query)) { $html_table = false; - @mssql_query("SET SHOWPLAN_TEXT ON;", $this->db_connect_id); + @mssql_query('SET SHOWPLAN_TEXT ON;', $this->db_connect_id); if ($result = @mssql_query($explain_query, $this->db_connect_id)) { @mssql_next_result($result); @@ -394,7 +394,7 @@ class dbal_mssql extends dbal $html_table = $this->sql_report('add_select_row', $query, $html_table, $row); } } - @mssql_query("SET SHOWPLAN_TEXT OFF;", $this->db_connect_id); + @mssql_query('SET SHOWPLAN_TEXT OFF;', $this->db_connect_id); @mssql_free_result($result); if ($html_table) diff --git a/phpBB/includes/db/mssql_odbc.php b/phpBB/includes/db/mssql_odbc.php index 0b8f1e2a95..ab3bd2a164 100644 --- a/phpBB/includes/db/mssql_odbc.php +++ b/phpBB/includes/db/mssql_odbc.php @@ -31,7 +31,7 @@ class dbal_mssql_odbc extends dbal /** * Connect to server */ - function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false) + function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false) { $this->persistency = $persistency; $this->user = $sqluser; @@ -267,7 +267,7 @@ class dbal_mssql_odbc extends dbal { if (@odbc_fetch_array($result_id)) { - $id = @odbc_result($result_id, 1); + $id = @odbc_result($result_id, 1); @odbc_free_result($result_id); return $id; } @@ -363,7 +363,7 @@ class dbal_mssql_odbc extends dbal if (preg_match('/^SELECT/', $explain_query)) { $html_table = false; - @odbc_exec($this->db_connect_id, "SET SHOWPLAN_TEXT ON;"); + @odbc_exec($this->db_connect_id, 'SET SHOWPLAN_TEXT ON;'); if ($result = @odbc_exec($this->db_connect_id, $explain_query)) { @odbc_next_result($result); @@ -372,7 +372,7 @@ class dbal_mssql_odbc extends dbal $html_table = $this->sql_report('add_select_row', $query, $html_table, $row); } } - @odbc_exec($this->db_connect_id, "SET SHOWPLAN_TEXT OFF;"); + @odbc_exec($this->db_connect_id, 'SET SHOWPLAN_TEXT OFF;'); @odbc_free_result($result); if ($html_table) diff --git a/phpBB/includes/db/mysql.php b/phpBB/includes/db/mysql.php index b750618ae6..2eb3a561bc 100644 --- a/phpBB/includes/db/mysql.php +++ b/phpBB/includes/db/mysql.php @@ -35,7 +35,7 @@ class dbal_mysql extends dbal * Connect to server * @access public */ - function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false) + function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false) { $this->persistency = $persistency; $this->user = $sqluser; @@ -44,11 +44,11 @@ class dbal_mysql extends dbal $this->sql_layer = 'mysql4'; - $this->db_connect_id = ($this->persistency) ? @mysql_pconnect($this->server, $this->user, $sqlpassword) : @mysql_connect($this->server, $this->user, $sqlpassword); + $this->db_connect_id = ($this->persistency) ? @mysql_pconnect($this->server, $this->user, $sqlpassword, $new_link) : @mysql_connect($this->server, $this->user, $sqlpassword, $new_link); if ($this->db_connect_id && $this->dbname != '') { - if (@mysql_select_db($this->dbname)) + if (@mysql_select_db($this->dbname, $this->db_connect_id)) { // Determine what version we are using and if it natively supports UNICODE $this->mysql_version = mysql_get_server_info($this->db_connect_id); diff --git a/phpBB/includes/db/mysqli.php b/phpBB/includes/db/mysqli.php index da6faa3983..3149349411 100644 --- a/phpBB/includes/db/mysqli.php +++ b/phpBB/includes/db/mysqli.php @@ -29,7 +29,7 @@ class dbal_mysqli extends dbal /** * Connect to server */ - function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false) + function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false , $new_link = false) { $this->persistency = $persistency; $this->user = $sqluser; diff --git a/phpBB/includes/db/oracle.php b/phpBB/includes/db/oracle.php index 4195bcfe52..1920ce8fc1 100644 --- a/phpBB/includes/db/oracle.php +++ b/phpBB/includes/db/oracle.php @@ -29,14 +29,14 @@ class dbal_oracle extends dbal /** * Connect to server */ - function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false) + function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false) { $this->persistency = $persistency; $this->user = $sqluser; $this->server = $sqlserver . (($port) ? ':' . $port : ''); $this->dbname = $database; - $this->db_connect_id = ($this->persistency) ? @ociplogon($this->user, $sqlpassword, $this->server, 'UTF8') : @ocinlogon($this->user, $sqlpassword, $this->server, 'UTF8'); + $this->db_connect_id = ($new_link) ? @ocinlogon($this->user, $sqlpassword, $this->server, 'UTF8') : (($this->persistency) ? @ociplogon($this->user, $sqlpassword, $this->server, 'UTF8') : @ocinlogon($this->user, $sqlpassword, $this->server, 'UTF8')); return ($this->db_connect_id) ? $this->db_connect_id : $this->sql_error(''); } diff --git a/phpBB/includes/db/postgres.php b/phpBB/includes/db/postgres.php index f2e96260ba..3f0c97ce00 100644 --- a/phpBB/includes/db/postgres.php +++ b/phpBB/includes/db/postgres.php @@ -30,7 +30,7 @@ class dbal_postgres extends dbal /** * Connect to server */ - function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false) + function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false) { $connect_string = ''; @@ -70,7 +70,7 @@ class dbal_postgres extends dbal $this->persistency = $persistency; - $this->db_connect_id = ($this->persistency) ? @pg_pconnect($connect_string) : @pg_connect($connect_string); + $this->db_connect_id = ($this->persistency) ? @pg_pconnect($connect_string, $new_link) : @pg_connect($connect_string, $new_link); return ($this->db_connect_id) ? $this->db_connect_id : $this->sql_error(''); } diff --git a/phpBB/includes/db/sqlite.php b/phpBB/includes/db/sqlite.php index 9f44bd6b35..8a50c546a7 100644 --- a/phpBB/includes/db/sqlite.php +++ b/phpBB/includes/db/sqlite.php @@ -28,7 +28,7 @@ class dbal_sqlite extends dbal /** * Connect to server */ - function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false) + function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false) { $this->persistency = $persistency; $this->user = $sqluser; |