The branch, master has been updated via 41376df2b088a83778067d1f4f6e7c7669ab3561 (commit) via 91c16608f8afa5d51975bd5e7aa54a828662da83 (commit) via 55d8b1efa04851fc1572154dead2d77820cb596d (commit) via 9b0b9b0b59311aa3274e5ed2060d47240504bfd0 (commit) via 0c964ca10ba0f7b2181332517bd8c62149626500 (commit) via c13e64468b9afed3f5963debbf01533f07bce444 (commit) via 4b3b0c616cc34f9f68da24553741a5e4096e1370 (commit) via cbd0b7d8f7a4887365170251fdd26fb6d44e9af5 (commit) via 6c6ae1c1cc8fec669749f9fbcbdb862b81d206d5 (commit) from d147fd26db0cf8a5965c640c3047494acc2b9d44 (commit)
- Log ----------------------------------------------------------------- commit 41376df2b088a83778067d1f4f6e7c7669ab3561 Author: Michal Čihař mcihar@novell.com Date: Mon Jun 6 16:36:57 2011 +0200
Properly end multi word links
commit 91c16608f8afa5d51975bd5e7aa54a828662da83 Author: Michal Čihař mcihar@novell.com Date: Mon Jun 6 16:33:22 2011 +0200
Documentation for other reserved words
commit 55d8b1efa04851fc1572154dead2d77820cb596d Author: Michal Čihař mcihar@novell.com Date: Mon Jun 6 16:21:23 2011 +0200
Add documentation links to function names
commit 9b0b9b0b59311aa3274e5ed2060d47240504bfd0 Author: Michal Čihař mcihar@novell.com Date: Mon Jun 6 16:13:33 2011 +0200
Move doc back to correct place
commit 0c964ca10ba0f7b2181332517bd8c62149626500 Author: Michal Čihař mcihar@novell.com Date: Mon Jun 6 16:12:33 2011 +0200
Provide doc links for operators
commit c13e64468b9afed3f5963debbf01533f07bce444 Author: Michal Čihař mcihar@novell.com Date: Mon Jun 6 15:58:06 2011 +0200
Coding style
commit 4b3b0c616cc34f9f68da24553741a5e4096e1370 Author: Mateusz Lewandowski gandalfml@users.sourceforge.net Date: Mon Jun 6 15:56:58 2011 +0200
Add data for documentation links.
commit cbd0b7d8f7a4887365170251fdd26fb6d44e9af5 Merge: d147fd26db0cf8a5965c640c3047494acc2b9d44 6c6ae1c1cc8fec669749f9fbcbdb862b81d206d5 Author: Michal Čihař mcihar@novell.com Date: Mon Jun 6 15:54:29 2011 +0200
Merge branch 'integration'
Conflicts: libraries/sqlparser.lib.php
commit 6c6ae1c1cc8fec669749f9fbcbdb862b81d206d5 Author: Mateusz Lewandowski gandalfml@users.sourceforge.net Date: Tue Apr 5 21:30:20 2011 +0200
Better names for some variables
-----------------------------------------------------------------------
Summary of changes: libraries/sqlparser.data.php | 266 ++++++++++++++++++++++++++++++++++++++++++ libraries/sqlparser.lib.php | 55 +++++++-- 2 files changed, 312 insertions(+), 9 deletions(-)
diff --git a/libraries/sqlparser.data.php b/libraries/sqlparser.data.php index 5011ca7..d1c4b16 100644 --- a/libraries/sqlparser.data.php +++ b/libraries/sqlparser.data.php @@ -1222,4 +1222,270 @@ $PMA_SQPdata_column_type = array ( 'YEAR' );
+/** + * Documentation links for operators. + */ +$PMA_SQPdata_operators_docs = array( + '!=' => array('link' => 'comparison-operators','anchor' => 'operator_not-equal'), + '<>' => array('link' => 'comparison-operators','anchor' => 'operator_not-equal'), + '!' => array('link' => 'logical-operators','anchor' => 'operator_not'), + '||' => array('link' => 'logical-operators','anchor' => 'operator_or'), + '+' => array('link' => 'arithmetic-functions','anchor' => 'operator_plus'), + '>>' => array('link' => 'bit-functions','anchor' => 'operator_right-shift'), + '-' => array('link' => 'arithmetic-functions','anchor' => 'operator_minus'), + '*' => array('link' => 'arithmetic-functions','anchor' => 'operator_times'), + '&&' => array('link' => 'logical-operators','anchor' => 'operator_and'), + '&' => array('link' => 'bit-functions','anchor' => 'operator_bitwise-and'), + '~' => array('link' => 'bit-functions','anchor' => 'operator_bitwise-invert'), + '|' => array('link' => 'bit-functions','anchor' => 'operator_bitwise-or'), + '^' => array('link' => 'bit-functions','anchor' => 'operator_bitwise-xor'), + '=' => array('link' => 'assignment-operators','anchor' => 'operator_assign-equal'), + ':=' => array('link' => 'assignment-operators','anchor' => 'operator_assign-value'), + '/' => array('link' => 'arithmetic-functions','anchor' => 'operator_divide'), + '<=>' => array('link' => 'comparison-operators','anchor' => 'operator_equal-to'), + '=' => array('link' => 'comparison-operators','anchor' => 'operator_equal'), + '>=' => array('link' => 'comparison-operators','anchor' => 'operator_greater-than-or-equal'), + '>' => array('link' => 'comparison-operators','anchor' => 'operator_greater-than'), + '<<' => array('link' => 'bit-functions','anchor' => 'operator_left-shift'), + '<=' => array('link' => 'comparison-operators','anchor' => 'operator_less-than-or-equal'), + '<' => array('link' => 'comparison-operators','anchor' => 'operator_less-than'), + '%' => array('link' => 'arithmetic-functions','anchor' => 'operator_mod') +); + +/** + * Documentation links for functions. + */ +$PMA_SQPdata_functions_docs = array( + 'ABS' => array('link' => 'mathematical-functions','anchor' => 'function_abs'), + 'ACOS' => array('link' => 'mathematical-functions','anchor' => 'function_acos'), + 'ADDDATE' => array('link' => 'date-and-time-functions','anchor' => 'function_adddate'), + 'ADDTIME' => array('link' => 'date-and-time-functions','anchor' => 'function_addtime'), + 'AES_DECRYPT' => array('link' => 'encryption-functions','anchor' => 'function_aes_decrypt'), + 'AES_ENCRYPT' => array('link' => 'encryption-functions','anchor' => 'function_aes_encrypt'), + 'AND' => array('link' => 'logical-operators','anchor' => 'operator_and'), + 'ASCII' => array('link' => 'string-functions','anchor' => 'function_ascii'), + 'ASIN' => array('link' => 'mathematical-functions','anchor' => 'function_asin'), + 'ATAN2' => array('link' => 'mathematical-functions','anchor' => 'function_atan2'), + 'ATAN' => array('link' => 'mathematical-functions','anchor' => 'function_atan2'), + 'ATAN' => array('link' => 'mathematical-functions','anchor' => 'function_atan'), + 'AVG' => array('link' => 'group-by-functions','anchor' => 'function_avg'), + 'BENCHMARK' => array('link' => 'information-functions','anchor' => 'function_benchmark'), + 'BIN' => array('link' => 'string-functions','anchor' => 'function_bin'), + 'BINARY' => array('link' => 'cast-functions','anchor' => 'operator_binary'), + 'BIT_AND' => array('link' => 'group-by-functions','anchor' => 'function_bit_and'), + 'BIT_COUNT' => array('link' => 'bit-functions','anchor' => 'function_bit_count'), + 'BIT_LENGTH' => array('link' => 'string-functions','anchor' => 'function_bit_length'), + 'BIT_OR' => array('link' => 'group-by-functions','anchor' => 'function_bit_or'), + 'BIT_XOR' => array('link' => 'group-by-functions','anchor' => 'function_bit_xor'), + 'CASE' => array('link' => 'control-flow-functions','anchor' => 'operator_case'), + 'CAST' => array('link' => 'cast-functions','anchor' => 'function_cast'), + 'CEIL' => array('link' => 'mathematical-functions','anchor' => 'function_ceil'), + 'CEILING' => array('link' => 'mathematical-functions','anchor' => 'function_ceiling'), + 'CHAR_LENGTH' => array('link' => 'string-functions','anchor' => 'function_char_length'), + 'CHAR' => array('link' => 'string-functions','anchor' => 'function_char'), + 'CHARACTER_LENGTH' => array('link' => 'string-functions','anchor' => 'function_character_length'), + 'CHARSET' => array('link' => 'information-functions','anchor' => 'function_charset'), + 'COALESCE' => array('link' => 'comparison-operators','anchor' => 'function_coalesce'), + 'COERCIBILITY' => array('link' => 'information-functions','anchor' => 'function_coercibility'), + 'COLLATION' => array('link' => 'information-functions','anchor' => 'function_collation'), + 'COMPRESS' => array('link' => 'encryption-functions','anchor' => 'function_compress'), + 'CONCAT_WS' => array('link' => 'string-functions','anchor' => 'function_concat_ws'), + 'CONCAT' => array('link' => 'string-functions','anchor' => 'function_concat'), + 'CONNECTION_ID' => array('link' => 'information-functions','anchor' => 'function_connection_id'), + 'CONV' => array('link' => 'mathematical-functions','anchor' => 'function_conv'), + 'CONVERT_TZ' => array('link' => 'date-and-time-functions','anchor' => 'function_convert_tz'), + 'Convert' => array('link' => 'cast-functions','anchor' => 'function_convert'), + 'COS' => array('link' => 'mathematical-functions','anchor' => 'function_cos'), + 'COT' => array('link' => 'mathematical-functions','anchor' => 'function_cot'), + 'COUNT' => array('link' => 'group-by-functions','anchor' => 'function_count'), + 'CRC32' => array('link' => 'mathematical-functions','anchor' => 'function_crc32'), + 'CURDATE' => array('link' => 'date-and-time-functions','anchor' => 'function_curdate'), + 'CURRENT_DATE' => array('link' => 'date-and-time-functions','anchor' => 'function_current_date'), + 'CURRENT_TIME' => array('link' => 'date-and-time-functions','anchor' => 'function_current_time'), + 'CURRENT_TIMESTAMP' => array('link' => 'date-and-time-functions','anchor' => 'function_current_timestamp'), + 'CURRENT_USER' => array('link' => 'information-functions','anchor' => 'function_current_user'), + 'CURTIME' => array('link' => 'date-and-time-functions','anchor' => 'function_curtime'), + 'DATABASE' => array('link' => 'information-functions','anchor' => 'function_database'), + 'DATE_ADD' => array('link' => 'date-and-time-functions','anchor' => 'function_date_add'), + 'DATE_FORMAT' => array('link' => 'date-and-time-functions','anchor' => 'function_date_format'), + 'DATE_SUB' => array('link' => 'date-and-time-functions','anchor' => 'function_date_sub'), + 'DATE' => array('link' => 'date-and-time-functions','anchor' => 'function_date'), + 'DATEDIFF' => array('link' => 'date-and-time-functions','anchor' => 'function_datediff'), + 'DAY' => array('link' => 'date-and-time-functions','anchor' => 'function_day'), + 'DAYNAME' => array('link' => 'date-and-time-functions','anchor' => 'function_dayname'), + 'DAYOFMONTH' => array('link' => 'date-and-time-functions','anchor' => 'function_dayofmonth'), + 'DAYOFWEEK' => array('link' => 'date-and-time-functions','anchor' => 'function_dayofweek'), + 'DAYOFYEAR' => array('link' => 'date-and-time-functions','anchor' => 'function_dayofyear'), + 'DECODE' => array('link' => 'encryption-functions','anchor' => 'function_decode'), + 'DEFAULT' => array('link' => 'miscellaneous-functions','anchor' => 'function_default'), + 'DEGREES' => array('link' => 'mathematical-functions','anchor' => 'function_degrees'), + 'DES_DECRYPT' => array('link' => 'encryption-functions','anchor' => 'function_des_decrypt'), + 'DES_ENCRYPT' => array('link' => 'encryption-functions','anchor' => 'function_des_encrypt'), + 'DIV' => array('link' => 'arithmetic-functions','anchor' => 'operator_div'), + 'ELT' => array('link' => 'string-functions','anchor' => 'function_elt'), + 'ENCODE' => array('link' => 'encryption-functions','anchor' => 'function_encode'), + 'ENCRYPT' => array('link' => 'encryption-functions','anchor' => 'function_encrypt'), + 'EXP' => array('link' => 'mathematical-functions','anchor' => 'function_exp'), + 'EXPORT_SET' => array('link' => 'string-functions','anchor' => 'function_export_set'), + 'EXTRACT' => array('link' => 'date-and-time-functions','anchor' => 'function_extract'), + 'ExtractValue' => array('link' => 'xml-functions','anchor' => 'function_extractvalue'), + 'FIELD' => array('link' => 'string-functions','anchor' => 'function_field'), + 'FIND_IN_SET' => array('link' => 'string-functions','anchor' => 'function_find_in_set'), + 'FLOOR' => array('link' => 'mathematical-functions','anchor' => 'function_floor'), + 'FORMAT' => array('link' => 'string-functions','anchor' => 'function_format'), + 'FOUND_ROWS' => array('link' => 'information-functions','anchor' => 'function_found_rows'), + 'FROM_DAYS' => array('link' => 'date-and-time-functions','anchor' => 'function_from_days'), + 'FROM_UNIXTIME' => array('link' => 'date-and-time-functions','anchor' => 'function_from_unixtime'), + 'GET_FORMAT' => array('link' => 'date-and-time-functions','anchor' => 'function_get_format'), + 'GET_LOCK' => array('link' => 'miscellaneous-functions','anchor' => 'function_get_lock'), + 'GREATEST' => array('link' => 'comparison-operators','anchor' => 'function_greatest'), + 'GROUP_CONCAT' => array('link' => 'group-by-functions','anchor' => 'function_group_concat'), + 'HEX' => array('link' => 'string-functions','anchor' => 'function_hex'), + 'HOUR' => array('link' => 'date-and-time-functions','anchor' => 'function_hour'), + 'IF' => array('link' => 'control-flow-functions','anchor' => 'function_if'), + 'IFNULL' => array('link' => 'control-flow-functions','anchor' => 'function_ifnull'), + 'IN' => array('link' => 'comparison-operators','anchor' => 'function_in'), + 'INET_ATON' => array('link' => 'miscellaneous-functions','anchor' => 'function_inet_aton'), + 'INET_NTOA' => array('link' => 'miscellaneous-functions','anchor' => 'function_inet_ntoa'), + 'INSERT' => array('link' => 'string-functions','anchor' => 'function_insert'), + 'INSTR' => array('link' => 'string-functions','anchor' => 'function_instr'), + 'INTERVAL' => array('link' => 'comparison-operators','anchor' => 'function_interval'), + 'IS_FREE_LOCK' => array('link' => 'miscellaneous-functions','anchor' => 'function_is_free_lock'), + 'IS_USED_LOCK' => array('link' => 'miscellaneous-functions','anchor' => 'function_is_used_lock'), + 'IS' => array('link' => 'comparison-operators','anchor' => 'operator_is'), + 'ISNULL' => array('link' => 'comparison-operators','anchor' => 'function_isnull'), + 'LAST_DAY' => array('link' => 'date-and-time-functions','anchor' => 'function_last_day'), + 'LAST_INSERT_ID' => array('link' => 'information-functions','anchor' => 'function_last_insert_id'), + 'LCASE' => array('link' => 'string-functions','anchor' => 'function_lcase'), + 'LEAST' => array('link' => 'comparison-operators','anchor' => 'function_least'), + 'LEFT' => array('link' => 'string-functions','anchor' => 'function_left'), + 'LENGTH' => array('link' => 'string-functions','anchor' => 'function_length'), + 'LIKE' => array('link' => 'string-comparison-functions','anchor' => 'operator_like'), + 'LN' => array('link' => 'mathematical-functions','anchor' => 'function_ln'), + 'LOAD_FILE' => array('link' => 'string-functions','anchor' => 'function_load_file'), + 'LOCALTIME' => array('link' => 'date-and-time-functions','anchor' => 'function_localtime'), + 'LOCALTIMESTAMP' => array('link' => 'date-and-time-functions','anchor' => 'function_localtimestamp'), + 'LOCATE' => array('link' => 'string-functions','anchor' => 'function_locate'), + 'LOG10' => array('link' => 'mathematical-functions','anchor' => 'function_log10'), + 'LOG2' => array('link' => 'mathematical-functions','anchor' => 'function_log2'), + 'LOG' => array('link' => 'mathematical-functions','anchor' => 'function_log'), + 'LOWER' => array('link' => 'string-functions','anchor' => 'function_lower'), + 'LPAD' => array('link' => 'string-functions','anchor' => 'function_lpad'), + 'LTRIM' => array('link' => 'string-functions','anchor' => 'function_ltrim'), + 'MAKE_SET' => array('link' => 'string-functions','anchor' => 'function_make_set'), + 'MAKEDATE' => array('link' => 'date-and-time-functions','anchor' => 'function_makedate'), + 'MAKETIME' => array('link' => 'date-and-time-functions','anchor' => 'function_maketime'), + 'MASTER_POS_WAIT' => array('link' => 'miscellaneous-functions','anchor' => 'function_master_pos_wait'), + 'MATCH' => array('link' => 'fulltext-search','anchor' => 'function_match'), + 'MAX' => array('link' => 'group-by-functions','anchor' => 'function_max'), + 'MD5' => array('link' => 'encryption-functions','anchor' => 'function_md5'), + 'MICROSECOND' => array('link' => 'date-and-time-functions','anchor' => 'function_microsecond'), + 'MID' => array('link' => 'string-functions','anchor' => 'function_mid'), + 'MIN' => array('link' => 'group-by-functions','anchor' => 'function_min'), + 'MINUTE' => array('link' => 'date-and-time-functions','anchor' => 'function_minute'), + 'MOD' => array('link' => 'mathematical-functions','anchor' => 'function_mod'), + 'MONTH' => array('link' => 'date-and-time-functions','anchor' => 'function_month'), + 'MONTHNAME' => array('link' => 'date-and-time-functions','anchor' => 'function_monthname'), + 'NAME_CONST' => array('link' => 'miscellaneous-functions','anchor' => 'function_name_const'), + 'NOT' => array('link' => 'logical-operators','anchor' => 'operator_not'), + 'NOW' => array('link' => 'date-and-time-functions','anchor' => 'function_now'), + 'NULLIF' => array('link' => 'control-flow-functions','anchor' => 'function_nullif'), + 'OCT' => array('link' => 'mathematical-functions','anchor' => 'function_oct'), + 'OCTET_LENGTH' => array('link' => 'string-functions','anchor' => 'function_octet_length'), + 'OLD_PASSWORD' => array('link' => 'encryption-functions','anchor' => 'function_old_password'), + 'OR' => array('link' => 'logical-operators','anchor' => 'operator_or'), + 'ORD' => array('link' => 'string-functions','anchor' => 'function_ord'), + 'PASSWORD' => array('link' => 'encryption-functions','anchor' => 'function_password'), + 'PERIOD_ADD' => array('link' => 'date-and-time-functions','anchor' => 'function_period_add'), + 'PERIOD_DIFF' => array('link' => 'date-and-time-functions','anchor' => 'function_period_diff'), + 'PI' => array('link' => 'mathematical-functions','anchor' => 'function_pi'), + 'POSITION' => array('link' => 'string-functions','anchor' => 'function_position'), + 'POW' => array('link' => 'mathematical-functions','anchor' => 'function_pow'), + 'POWER' => array('link' => 'mathematical-functions','anchor' => 'function_power'), + 'QUARTER' => array('link' => 'date-and-time-functions','anchor' => 'function_quarter'), + 'QUOTE' => array('link' => 'string-functions','anchor' => 'function_quote'), + 'RADIANS' => array('link' => 'mathematical-functions','anchor' => 'function_radians'), + 'RAND' => array('link' => 'mathematical-functions','anchor' => 'function_rand'), + 'REGEXP' => array('link' => 'regexp','anchor' => 'operator_regexp'), + 'RELEASE_LOCK' => array('link' => 'miscellaneous-functions','anchor' => 'function_release_lock'), + 'REPEAT' => array('link' => 'string-functions','anchor' => 'function_repeat'), + 'REPLACE' => array('link' => 'string-functions','anchor' => 'function_replace'), + 'REVERSE' => array('link' => 'string-functions','anchor' => 'function_reverse'), + 'RIGHT' => array('link' => 'string-functions','anchor' => 'function_right'), + 'RLIKE' => array('link' => 'regexp','anchor' => 'operator_rlike'), + 'ROUND' => array('link' => 'mathematical-functions','anchor' => 'function_round'), + 'ROW_COUNT' => array('link' => 'information-functions','anchor' => 'function_row_count'), + 'RPAD' => array('link' => 'string-functions','anchor' => 'function_rpad'), + 'RTRIM' => array('link' => 'string-functions','anchor' => 'function_rtrim'), + 'SCHEMA' => array('link' => 'information-functions','anchor' => 'function_schema'), + 'SEC_TO_TIME' => array('link' => 'date-and-time-functions','anchor' => 'function_sec_to_time'), + 'SECOND' => array('link' => 'date-and-time-functions','anchor' => 'function_second'), + 'SESSION_USER' => array('link' => 'information-functions','anchor' => 'function_session_user'), + 'SHA' => array('link' => 'encryption-functions','anchor' => 'function_sha1'), + 'SHA1' => array('link' => 'encryption-functions','anchor' => 'function_sha1'), + 'SIGN' => array('link' => 'mathematical-functions','anchor' => 'function_sign'), + 'SIN' => array('link' => 'mathematical-functions','anchor' => 'function_sin'), + 'SLEEP' => array('link' => 'miscellaneous-functions','anchor' => 'function_sleep'), + 'SOUNDEX' => array('link' => 'string-functions','anchor' => 'function_soundex'), + 'SPACE' => array('link' => 'string-functions','anchor' => 'function_space'), + 'SQRT' => array('link' => 'mathematical-functions','anchor' => 'function_sqrt'), + 'STD' => array('link' => 'group-by-functions','anchor' => 'function_std'), + 'STDDEV_POP' => array('link' => 'group-by-functions','anchor' => 'function_stddev_pop'), + 'STDDEV_SAMP' => array('link' => 'group-by-functions','anchor' => 'function_stddev_samp'), + 'STDDEV' => array('link' => 'group-by-functions','anchor' => 'function_stddev'), + 'STR_TO_DATE' => array('link' => 'date-and-time-functions','anchor' => 'function_str_to_date'), + 'STRCMP' => array('link' => 'string-comparison-functions','anchor' => 'function_strcmp'), + 'SUBDATE' => array('link' => 'date-and-time-functions','anchor' => 'function_subdate'), + 'SUBSTR' => array('link' => 'string-functions','anchor' => 'function_substr'), + 'SUBSTRING_INDEX' => array('link' => 'string-functions','anchor' => 'function_substring_index'), + 'SUBSTRING' => array('link' => 'string-functions','anchor' => 'function_substring'), + 'SUBTIME' => array('link' => 'date-and-time-functions','anchor' => 'function_subtime'), + 'SUM' => array('link' => 'group-by-functions','anchor' => 'function_sum'), + 'SYSDATE' => array('link' => 'date-and-time-functions','anchor' => 'function_sysdate'), + 'SYSTEM_USER' => array('link' => 'information-functions','anchor' => 'function_system_user'), + 'TAN' => array('link' => 'mathematical-functions','anchor' => 'function_tan'), + 'TIME_FORMAT' => array('link' => 'date-and-time-functions','anchor' => 'function_time_format'), + 'TIME_TO_SEC' => array('link' => 'date-and-time-functions','anchor' => 'function_time_to_sec'), + 'TIME' => array('link' => 'date-and-time-functions','anchor' => 'function_time'), + 'TIMEDIFF' => array('link' => 'date-and-time-functions','anchor' => 'function_timediff'), + 'TIMESTAMP' => array('link' => 'date-and-time-functions','anchor' => 'function_timestamp'), + 'TIMESTAMPADD' => array('link' => 'date-and-time-functions','anchor' => 'function_timestampadd'), + 'TIMESTAMPDIFF' => array('link' => 'date-and-time-functions','anchor' => 'function_timestampdiff'), + 'TO_DAYS' => array('link' => 'date-and-time-functions','anchor' => 'function_to_days'), + 'TRIM' => array('link' => 'string-functions','anchor' => 'function_trim'), + 'TRUNCATE' => array('link' => 'mathematical-functions','anchor' => 'function_truncate'), + 'UCASE' => array('link' => 'string-functions','anchor' => 'function_ucase'), + 'UNCOMPRESS' => array('link' => 'encryption-functions','anchor' => 'function_uncompress'), + 'UNCOMPRESSED_LENGTH' => array('link' => 'encryption-functions','anchor' => 'function_uncompressed_length'), + 'UNHEX' => array('link' => 'string-functions','anchor' => 'function_unhex'), + 'UNIX_TIMESTAMP' => array('link' => 'date-and-time-functions','anchor' => 'function_unix_timestamp'), + 'UpdateXML' => array('link' => 'xml-functions','anchor' => 'function_updatexml'), + 'UPPER' => array('link' => 'string-functions','anchor' => 'function_upper'), + 'USER' => array('link' => 'information-functions','anchor' => 'function_user'), + 'UTC_DATE' => array('link' => 'date-and-time-functions','anchor' => 'function_utc_date'), + 'UTC_TIME' => array('link' => 'date-and-time-functions','anchor' => 'function_utc_time'), + 'UTC_TIMESTAMP' => array('link' => 'date-and-time-functions','anchor' => 'function_utc_timestamp'), + 'UUID_SHORT' => array('link' => 'miscellaneous-functions','anchor' => 'function_uuid_short'), + 'UUID' => array('link' => 'miscellaneous-functions','anchor' => 'function_uuid'), + 'VALUES' => array('link' => 'miscellaneous-functions','anchor' => 'function_values'), + 'VAR_POP' => array('link' => 'group-by-functions','anchor' => 'function_var_pop'), + 'VAR_SAMP' => array('link' => 'group-by-functions','anchor' => 'function_var_samp'), + 'VARIANCE' => array('link' => 'group-by-functions','anchor' => 'function_variance'), + 'VERSION' => array('link' => 'information-functions','anchor' => 'function_version'), + 'WEEK' => array('link' => 'date-and-time-functions','anchor' => 'function_week'), + 'WEEKDAY' => array('link' => 'date-and-time-functions','anchor' => 'function_weekday'), + 'WEEKOFYEAR' => array('link' => 'date-and-time-functions','anchor' => 'function_weekofyear'), + 'XOR' => array('link' => 'logical-operators','anchor' => 'operator_xor'), + 'YEAR' => array('link' => 'date-and-time-functions','anchor' => 'function_year'), + 'YEARWEEK' => array('link' => 'date-and-time-functions','anchor' => 'function_yearweek'), + 'SOUNDS_LIKE' => array('link' => 'string-functions','anchor' => 'operator_sounds-like'), + 'IS_NOT_NULL' => array('link' => 'comparison-operators','anchor' => 'operator_is-not-null'), + 'IS_NOT' => array('link' => 'comparison-operators','anchor' => 'operator_is-not'), + 'IS_NULL' => array('link' => 'comparison-operators','anchor' => 'operator_is-null'), + 'NOT_LIKE' => array('link' => 'string-comparison-functions','anchor' => 'operator_not-like'), + 'NOT_REGEXP' => array('link' => 'regexp','anchor' => 'operator_not-regexp'), + 'COUNT_DISTINCT' => array('link' => 'group-by-functions','anchor' => 'function_count-distinct'), + 'NOT_IN' => array('link' => 'comparison-operators','anchor' => 'function_not-in') +); + ?> diff --git a/libraries/sqlparser.lib.php b/libraries/sqlparser.lib.php index e05d011..46ae2b2 100644 --- a/libraries/sqlparser.lib.php +++ b/libraries/sqlparser.lib.php @@ -2089,6 +2089,7 @@ if (! defined('PMA_MINIMUM_COMMON')) { function PMA_SQP_formatHtml($arr, $mode='color', $start_token=0, $number_of_tokens=-1) { + global $PMA_SQPdata_operators_docs, $PMA_SQPdata_functions_docs; //DEBUG echo 'in Format<pre>'; print_r($arr); echo '</pre>'; // then check for an array if (! is_array($arr)) { @@ -2180,21 +2181,18 @@ if (! defined('PMA_MINIMUM_COMMON')) { $keywords_priv_list_cnt = 2;
if ($number_of_tokens == -1) { - $arraysize = $arr['len']; - } else { - $arraysize = $number_of_tokens; + $number_of_tokens = $arr['len']; } $typearr = array(); - if ($arraysize >= 0) { + if ($number_of_tokens >= 0) { $typearr[0] = ''; $typearr[1] = ''; $typearr[2] = ''; - //$typearr[3] = $arr[0]['type']; $typearr[3] = $arr[$start_token]['type']; }
$in_priv_list = false; - for ($i = $start_token; $i < $arraysize; $i++) { + for ($i = $start_token; $i < $number_of_tokens; $i++) { // DEBUG echo "Loop format <strong>" . $arr[$i]['data'] . "</strong> " . $arr[$i]['type'] . "<br />"; $before = ''; $after = ''; @@ -2205,11 +2203,9 @@ if (! defined('PMA_MINIMUM_COMMON')) { 2 current 3 next */ - if (($i + 1) < $arraysize) { - // array_push($typearr, $arr[$i + 1]['type']); + if (($i + 1) < $number_of_tokens) { $typearr[4] = $arr[$i + 1]['type']; } else { - //array_push($typearr, null); $typearr[4] = ''; }
@@ -2285,6 +2281,17 @@ if (! defined('PMA_MINIMUM_COMMON')) { break; case 'punct': $before .= ' '; + if ($docu && isset($PMA_SQPdata_operators_docs[$arr[$i]['data']]) && + ($arr[$i]['data'] != '*' || in_array($arr[$i]['type'], array('digit_integer','digit_float','digit_hex')))) { + $before .= PMA_showMySQLDocu( + 'functions', + $PMA_SQPdata_operators_docs[$arr[$i]['data']]['link'], + false, + $PMA_SQPdata_operators_docs[$arr[$i]['data']]['anchor'], + true); + $after .= '</a>'; + } + // workaround for // select * from mytable limit 0,-1 // (a side effect of this workaround is that @@ -2388,6 +2395,18 @@ if (! defined('PMA_MINIMUM_COMMON')) { $after .= ' '; } break; + case 'alpha_functionName': + $funcname = strtoupper($arr[$i]['data']); + if ($docu && isset($PMA_SQPdata_functions_docs[$funcname])) { + $before .= PMA_showMySQLDocu( + 'functions', + $PMA_SQPdata_functions_docs[$funcname]['link'], + false, + $PMA_SQPdata_functions_docs[$funcname]['anchor'], + true); + $after .= '</a>'; + } + break; case 'alpha_reservedWord': // do not uppercase the reserved word if we are calling // this function in query_only mode, because we need @@ -2544,6 +2563,24 @@ if (! defined('PMA_MINIMUM_COMMON')) { } break; default: + if ($close_docu_link && in_array($arr[$i]['data'], array('LIKE', 'NOT', 'IN', 'REGEXP', 'NULL'))){ + $after .= '</a>'; + $close_docu_link = false; + } else if ($docu && isset($PMA_SQPdata_functions_docs[$arr[$i]['data']])) { + /* Handle multi word statements first */ + if (isset($typearr[4]) && $typearr[4] == 'alpha_reservedWord' && $typearr[3] == 'alpha_reservedWord' && isset($PMA_SQPdata_functions_docs[strtoupper($arr[$i]['data'] . '_' . $arr[$i + 1]['data'] . '_' . $arr[$i + 2]['data'])])) { + $tempname = strtoupper($arr[$i]['data'] . '_' . $arr[$i + 1]['data'] . '_' . $arr[$i + 2]['data']); + $before .= PMA_showMySQLDocu('functions', $PMA_SQPdata_functions_docs[$tempname]['link'], false, $PMA_SQPdata_functions_docs[$tempname]['anchor'], true); + $close_docu_link = true; + } else if (isset($typearr[3]) && $typearr[3] == 'alpha_reservedWord' && isset($PMA_SQPdata_functions_docs[strtoupper($arr[$i]['data'] . '_' . $arr[$i + 1]['data'])])) { + $tempname = strtoupper($arr[$i]['data'] . '_' . $arr[$i + 1]['data']); + $before .= PMA_showMySQLDocu('functions', $PMA_SQPdata_functions_docs[$tempname]['link'], false, $PMA_SQPdata_functions_docs[$tempname]['anchor'], true); + $close_docu_link = true; + } else { + $before .= PMA_showMySQLDocu('functions', $PMA_SQPdata_functions_docs[$arr[$i]['data']]['link'], false, $PMA_SQPdata_functions_docs[$arr[$i]['data']]['anchor'], true); + $after .= '</a>'; + } + } break; } // end switch ($arr[$i]['data'])
hooks/post-receive