109 lines
7.2 KiB
JavaScript
109 lines
7.2 KiB
JavaScript
/*
|
|
Language: SQL
|
|
Contributors: Nikolay Lisienko <info@neor.ru>, Heiko August <post@auge8472.de>, Travis Odom <travis.a.odom@gmail.com>
|
|
Category: common
|
|
*/
|
|
|
|
function(hljs) {
|
|
var COMMENT_MODE = {
|
|
className: 'comment',
|
|
begin: '--', end: '$'
|
|
};
|
|
return {
|
|
case_insensitive: true,
|
|
illegal: /[<>]/,
|
|
contains: [
|
|
{
|
|
className: 'operator',
|
|
beginKeywords:
|
|
'begin end start commit rollback savepoint lock alter create drop rename call '+
|
|
'delete do handler insert load replace select truncate update set show pragma grant '+
|
|
'merge describe use explain help declare prepare execute deallocate savepoint release '+
|
|
'unlock purge reset change stop analyze cache flush optimize repair kill '+
|
|
'install uninstall checksum restore check backup',
|
|
end: /;/, endsWithParent: true,
|
|
keywords: {
|
|
keyword:
|
|
'abs absolute acos action add adddate addtime aes_decrypt aes_encrypt after aggregate all allocate alter ' +
|
|
'analyze and any are as asc ascii asin assertion at atan atan2 atn2 authorization authors avg backup ' +
|
|
'before begin benchmark between bin binlog bit_and bit_count bit_length bit_or bit_xor both by ' +
|
|
'cache call cascade cascaded case cast catalog ceil ceiling chain change changed char_length ' +
|
|
'character_length charindex charset check checksum checksum_agg choose close coalesce ' +
|
|
'coercibility collate collation collationproperty column columns columns_updated commit compress concat ' +
|
|
'concat_ws concurrent connect connection connection_id consistent constraint constraints continue ' +
|
|
'contributors conv convert convert_tz corresponding cos cot count count_big crc32 create cross cume_dist ' +
|
|
'curdate current current_date current_time current_timestamp current_user cursor curtime data database ' +
|
|
'databases datalength date_add date_format date_sub dateadd datediff datefromparts datename ' +
|
|
'datepart datetime2fromparts datetimeoffsetfromparts day dayname dayofmonth dayofweek dayofyear ' +
|
|
'deallocate declare decode default deferrable deferred degrees delayed delete des_decrypt ' +
|
|
'des_encrypt des_key_file desc describe descriptor diagnostics difference disconnect distinct ' +
|
|
'distinctrow div do domain double drop dumpfile each else elt enclosed encode encrypt end end-exec ' +
|
|
'engine engines eomonth errors escape escaped event eventdata events except exception exec execute ' +
|
|
'exists exp explain export_set extended external extract fast fetch field fields find_in_set ' +
|
|
'first first_value floor flush for force foreign format found found_rows from from_base64 ' +
|
|
'from_days from_unixtime full function get get_format get_lock getdate getutcdate global go goto grant ' +
|
|
'grants greatest group group_concat grouping grouping_id gtid_subset gtid_subtract handler having help ' +
|
|
'hex high_priority hosts hour ident_current ident_incr ident_seed identified identity if ifnull ignore ' +
|
|
'iif ilike immediate in index indicator inet6_aton inet6_ntoa inet_aton inet_ntoa infile initially inner ' +
|
|
'innodb input insert install instr intersect into is is_free_lock is_ipv4 ' +
|
|
'is_ipv4_compat is_ipv4_mapped is_not is_not_null is_used_lock isdate isnull isolation join key kill ' +
|
|
'language last last_day last_insert_id last_value lcase lead leading least leaves left len lenght level ' +
|
|
'like limit lines ln load load_file local localtime localtimestamp locate lock log log10 log2 logfile ' +
|
|
'logs low_priority lower lpad ltrim make_set makedate maketime master master_pos_wait match matched max ' +
|
|
'md5 medium merge microsecond mid min minute mod mode module month monthname mutex name_const names ' +
|
|
'national natural nchar next no no_write_to_binlog not now nullif nvarchar oct ' +
|
|
'octet_length of old_password on only open optimize option optionally or ord order outer outfile output ' +
|
|
'pad parse partial partition password patindex percent_rank percentile_cont percentile_disc period_add ' +
|
|
'period_diff pi plugin position pow power pragma precision prepare preserve primary prior privileges ' +
|
|
'procedure procedure_analyze processlist profile profiles public publishingservername purge quarter ' +
|
|
'query quick quote quotename radians rand read references regexp relative relaylog release ' +
|
|
'release_lock rename repair repeat replace replicate reset restore restrict return returns reverse ' +
|
|
'revoke right rlike rollback rollup round row row_count rows rpad rtrim savepoint schema scroll ' +
|
|
'sec_to_time second section select serializable server session session_user set sha sha1 sha2 share ' +
|
|
'show sign sin size slave sleep smalldatetimefromparts snapshot some soname soundex ' +
|
|
'sounds_like space sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache ' +
|
|
'sql_small_result sql_variant_property sqlstate sqrt square start starting status std ' +
|
|
'stddev stddev_pop stddev_samp stdev stdevp stop str str_to_date straight_join strcmp string stuff ' +
|
|
'subdate substr substring subtime subtring_index sum switchoffset sysdate sysdatetime sysdatetimeoffset ' +
|
|
'system_user sysutcdatetime table tables tablespace tan temporary terminated tertiary_weights then time ' +
|
|
'time_format time_to_sec timediff timefromparts timestamp timestampadd timestampdiff timezone_hour ' +
|
|
'timezone_minute to to_base64 to_days to_seconds todatetimeoffset trailing transaction translation ' +
|
|
'trigger trigger_nestlevel triggers trim truncate try_cast try_convert try_parse ucase uncompress ' +
|
|
'uncompressed_length unhex unicode uninstall union unique unix_timestamp unknown unlock update upgrade ' +
|
|
'upped upper usage use user user_resources using utc_date utc_time utc_timestamp uuid uuid_short ' +
|
|
'validate_password_strength value values var var_pop var_samp variables variance varp ' +
|
|
'version view warnings week weekday weekofyear weight_string when whenever where with work write xml ' +
|
|
'xor year yearweek zon',
|
|
literal:
|
|
'true false null',
|
|
built_in:
|
|
'array bigint binary bit blob boolean char character date dec decimal float int integer interval number ' +
|
|
'numeric real serial smallint varchar varying int8 serial8 text'
|
|
},
|
|
contains: [
|
|
{
|
|
className: 'string',
|
|
begin: '\'', end: '\'',
|
|
contains: [hljs.BACKSLASH_ESCAPE, {begin: '\'\''}]
|
|
},
|
|
{
|
|
className: 'string',
|
|
begin: '"', end: '"',
|
|
contains: [hljs.BACKSLASH_ESCAPE, {begin: '""'}]
|
|
},
|
|
{
|
|
className: 'string',
|
|
begin: '`', end: '`',
|
|
contains: [hljs.BACKSLASH_ESCAPE]
|
|
},
|
|
hljs.C_NUMBER_MODE,
|
|
hljs.C_BLOCK_COMMENT_MODE,
|
|
COMMENT_MODE
|
|
]
|
|
},
|
|
hljs.C_BLOCK_COMMENT_MODE,
|
|
COMMENT_MODE
|
|
]
|
|
};
|
|
}
|