diff --git a/ChangeLog b/ChangeLog index f3f5153be..78a15b68e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -33,6 +33,7 @@ $HeadURL: https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/trunk/phpMyA - rfe #1516803 [edit] Allow to set BLOB to/from NULL with ProtectBinary. - [edit] Do not default to UNHEX when using file upload. - rfe #1379201 [core] Add option to configure session_save_path. ++ [interface] Provide links to documentation in highlighted SQL. 3.3.0.0 (not yet released) + rfe #2308632 [edit] Use hex for (var)binary fields, diff --git a/libraries/common.lib.php b/libraries/common.lib.php index 19b1b444a..81916a51b 100644 --- a/libraries/common.lib.php +++ b/libraries/common.lib.php @@ -364,7 +364,7 @@ function PMA_formatSql($parsed_sql, $unparsed_sql = '') * * @access public */ -function PMA_showMySQLDocu($chapter, $link, $big_icon = false, $anchor = '') +function PMA_showMySQLDocu($chapter, $link, $big_icon = false, $anchor = '', $just_open = false) { global $cfg; @@ -428,7 +428,9 @@ function PMA_showMySQLDocu($chapter, $link, $big_icon = false, $anchor = '') break; } - if ($big_icon) { + if ($just_open) { + return ''; + } elseif ($big_icon) { return '' . $GLOBALS['strDocu'] . ''; } elseif ($GLOBALS['cfg']['ReplaceHelpImg']) { return '' . $GLOBALS['strDocu'] . ''; diff --git a/libraries/sqlparser.lib.php b/libraries/sqlparser.lib.php index 097474196..f5704065d 100644 --- a/libraries/sqlparser.lib.php +++ b/libraries/sqlparser.lib.php @@ -2090,6 +2090,7 @@ if (! defined('PMA_MINIMUM_COMMON')) { $html_line_break = '
'; break; } // end switch + $close_docu_link = false; $indent = 0; $bracketlevel = 0; $functionlevel = 0; @@ -2356,22 +2357,61 @@ if (! defined('PMA_MINIMUM_COMMON')) { switch ($arr[$i]['data']) { case 'CREATE': + case 'ALTER': + case 'DROP': + case 'RENAME'; + case 'TRUNCATE': + case 'ANALYZE': + case 'ANALYSE': + case 'OPTIMIZE': + switch ($arr[$i + 1]['data']) { + case 'EVENT': + case 'TABLE': + case 'TABLESPACE': + case 'FUNCTION': + case 'INDEX': + case 'PROCEDURE': + case 'TRIGGER': + case 'SERVER': + case 'DATABASE': + case 'VIEW': + $before .= PMA_showMySQLDocu('SQL-Syntax', $arr[$i]['data'] . '_' . $arr[$i + 1]['data'], false, '', true); + $close_docu_link = true; + break; + } + if ($arr[$i + 1]['data'] == 'LOGFILE' && $arr[$i + 2]['data'] == 'GROUP') { + $before .= PMA_showMySQLDocu('SQL-Syntax', $arr[$i]['data'] . '_LOGFILE_GROUP', false, '', true); + $close_docu_link = true; + } if (!$in_priv_list) { $space_punct_listsep = $html_line_break; $space_alpha_reserved_word = ' '; } break; + case 'EVENT': + case 'TABLESPACE': + case 'TABLE': + case 'FUNCTION': + case 'INDEX': + case 'PROCEDURE': + case 'SERVER': + case 'TRIGGER': + case 'DATABASE': + case 'VIEW': + case 'GROUP': + if ($close_docu_link) { + $after = '' . $after; + $close_docu_link = false; + } + break; case 'EXPLAIN': case 'DESCRIBE': case 'SET': - case 'ALTER': case 'DELETE': case 'SHOW': - case 'DROP': case 'UPDATE': - case 'TRUNCATE': - case 'ANALYZE': - case 'ANALYSE': + $before .= PMA_showMySQLDocu('SQL-Syntax', $arr[$i]['data'], false, '', true); + $after = '' . $after; if (!$in_priv_list) { $space_punct_listsep = $html_line_break; $space_alpha_reserved_word = ' '; @@ -2379,6 +2419,8 @@ if (! defined('PMA_MINIMUM_COMMON')) { break; case 'INSERT': case 'REPLACE': + $before .= PMA_showMySQLDocu('SQL-Syntax', $arr[$i]['data'], false, '', true); + $after = '' . $after; if (!$in_priv_list) { $space_punct_listsep = $html_line_break; $space_alpha_reserved_word = $html_line_break; @@ -2389,9 +2431,17 @@ if (! defined('PMA_MINIMUM_COMMON')) { $space_alpha_reserved_word = $html_line_break; break; case 'SELECT': + $before .= PMA_showMySQLDocu('SQL-Syntax', 'SELECT', false, '', true); + $after = '' . $after; $space_punct_listsep = ' '; $space_alpha_reserved_word = $html_line_break; break; + case 'CALL': + case 'DO': + case 'HANDLER': + $before .= PMA_showMySQLDocu('SQL-Syntax', $arr[$i]['data'], false, '', true); + $after = '' . $after; + break; default: break; } // end switch ($arr[$i]['data']) @@ -2454,6 +2504,11 @@ if (! defined('PMA_MINIMUM_COMMON')) { */ $str .= $before . ($mode=='color' ? PMA_SQP_formatHTML_colorize($arr[$i]) : $arr[$i]['data']). $after; } // end for + /* End possibly unclosed documentation link */ + if ($close_docu_link) { + $str .= ''; + $close_docu_link = false; + } if ($mode=='color') { $str .= ''; }