aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/db
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2006-05-12 20:52:58 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2006-05-12 20:52:58 +0000
commita8d99f2228cc042c8410553f5f3ec375148552f5 (patch)
tree11ccbd184cbc222775a08852d633d74ced7b2695 /phpBB/includes/db
parent7dd067bf5a532e4c30908cca24449274a4863326 (diff)
downloadforums-a8d99f2228cc042c8410553f5f3ec375148552f5.tar
forums-a8d99f2228cc042c8410553f5f3ec375148552f5.tar.gz
forums-a8d99f2228cc042c8410553f5f3ec375148552f5.tar.bz2
forums-a8d99f2228cc042c8410553f5f3ec375148552f5.tar.xz
forums-a8d99f2228cc042c8410553f5f3ec375148552f5.zip
- introduce new function build_url to easily build a valid url from the user->page object as well as optionally removing certain keys
- changed attachment config to utilize the config build methods - cleaned up posting.php - the submit/delete_post functions are now usable (functions_posting.php) - adjusted header icons (transparency) - a bunch of fixes for mssql - bug fixes git-svn-id: file:///svn/phpbb/trunk@5902 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/db')
-rw-r--r--phpBB/includes/db/dbal.php8
-rw-r--r--phpBB/includes/db/mssql.php23
2 files changed, 24 insertions, 7 deletions
diff --git a/phpBB/includes/db/dbal.php b/phpBB/includes/db/dbal.php
index 1a8b8a4ddf..a7e582d396 100644
--- a/phpBB/includes/db/dbal.php
+++ b/phpBB/includes/db/dbal.php
@@ -266,7 +266,9 @@ class dbal
$message = '<u>SQL ERROR</u> [ ' . SQL_LAYER . ' ]<br /><br />' . $error['message'] . ' [' . $error['code'] . ']';
// Show complete SQL error and path to administrators only
- if ($auth->acl_get('a_') || defined('IN_INSTALL'))
+ // Additionally show complete error on installation or if extended debug mode is enabled
+ // The DEBUG_EXTRA constant is for development only!
+ if ($auth->acl_get('a_') || defined('IN_INSTALL') || defined('DEBUG_EXTRA'))
{
// Print out a nice backtrace...
$backtrace = get_backtrace();
@@ -314,7 +316,7 @@ class dbal
*/
function sql_report($mode, $query = '')
{
- global $cache, $starttime, $phpbb_root_path, $user;
+ global $cache, $starttime, $phpbb_root_path, $user, $SID;
if (empty($_GET['explain']))
{
@@ -350,7 +352,7 @@ class dbal
<body id="errorpage">
<div id="wrap">
<div id="page-header">
- <a href="' . htmlspecialchars(preg_replace('/&explain=([^&]*)/', '', $_SERVER['REQUEST_URI'])) . '">Return to previous page</a>
+ <a href="' . build_url('explain') . '">Return to previous page</a>
</div>
<div id="page-body">
<div class="panel">
diff --git a/phpBB/includes/db/mssql.php b/phpBB/includes/db/mssql.php
index e1082d282c..5d6095e502 100644
--- a/phpBB/includes/db/mssql.php
+++ b/phpBB/includes/db/mssql.php
@@ -98,7 +98,6 @@ class dbal_mssql extends dbal
{
global $cache;
-
// EXPLAIN only in extra debug mode
if (defined('DEBUG_EXTRA'))
{
@@ -315,17 +314,33 @@ class dbal_mssql extends dbal
*/
function _sql_error()
{
-
$error = array(
'message' => @mssql_get_last_message($this->db_connect_id),
'code' => ''
);
- $result_id = @mssql_query('SELECT @@ERROR as errno', $this->db_connect_id);
+ // Get error code number
+ $result_id = @mssql_query('SELECT @@ERROR as code', $this->db_connect_id);
if ($result_id)
{
$row = @mssql_fetch_assoc($result_id);
- $error['code'] = $row['errno'];
+ $error['code'] = $row['code'];
+ @mssql_free_result($result_id);
+ }
+
+ // Get full error message if possible
+ $sql = 'SELECT CAST(description as varchar(255)) as message
+ FROM master.dbo.sysmessages
+ WHERE error = ' . $error['code'];
+ $result_id = @mssql_query($sql);
+
+ if ($result_id)
+ {
+ $row = @mssql_fetch_assoc($result_id);
+ if (!empty($row['message']))
+ {
+ $error['message'] .= '<br />' . $row['message'];
+ }
@mssql_free_result($result_id);
}