From 129218286b21a19d0bf8b79aef373e9630e5bc82 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 3 Feb 2004 09:43:31 +0000 Subject: [PATCH] show correct SQL error message if failed during a transaction... git-svn-id: file:///svn/phpbb/trunk@4788 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/db/firebird.php | 9 +++++---- phpBB/includes/db/msaccess.php | 9 +++++---- phpBB/includes/db/mssql-odbc.php | 9 +++++---- phpBB/includes/db/mssql.php | 11 ++++++----- phpBB/includes/db/mysql.php | 11 ++++++----- phpBB/includes/db/mysql4.php | 11 ++++++----- phpBB/includes/db/postgres.php | 11 ++++++----- phpBB/includes/db/sqlite.php | 11 ++++++----- 8 files changed, 45 insertions(+), 37 deletions(-) diff --git a/phpBB/includes/db/firebird.php b/phpBB/includes/db/firebird.php index 65be3b7723..663d99063a 100644 --- a/phpBB/includes/db/firebird.php +++ b/phpBB/includes/db/firebird.php @@ -428,15 +428,16 @@ class sql_db { if (!$this->return_on_error) { + $this_page =(!empty($_SERVER['PHP_SELF'])) ? $_SERVER['PHP_SELF'] : $_ENV['PHP_SELF']; + $this_page .= '&' .((!empty($_SERVER['QUERY_STRING'])) ? $_SERVER['QUERY_STRING'] : $_ENV['QUERY_STRING']); + + $message = 'SQL ERROR [ ' . SQL_LAYER . ' ]

' . @ibase_errmsg() . '

CALLING PAGE

' . $this_page .(($sql != '') ? '

SQL

' . $sql : '') . '
'; + if ($this->transaction) { $this->sql_transaction('rollback'); } - $this_page =(!empty($_SERVER['PHP_SELF'])) ? $_SERVER['PHP_SELF'] : $_ENV['PHP_SELF']; - $this_page .= '&' .((!empty($_SERVER['QUERY_STRING'])) ? $_SERVER['QUERY_STRING'] : $_ENV['QUERY_STRING']); - - $message = 'SQL ERROR [ ' . SQL_LAYER . ' ]

' . @ibase_errmsg() . '

CALLING PAGE

' . $this_page .(($sql != '') ? '

SQL

' . $sql : '') . '
'; trigger_error($message, E_USER_ERROR); } diff --git a/phpBB/includes/db/msaccess.php b/phpBB/includes/db/msaccess.php index 3e38cff7b0..b573a59d27 100644 --- a/phpBB/includes/db/msaccess.php +++ b/phpBB/includes/db/msaccess.php @@ -386,15 +386,16 @@ class sql_db { if (!$this->return_on_error) { + $this_page = (!empty($_SERVER['PHP_SELF'])) ? $_SERVER['PHP_SELF'] : $_ENV['PHP_SELF']; + $this_page .= '&' . ((!empty($_SERVER['QUERY_STRING'])) ? $_SERVER['QUERY_STRING'] : $_ENV['QUERY_STRING']); + + $message = 'SQL ERROR [ ' . SQL_LAYER . ' ]

' . @odbc_errormsg() . '

CALLING PAGE

' . htmlspecialchars($this_page) . (($sql != '') ? '

SQL

' . $sql : '') . '
'; + if ($this->transaction) { $this->sql_transaction('rollback'); } - $this_page = (!empty($_SERVER['PHP_SELF'])) ? $_SERVER['PHP_SELF'] : $_ENV['PHP_SELF']; - $this_page .= '&' . ((!empty($_SERVER['QUERY_STRING'])) ? $_SERVER['QUERY_STRING'] : $_ENV['QUERY_STRING']); - - $message = 'SQL ERROR [ ' . SQL_LAYER . ' ]

' . @odbc_errormsg() . '

CALLING PAGE

' . htmlspecialchars($this_page) . (($sql != '') ? '

SQL

' . $sql : '') . '
'; trigger_error($message, E_USER_ERROR); } diff --git a/phpBB/includes/db/mssql-odbc.php b/phpBB/includes/db/mssql-odbc.php index 09834d414e..82352a1247 100644 --- a/phpBB/includes/db/mssql-odbc.php +++ b/phpBB/includes/db/mssql-odbc.php @@ -384,15 +384,16 @@ class sql_db { if (!$this->return_on_error) { + $this_page = (!empty($_SERVER['PHP_SELF'])) ? $_SERVER['PHP_SELF'] : $_ENV['PHP_SELF']; + $this_page .= '&' . ((!empty($_SERVER['QUERY_STRING'])) ? $_SERVER['QUERY_STRING'] : $_ENV['QUERY_STRING']); + + $message = 'SQL ERROR [ ' . SQL_LAYER . ' ]

' . @odbc_errormsg() . '

CALLING PAGE

' . htmlspecialchars($this_page) . (($sql != '') ? '

SQL

' . $sql : '') . '
'; + if ($this->transaction) { $this->sql_transaction('rollback'); } - $this_page = (!empty($_SERVER['PHP_SELF'])) ? $_SERVER['PHP_SELF'] : $_ENV['PHP_SELF']; - $this_page .= '&' . ((!empty($_SERVER['QUERY_STRING'])) ? $_SERVER['QUERY_STRING'] : $_ENV['QUERY_STRING']); - - $message = 'SQL ERROR [ ' . SQL_LAYER . ' ]

' . @odbc_errormsg() . '

CALLING PAGE

' . htmlspecialchars($this_page) . (($sql != '') ? '

SQL

' . $sql : '') . '
'; trigger_error($message, E_USER_ERROR); } diff --git a/phpBB/includes/db/mssql.php b/phpBB/includes/db/mssql.php index fc5b1b0c44..c25eff0085 100644 --- a/phpBB/includes/db/mssql.php +++ b/phpBB/includes/db/mssql.php @@ -419,15 +419,16 @@ class sql_db { if (!$this->return_on_error) { - if ($this->transaction) - { - $this->sql_transaction('rollback'); - } - $this_page = (!empty($_SERVER['PHP_SELF'])) ? $_SERVER['PHP_SELF'] : $_ENV['PHP_SELF']; $this_page .= '&' . ((!empty($_SERVER['QUERY_STRING'])) ? $_SERVER['QUERY_STRING'] : $_ENV['QUERY_STRING']); $message = 'SQL ERROR [ ' . SQL_LAYER . ' ]

' . @mssql_get_last_message() . '

CALLING PAGE

' . htmlspecialchars($this_page) . (($sql != '') ? '

SQL

' . $sql : '') . '
'; + + if ($this->transaction) + { + $this->sql_transaction('rollback'); + } + trigger_error($message, E_USER_ERROR); } diff --git a/phpBB/includes/db/mysql.php b/phpBB/includes/db/mysql.php index b031047218..5c982e7a2c 100644 --- a/phpBB/includes/db/mysql.php +++ b/phpBB/includes/db/mysql.php @@ -357,15 +357,16 @@ class sql_db { if (!$this->return_on_error) { - if ($this->transaction) - { - $this->sql_transaction('rollback'); - } - $this_page = (!empty($_SERVER['PHP_SELF'])) ? $_SERVER['PHP_SELF'] : $_ENV['PHP_SELF']; $this_page .= '&' . ((!empty($_SERVER['QUERY_STRING'])) ? $_SERVER['QUERY_STRING'] : $_ENV['QUERY_STRING']); $message = 'SQL ERROR [ ' . SQL_LAYER . ' ]

' . @mysql_error() . '

CALLING PAGE

' . htmlspecialchars($this_page) . (($sql != '') ? '

SQL

' . $sql : '') . '
'; + + if ($this->transaction) + { + $this->sql_transaction('rollback'); + } + trigger_error($message, E_USER_ERROR); } diff --git a/phpBB/includes/db/mysql4.php b/phpBB/includes/db/mysql4.php index 17154bd6ea..5f82654783 100644 --- a/phpBB/includes/db/mysql4.php +++ b/phpBB/includes/db/mysql4.php @@ -357,15 +357,16 @@ class sql_db { if (!$this->return_on_error) { - if ($this->transaction) - { - $this->sql_transaction('rollback'); - } - $this_page = (!empty($_SERVER['PHP_SELF'])) ? $_SERVER['PHP_SELF'] : $_ENV['PHP_SELF']; $this_page .= '&' . ((!empty($_SERVER['QUERY_STRING'])) ? $_SERVER['QUERY_STRING'] : $_ENV['QUERY_STRING']); $message = 'SQL ERROR [ ' . SQL_LAYER . ' ]

' . @mysql_error() . '

CALLING PAGE

' . htmlspecialchars($this_page) . (($sql != '') ? '

SQL

' . $sql : '') . '
'; + + if ($this->transaction) + { + $this->sql_transaction('rollback'); + } + trigger_error($message, E_USER_ERROR); } diff --git a/phpBB/includes/db/postgres.php b/phpBB/includes/db/postgres.php index aa26e8ec8f..4eb7dd5a51 100644 --- a/phpBB/includes/db/postgres.php +++ b/phpBB/includes/db/postgres.php @@ -362,15 +362,16 @@ class sql_db { if (!$this->return_on_error) { - if ($this->transaction) - { - $this->sql_transaction('rollback'); - } - $this_page = (!empty($_SERVER['PHP_SELF'])) ? $_SERVER['PHP_SELF'] : $_ENV['PHP_SELF']; $this_page .= '&' . ((!empty($_SERVER['QUERY_STRING'])) ? $_SERVER['QUERY_STRING'] : $_ENV['QUERY_STRING']); $message = 'SQL ERROR [ ' . SQL_LAYER . ' ]

' . @pg_errormessage() . '

CALLING PAGE

' . htmlspecialchars($this_page) . (($sql != '') ? '

SQL

' . $sql : '') . '
'; + + if ($this->transaction) + { + $this->sql_transaction('rollback'); + } + trigger_error($message, E_USER_ERROR); } diff --git a/phpBB/includes/db/sqlite.php b/phpBB/includes/db/sqlite.php index b1de116ed8..b34fded3cb 100644 --- a/phpBB/includes/db/sqlite.php +++ b/phpBB/includes/db/sqlite.php @@ -363,15 +363,16 @@ class sql_db { if (!$this->return_on_error) { - if ($this->transaction) - { - $this->sql_transaction('rollback'); - } - $this_page = (!empty($_SERVER['PHP_SELF'])) ? $_SERVER['PHP_SELF'] : $_ENV['PHP_SELF']; $this_page .= '&' . ((!empty($_SERVER['QUERY_STRING'])) ? $_SERVER['QUERY_STRING'] : $_ENV['QUERY_STRING']); $message = 'SQL ERROR [ ' . SQL_LAYER . ' ]

' . @sqlite_error_string(@sqlite_last_error($this->db_connect_id)) . '

CALLING PAGE

' . htmlspecialchars($this_page) . (($sql != '') ? '

SQL

' . $sql : '') . '
'; + + if ($this->transaction) + { + $this->sql_transaction('rollback'); + } + trigger_error($message, E_USER_ERROR); }