diff --git a/doc/config.rst b/doc/config.rst
index 4d9dee50b3..755b4a0bc0 100644
--- a/doc/config.rst
+++ b/doc/config.rst
@@ -2609,14 +2609,14 @@ SQL parser settings
:type: string
:default: ``'html'``
- The main use of the new :term:`SQL` Parser
- is to pretty-print :term:`SQL` queries. By
- default we use HTML to format the query, but you can disable this by
+ The main use of the :term:`SQL` Parser
+ is to format and analyze :term:`SQL` queries. By
+ default we use text to format the query, but you can disable this by
setting this variable to ``'none'``.
Available options:
- * ``'html'``
+ * ``'text'``
* ``'none'``
.. _cfg_SQP:
diff --git a/libraries/Util.class.php b/libraries/Util.class.php
index 110b683d23..5d4dd7fb05 100644
--- a/libraries/Util.class.php
+++ b/libraries/Util.class.php
@@ -404,9 +404,6 @@ class PMA_Util
$formatted_sql = PMA_SQP_formatNone($parsed_sql);
}
break;
- case 'html':
- $formatted_sql = PMA_SQP_format($parsed_sql, 'color');
- break;
case 'text':
$formatted_sql = PMA_SQP_format($parsed_sql, 'text');
break;
diff --git a/libraries/sqlparser.lib.php b/libraries/sqlparser.lib.php
index 5bdc8d096a..6321856015 100644
--- a/libraries/sqlparser.lib.php
+++ b/libraries/sqlparser.lib.php
@@ -1233,7 +1233,6 @@ function PMA_SQP_analyze($arr)
* present in the list of forbidden words, for example
* "storage" which can be used as an identifier
*
- * @todo avoid the pretty printing in color in this case
*/
$identifier = $arr[$i]['data'];
break;
@@ -2146,33 +2145,6 @@ function PMA_SQP_analyze($arr)
} // end of the "PMA_SQP_analyze()" function
-/**
- * Colorizes SQL queries html formatted
- *
- * @param array $arr The SQL queries html formatted
- *
- * @return array The colorized SQL queries
- *
- * @todo check why adding a "\n" after the would cause extra blanks
- * to be displayed: SELECT p . person_name
- *
- * @access public
- */
-function PMA_SQP_formatHtml_colorize($arr)
-{
- $i = PMA_strpos($arr['type'], '_');
- $class = '';
- if ($i > 0) {
- $class = 'syntax_' . PMA_substr($arr['type'], 0, $i) . ' ';
- }
-
- $class .= 'syntax_' . $arr['type'];
-
- return ''
- . htmlspecialchars($arr['data']) . '';
-} // end of the "PMA_SQP_formatHtml_colorize()" function
-
-
/**
* Formats SQL queries
*
@@ -2186,7 +2158,7 @@ function PMA_SQP_formatHtml_colorize($arr)
* @access public
*/
function PMA_SQP_format(
- $arr, $mode='color', $start_token=0,
+ $arr, $mode='text', $start_token=0,
$number_of_tokens=-1
) {
global $PMA_SQPdata_operators_docs, $PMA_SQPdata_functions_docs;
@@ -2202,11 +2174,6 @@ function PMA_SQP_format(
}
// else do it properly
switch ($mode) {
- case 'color':
- $str = '';
- $html_line_break = '
';
- $docu = true;
- break;
case 'query_only':
$str = '';
$html_line_break = "\n";
@@ -2887,9 +2854,7 @@ function PMA_SQP_format(
$after .= "\n";
*/
$str .= $before;
- if ($mode=='color') {
- $str .= PMA_SQP_formatHtml_colorize($arr[$i]);
- } elseif ($mode == 'text') {
+ if ($mode == 'text') {
$str .= htmlspecialchars($arr[$i]['data']);
} else {
$str .= $arr[$i]['data'];
@@ -2910,10 +2875,6 @@ function PMA_SQP_format(
// close inner_sql span
$str .= '';
}
- if ($mode=='color') {
- // close syntax span
- $str .= '';
- }
return $str;
} // end of the "PMA_SQP_format()" function
diff --git a/test/libraries/common/PMA_formatSql_test.php b/test/libraries/common/PMA_formatSql_test.php
index 35d887f69f..93712bcfed 100644
--- a/test/libraries/common/PMA_formatSql_test.php
+++ b/test/libraries/common/PMA_formatSql_test.php
@@ -44,243 +44,6 @@ class PMA_FormatSql_Test extends PHPUnit_Framework_TestCase
$cfg = $this->tmpCfg;
}
- function testFormatSQLNotArray()
- {
- global $cfg;
- $cfg['SQP']['fmtType'] = 'html';
- $sql = "SELECT * FROM tTable;";
- $this->assertEquals(
- "
\n$sql\n", - PMA_Util::formatSql($sql) - ); - } - - function testFormatSQLfmTypeHtml_1() - { - global $cfg; - $cfg['SQP']['fmtType'] = 'html'; - $cfg['MySQLManualType'] = 'none'; - - $sql = array ( - 'raw' => 'SELECT 1;', - 0 => - array ( - 'type' => 'alpha_reservedWord', - 'data' => 'SELECT', - 'pos' => 6, - 'forbidden' => true, - ), - 1 => - array ( - 'type' => 'digit_integer', - 'data' => '1', - 'pos' => 8, - ), - 2 => - array ( - 'type' => 'punct_queryend', - 'data' => ';', - 'pos' => 0, - ), - 'len' => 3, - ); - $unparsed = "SELECT 1;"; - $expected = 'SELECT 1 ;