1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-05-07 08:05:25 +02:00

Merge branch 'ticket/17232' into ticket/17232-master

This commit is contained in:
rxu 2023-12-20 15:39:26 +07:00
commit 83f9838217
No known key found for this signature in database
GPG Key ID: 8117904FEDEFDD17
6 changed files with 87 additions and 17 deletions

View File

@ -161,7 +161,16 @@ class mssql_odbc extends \phpbb\db\driver\mssql_base
if ($this->query_result === false) if ($this->query_result === false)
{ {
if (($this->query_result = @odbc_exec($this->db_connect_id, $query)) === false) try
{
$this->query_result = @odbc_exec($this->db_connect_id, $query);
}
catch (\Error $e)
{
// Do nothing as SQL driver will report the error
}
if ($this->query_result === false)
{ {
$this->sql_error($query); $this->sql_error($query);
} }

View File

@ -136,12 +136,22 @@ class mssqlnative extends \phpbb\db\driver\mssql_base
if ($this->query_result === false) if ($this->query_result === false)
{ {
if (($this->query_result = @sqlsrv_query($this->db_connect_id, $query, array(), $this->query_options)) === false) try
{
$this->query_result = @sqlsrv_query($this->db_connect_id, $query, array(), $this->query_options);
}
catch (\Error $e)
{
// Do nothing as SQL driver will report the error
}
if ($this->query_result === false)
{ {
$this->sql_error($query); $this->sql_error($query);
} }
// reset options for next query
$this->query_options = array(); // Reset options for the next query
$this->query_options = [];
if ($this->debug_sql_explain) if ($this->debug_sql_explain)
{ {

View File

@ -193,7 +193,16 @@ class mysqli extends \phpbb\db\driver\mysql_base
if ($this->query_result === false) if ($this->query_result === false)
{ {
if (($this->query_result = @mysqli_query($this->db_connect_id, $query)) === false) try
{
$this->query_result = @mysqli_query($this->db_connect_id, $query);
}
catch (\Error $e)
{
// Do nothing as SQL driver will report the error
}
if ($this->query_result === false)
{ {
$this->sql_error($query); $this->sql_error($query);
} }
@ -332,24 +341,24 @@ class mysqli extends \phpbb\db\driver\mysql_base
{ {
if ($this->db_connect_id) if ($this->db_connect_id)
{ {
$error = array( $error = [
'message' => @mysqli_error($this->db_connect_id), 'message' => $this->db_connect_id->error,
'code' => @mysqli_errno($this->db_connect_id) 'code' => $this->db_connect_id->errno,
); ];
} }
else if (function_exists('mysqli_connect_error')) else if (function_exists('mysqli_connect_error'))
{ {
$error = array( $error = [
'message' => @mysqli_connect_error(), 'message' => $this->db_connect_id->connect_error,
'code' => @mysqli_connect_errno(), 'code' => $this->db_connect_id->connect_errno,
); ];
} }
else else
{ {
$error = array( $error = [
'message' => $this->connect_error, 'message' => $this->connect_error,
'code' => '', 'code' => '',
); ];
} }
return $error; return $error;

View File

@ -183,7 +183,16 @@ class postgres extends \phpbb\db\driver\driver
if ($this->query_result === false) if ($this->query_result === false)
{ {
if (($this->query_result = @pg_query($this->db_connect_id, $query)) === false) try
{
$this->query_result = @pg_query($this->db_connect_id, $query);
}
catch (\Error $e)
{
// Do nothing as SQL driver will report the error
}
if ($this->query_result === false)
{ {
$this->sql_error($query); $this->sql_error($query);
} }

View File

@ -131,7 +131,16 @@ class sqlite3 extends \phpbb\db\driver\driver
$query = preg_replace('/^INSERT INTO/', 'INSERT OR ROLLBACK INTO', $query); $query = preg_replace('/^INSERT INTO/', 'INSERT OR ROLLBACK INTO', $query);
} }
if (($this->query_result = @$this->dbo->query($query)) === false) try
{
$this->query_result = @$this->dbo->query($query);
}
catch (\Error $e)
{
// Do nothing as SQL driver will report the error
}
if ($this->query_result === false)
{ {
// Try to recover a lost database connection // Try to recover a lost database connection
if ($this->dbo && !@$this->dbo->lastErrorMsg()) if ($this->dbo && !@$this->dbo->lastErrorMsg())

View File

@ -0,0 +1,24 @@
<?php
/**
*
* This file is part of the phpBB Forum Software package.
*
* @copyright (c) phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
* For full copyright and license information, please see
* the docs/CREDITS.txt file.
*
*/
namespace phpbb\db\tools;
/**
* Database Tools for handling cross-db actions such as altering columns, etc.
* Currently not supported is returning SQL for creating tables.
*
* @deprecated 4.0.0-a1
*/
class sqlite3 extends doctrine
{
}