From f73d68265b7f4afb1a5a34c5236296bcc793483f Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Sun, 1 Jul 2007 19:26:41 +0000 Subject: [PATCH] RFE #1743983: replace $max_characters by a configurable param MaxCharactersInDisplayedSQL --- ChangeLog | 2 ++ Documentation.html | 6 ++++++ libraries/Config.class.php | 6 +----- libraries/common.lib.php | 4 ++-- libraries/config.default.php | 7 +++++++ libraries/footer.inc.php | 4 ++-- 6 files changed, 20 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0a1022a50..79a8d98dc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -71,6 +71,8 @@ $HeadURL: https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/trunk/phpMyA + [gui] Navigator for the table list in the content panel - bug #1727138 HTML not encoded (more than 1000 characters) + [display] Support for MySQL 5.0.37 profiling ++ RFE #1743983 [gui] Replace $max_characters by a configurable param: + $cfg['MaxCharactersInDisplayedSQL'] 2.10.3.0 (not yet released) diff --git a/Documentation.html b/Documentation.html index dd5283407..acbb3316a 100644 --- a/Documentation.html +++ b/Documentation.html @@ -1096,6 +1096,12 @@ ALTER TABLE `pma_column_comments`
The maximum number of table names to be displayed in the right panel's list.
+
$cfg['MaxCharactersInDisplayedSQL'] integer
+
The maximum number of characters when a SQL query is displayed. The + default limit of 1000 should be correct to avoid the display of tons + of hexadecimal codes that represent BLOBs, but some users have real + SQL queries that are longer than 1000 characters.
+
$cfg['OBGzip'] string/boolean
Defines whether to use GZip output buffering for increased speed in HTTP transfers.
diff --git a/libraries/Config.class.php b/libraries/Config.class.php index 7c5460cec..c3aa3533c 100644 --- a/libraries/Config.class.php +++ b/libraries/Config.class.php @@ -103,9 +103,6 @@ class PMA_Config $this->checkUpload(); $this->checkUploadSize(); $this->checkOutputCompression(); - - // other constants (no real need to put into config file) - $this->set('PMA_MAX_CHARACTERS_FOR_DISPLAYED_QUERY', 1000); } /** @@ -899,8 +896,7 @@ class PMA_Config 'PMA_IS_GD2', 'PMA_USR_OS', 'PMA_USR_BROWSER_VER', - 'PMA_USR_BROWSER_AGENT', - 'PMA_MAX_CHARACTERS_FOR_DISPLAYED_QUERY' + 'PMA_USR_BROWSER_AGENT' ); foreach ($defines as $define) { diff --git a/libraries/common.lib.php b/libraries/common.lib.php index b25b803d6..b3cb0ce3a 100644 --- a/libraries/common.lib.php +++ b/libraries/common.lib.php @@ -1046,7 +1046,7 @@ function PMA_showMessage($message, $sql_query = null) $query_base = $sql_query; } - if (strlen($query_base) > PMA_MAX_CHARACTERS_FOR_DISPLAYED_QUERY) { + if (strlen($query_base) > $cfg['MaxCharactersInDisplayedSQL']) { $query_too_big = true; $query_base = nl2br(htmlspecialchars($sql_query)); unset($GLOBALS['parsed_sql']); @@ -1240,7 +1240,7 @@ function PMA_showMessage($message, $sql_query = null) // I get a white page, strlen($query_base) is 2 x 700 Kio // so put a hard limit here (let's say 1000) if ($query_too_big) { - echo ' ' . substr($query_base,0,PMA_MAX_CHARACTERS_FOR_DISPLAYED_QUERY) . '[...]'; + echo ' ' . substr($query_base, 0, $cfg['MaxCharactersInDisplayedSQL']) . '[...]'; } else { echo ' ' . $query_base; } diff --git a/libraries/config.default.php b/libraries/config.default.php index 2b4d533e7..3ac6f0bf2 100644 --- a/libraries/config.default.php +++ b/libraries/config.default.php @@ -349,6 +349,13 @@ $cfg['MaxDbList'] = 100; */ $cfg['MaxTableList'] = 100; +/** + * maximum number of characters when a SQL query is displayed + * + * @global integer $cfg['MaxCharactersInDisplayedSQL'] + */ +$cfg['MaxCharactersInDisplayedSQL'] = 1000; + /** * use GZIP output buffering if possible (true|false|'auto') * diff --git a/libraries/footer.inc.php b/libraries/footer.inc.php index 220b67b50..fa5f7edd2 100644 --- a/libraries/footer.inc.php +++ b/libraries/footer.inc.php @@ -32,7 +32,7 @@ * @uses $cfg['DBG']['enable'] * @uses $cfg['DBG']['profile']['enable'] * @uses $GLOBALS['strOpenNewWindow'] - * @uses PMA_MAX_CHARACTERS_FOR_DISPLAYED_QUERY + * @uses $cfg['MaxCharactersInDisplayedSQL'] * @uses PMA_isValid() * @uses PMA_setHistory() * @uses PMA_ifSetOr() @@ -88,7 +88,7 @@ if (window.parent.reload_querywindow) { window.parent.reload_querywindow( '', '', - ' PMA_MAX_CHARACTERS_FOR_DISPLAYED_QUERY ? PMA_escapeJsString($GLOBALS['sql_query']) : ''; ?>'); + ' $cfg['MaxCharactersInDisplayedSQL'] ? PMA_escapeJsString($GLOBALS['sql_query']) : ''; ?>'); }