123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335 |
- """
- pygments.lexers._mysql_builtins
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Self-updating data files for the MySQL lexer.
- Run with `python -I` to update.
- :copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS.
- :license: BSD, see LICENSE for details.
- """
- MYSQL_CONSTANTS = (
- 'false',
- 'null',
- 'true',
- 'unknown',
- )
- # At this time, no easily-parsed, definitive list of data types
- # has been found in the MySQL source code or documentation. (The
- # `sql/sql_yacc.yy` file is definitive but is difficult to parse.)
- # Therefore these types are currently maintained manually.
- #
- # Some words in this list -- like "long", "national", "precision",
- # and "varying" -- appear to only occur in combination with other
- # data type keywords. Therefore they are included as separate words
- # even though they do not naturally occur in syntax separately.
- #
- # This list is also used to strip data types out of the list of
- # MySQL keywords, which is automatically updated later in the file.
- #
- MYSQL_DATATYPES = (
- # Numeric data types
- 'bigint',
- 'bit',
- 'bool',
- 'boolean',
- 'dec',
- 'decimal',
- 'double',
- 'fixed',
- 'float',
- 'float4',
- 'float8',
- 'int',
- 'int1',
- 'int2',
- 'int3',
- 'int4',
- 'int8',
- 'integer',
- 'mediumint',
- 'middleint',
- 'numeric',
- 'precision',
- 'real',
- 'serial',
- 'smallint',
- 'tinyint',
- # Date and time data types
- 'date',
- 'datetime',
- 'time',
- 'timestamp',
- 'year',
- # String data types
- 'binary',
- 'blob',
- 'char',
- 'enum',
- 'long',
- 'longblob',
- 'longtext',
- 'mediumblob',
- 'mediumtext',
- 'national',
- 'nchar',
- 'nvarchar',
- 'set',
- 'text',
- 'tinyblob',
- 'tinytext',
- 'varbinary',
- 'varchar',
- 'varcharacter',
- 'varying',
- # Spatial data types
- 'geometry',
- 'geometrycollection',
- 'linestring',
- 'multilinestring',
- 'multipoint',
- 'multipolygon',
- 'point',
- 'polygon',
- # JSON data types
- 'json',
- )
- # Everything below this line is auto-generated from the MySQL source code.
- # Run this file in Python and it will update itself.
- # -----------------------------------------------------------------------------
- MYSQL_FUNCTIONS = (
- 'abs',
- 'acos',
- 'adddate',
- 'addtime',
- 'aes_decrypt',
- 'aes_encrypt',
- 'any_value',
- 'asin',
- 'atan',
- 'atan2',
- 'benchmark',
- 'bin',
- 'bin_to_uuid',
- 'bit_and',
- 'bit_count',
- 'bit_length',
- 'bit_or',
- 'bit_xor',
- 'can_access_column',
- 'can_access_database',
- 'can_access_event',
- 'can_access_resource_group',
- 'can_access_routine',
- 'can_access_table',
- 'can_access_trigger',
- 'can_access_user',
- 'can_access_view',
- 'cast',
- 'ceil',
- 'ceiling',
- 'char_length',
- 'character_length',
- 'coercibility',
- 'compress',
- 'concat',
- 'concat_ws',
- 'connection_id',
- 'conv',
- 'convert_cpu_id_mask',
- 'convert_interval_to_user_interval',
- 'convert_tz',
- 'cos',
- 'cot',
- 'count',
- 'crc32',
- 'curdate',
- 'current_role',
- 'curtime',
- 'date_add',
- 'date_format',
- 'date_sub',
- 'datediff',
- 'dayname',
- 'dayofmonth',
- 'dayofweek',
- 'dayofyear',
- 'degrees',
- 'elt',
- 'exp',
- 'export_set',
- 'extract',
- 'extractvalue',
- 'field',
- 'find_in_set',
- 'floor',
- 'format_bytes',
- 'format_pico_time',
- 'found_rows',
- 'from_base64',
- 'from_days',
- 'from_unixtime',
- 'get_dd_column_privileges',
- 'get_dd_create_options',
- 'get_dd_index_private_data',
- 'get_dd_index_sub_part_length',
- 'get_dd_property_key_value',
- 'get_dd_schema_options',
- 'get_dd_tablespace_private_data',
- 'get_lock',
- 'greatest',
- 'group_concat',
- 'gtid_subset',
- 'gtid_subtract',
- 'hex',
- 'icu_version',
- 'ifnull',
- 'inet6_aton',
- 'inet6_ntoa',
- 'inet_aton',
- 'inet_ntoa',
- 'instr',
- 'internal_auto_increment',
- 'internal_avg_row_length',
- 'internal_check_time',
- 'internal_checksum',
- 'internal_data_free',
- 'internal_data_length',
- 'internal_dd_char_length',
- 'internal_get_comment_or_error',
- 'internal_get_dd_column_extra',
- 'internal_get_enabled_role_json',
- 'internal_get_hostname',
- 'internal_get_mandatory_roles_json',
- 'internal_get_partition_nodegroup',
- 'internal_get_username',
- 'internal_get_view_warning_or_error',
- 'internal_index_column_cardinality',
- 'internal_index_length',
- 'internal_is_enabled_role',
- 'internal_is_mandatory_role',
- 'internal_keys_disabled',
- 'internal_max_data_length',
- 'internal_table_rows',
- 'internal_tablespace_autoextend_size',
- 'internal_tablespace_data_free',
- 'internal_tablespace_extent_size',
- 'internal_tablespace_extra',
- 'internal_tablespace_free_extents',
- 'internal_tablespace_id',
- 'internal_tablespace_initial_size',
- 'internal_tablespace_logfile_group_name',
- 'internal_tablespace_logfile_group_number',
- 'internal_tablespace_maximum_size',
- 'internal_tablespace_row_format',
- 'internal_tablespace_status',
- 'internal_tablespace_total_extents',
- 'internal_tablespace_type',
- 'internal_tablespace_version',
- 'internal_update_time',
- 'is_free_lock',
- 'is_ipv4',
- 'is_ipv4_compat',
- 'is_ipv4_mapped',
- 'is_ipv6',
- 'is_used_lock',
- 'is_uuid',
- 'is_visible_dd_object',
- 'isnull',
- 'json_array',
- 'json_array_append',
- 'json_array_insert',
- 'json_arrayagg',
- 'json_contains',
- 'json_contains_path',
- 'json_depth',
- 'json_extract',
- 'json_insert',
- 'json_keys',
- 'json_length',
- 'json_merge',
- 'json_merge_patch',
- 'json_merge_preserve',
- 'json_object',
- 'json_objectagg',
- 'json_overlaps',
- 'json_pretty',
- 'json_quote',
- 'json_remove',
- 'json_replace',
- 'json_schema_valid',
- 'json_schema_validation_report',
- 'json_search',
- 'json_set',
- 'json_storage_free',
- 'json_storage_size',
- 'json_type',
- 'json_unquote',
- 'json_valid',
- 'last_day',
- 'last_insert_id',
- 'lcase',
- 'least',
- 'length',
- 'like_range_max',
- 'like_range_min',
- 'ln',
- 'load_file',
- 'locate',
- 'log',
- 'log10',
- 'log2',
- 'lower',
- 'lpad',
- 'ltrim',
- 'make_set',
- 'makedate',
- 'maketime',
- 'master_pos_wait',
- 'max',
- 'mbrcontains',
- 'mbrcoveredby',
- 'mbrcovers',
- 'mbrdisjoint',
- 'mbrequals',
- 'mbrintersects',
- 'mbroverlaps',
- 'mbrtouches',
- 'mbrwithin',
- 'md5',
- 'mid',
- 'min',
- 'monthname',
- 'name_const',
- 'now',
- 'nullif',
- 'oct',
- 'octet_length',
- 'ord',
- 'period_add',
- 'period_diff',
- 'pi',
- 'position',
- 'pow',
- 'power',
- 'ps_current_thread_id',
- 'ps_thread_id',
- 'quote',
- 'radians',
- 'rand',
- 'random_bytes',
- 'regexp_instr',
- 'regexp_like',
- 'regexp_replace',
- 'regexp_substr',
- 'release_all_locks',
- 'release_lock',
- 'remove_dd_property_key',
- 'reverse',
- 'roles_graphml',
- 'round',
- 'rpad',
- 'rtrim',
- 'sec_to_time',
- 'session_user',
- 'sha',
- 'sha1',
- 'sha2',
- 'sign',
- 'sin',
- 'sleep',
- 'soundex',
- 'source_pos_wait',
- 'space',
- 'sqrt',
- 'st_area',
- 'st_asbinary',
- 'st_asgeojson',
- 'st_astext',
- 'st_aswkb',
- 'st_aswkt',
- 'st_buffer',
- 'st_buffer_strategy',
- 'st_centroid',
- 'st_collect',
- 'st_contains',
- 'st_convexhull',
- 'st_crosses',
- 'st_difference',
- 'st_dimension',
- 'st_disjoint',
- 'st_distance',
- 'st_distance_sphere',
- 'st_endpoint',
- 'st_envelope',
- 'st_equals',
- 'st_exteriorring',
- 'st_frechetdistance',
- 'st_geohash',
- 'st_geomcollfromtext',
- 'st_geomcollfromtxt',
- 'st_geomcollfromwkb',
- 'st_geometrycollectionfromtext',
- 'st_geometrycollectionfromwkb',
- 'st_geometryfromtext',
- 'st_geometryfromwkb',
- 'st_geometryn',
- 'st_geometrytype',
- 'st_geomfromgeojson',
- 'st_geomfromtext',
- 'st_geomfromwkb',
- 'st_hausdorffdistance',
- 'st_interiorringn',
- 'st_intersection',
- 'st_intersects',
- 'st_isclosed',
- 'st_isempty',
- 'st_issimple',
- 'st_isvalid',
- 'st_latfromgeohash',
- 'st_latitude',
- 'st_length',
- 'st_linefromtext',
- 'st_linefromwkb',
- 'st_lineinterpolatepoint',
- 'st_lineinterpolatepoints',
- 'st_linestringfromtext',
- 'st_linestringfromwkb',
- 'st_longfromgeohash',
- 'st_longitude',
- 'st_makeenvelope',
- 'st_mlinefromtext',
- 'st_mlinefromwkb',
- 'st_mpointfromtext',
- 'st_mpointfromwkb',
- 'st_mpolyfromtext',
- 'st_mpolyfromwkb',
- 'st_multilinestringfromtext',
- 'st_multilinestringfromwkb',
- 'st_multipointfromtext',
- 'st_multipointfromwkb',
- 'st_multipolygonfromtext',
- 'st_multipolygonfromwkb',
- 'st_numgeometries',
- 'st_numinteriorring',
- 'st_numinteriorrings',
- 'st_numpoints',
- 'st_overlaps',
- 'st_pointatdistance',
- 'st_pointfromgeohash',
- 'st_pointfromtext',
- 'st_pointfromwkb',
- 'st_pointn',
- 'st_polyfromtext',
- 'st_polyfromwkb',
- 'st_polygonfromtext',
- 'st_polygonfromwkb',
- 'st_simplify',
- 'st_srid',
- 'st_startpoint',
- 'st_swapxy',
- 'st_symdifference',
- 'st_touches',
- 'st_transform',
- 'st_union',
- 'st_validate',
- 'st_within',
- 'st_x',
- 'st_y',
- 'statement_digest',
- 'statement_digest_text',
- 'std',
- 'stddev',
- 'stddev_pop',
- 'stddev_samp',
- 'str_to_date',
- 'strcmp',
- 'subdate',
- 'substr',
- 'substring',
- 'substring_index',
- 'subtime',
- 'sum',
- 'sysdate',
- 'system_user',
- 'tan',
- 'time_format',
- 'time_to_sec',
- 'timediff',
- 'to_base64',
- 'to_days',
- 'to_seconds',
- 'trim',
- 'ucase',
- 'uncompress',
- 'uncompressed_length',
- 'unhex',
- 'unix_timestamp',
- 'updatexml',
- 'upper',
- 'uuid',
- 'uuid_short',
- 'uuid_to_bin',
- 'validate_password_strength',
- 'var_pop',
- 'var_samp',
- 'variance',
- 'version',
- 'wait_for_executed_gtid_set',
- 'wait_until_sql_thread_after_gtids',
- 'weekday',
- 'weekofyear',
- 'yearweek',
- )
- MYSQL_OPTIMIZER_HINTS = (
- 'bka',
- 'bnl',
- 'derived_condition_pushdown',
- 'dupsweedout',
- 'firstmatch',
- 'group_index',
- 'hash_join',
- 'index',
- 'index_merge',
- 'intoexists',
- 'join_fixed_order',
- 'join_index',
- 'join_order',
- 'join_prefix',
- 'join_suffix',
- 'loosescan',
- 'materialization',
- 'max_execution_time',
- 'merge',
- 'mrr',
- 'no_bka',
- 'no_bnl',
- 'no_derived_condition_pushdown',
- 'no_group_index',
- 'no_hash_join',
- 'no_icp',
- 'no_index',
- 'no_index_merge',
- 'no_join_index',
- 'no_merge',
- 'no_mrr',
- 'no_order_index',
- 'no_range_optimization',
- 'no_semijoin',
- 'no_skip_scan',
- 'order_index',
- 'qb_name',
- 'resource_group',
- 'semijoin',
- 'set_var',
- 'skip_scan',
- 'subquery',
- )
- MYSQL_KEYWORDS = (
- 'accessible',
- 'account',
- 'action',
- 'active',
- 'add',
- 'admin',
- 'after',
- 'against',
- 'aggregate',
- 'algorithm',
- 'all',
- 'alter',
- 'always',
- 'analyze',
- 'and',
- 'any',
- 'array',
- 'as',
- 'asc',
- 'ascii',
- 'asensitive',
- 'assign_gtids_to_anonymous_transactions',
- 'at',
- 'attribute',
- 'authentication',
- 'auto_increment',
- 'autoextend_size',
- 'avg',
- 'avg_row_length',
- 'backup',
- 'before',
- 'begin',
- 'between',
- 'binlog',
- 'block',
- 'both',
- 'btree',
- 'buckets',
- 'by',
- 'byte',
- 'cache',
- 'call',
- 'cascade',
- 'cascaded',
- 'case',
- 'catalog_name',
- 'chain',
- 'challenge_response',
- 'change',
- 'changed',
- 'channel',
- 'character',
- 'charset',
- 'check',
- 'checksum',
- 'cipher',
- 'class_origin',
- 'client',
- 'clone',
- 'close',
- 'coalesce',
- 'code',
- 'collate',
- 'collation',
- 'column',
- 'column_format',
- 'column_name',
- 'columns',
- 'comment',
- 'commit',
- 'committed',
- 'compact',
- 'completion',
- 'component',
- 'compressed',
- 'compression',
- 'concurrent',
- 'condition',
- 'connection',
- 'consistent',
- 'constraint',
- 'constraint_catalog',
- 'constraint_name',
- 'constraint_schema',
- 'contains',
- 'context',
- 'continue',
- 'convert',
- 'cpu',
- 'create',
- 'cross',
- 'cube',
- 'cume_dist',
- 'current',
- 'current_date',
- 'current_time',
- 'current_timestamp',
- 'current_user',
- 'cursor',
- 'cursor_name',
- 'data',
- 'database',
- 'databases',
- 'datafile',
- 'day',
- 'day_hour',
- 'day_microsecond',
- 'day_minute',
- 'day_second',
- 'deallocate',
- 'declare',
- 'default',
- 'default_auth',
- 'definer',
- 'definition',
- 'delay_key_write',
- 'delayed',
- 'delete',
- 'dense_rank',
- 'desc',
- 'describe',
- 'description',
- 'deterministic',
- 'diagnostics',
- 'directory',
- 'disable',
- 'discard',
- 'disk',
- 'distinct',
- 'distinctrow',
- 'div',
- 'do',
- 'drop',
- 'dual',
- 'dumpfile',
- 'duplicate',
- 'dynamic',
- 'each',
- 'else',
- 'elseif',
- 'empty',
- 'enable',
- 'enclosed',
- 'encryption',
- 'end',
- 'ends',
- 'enforced',
- 'engine',
- 'engine_attribute',
- 'engines',
- 'error',
- 'errors',
- 'escape',
- 'escaped',
- 'event',
- 'events',
- 'every',
- 'except',
- 'exchange',
- 'exclude',
- 'execute',
- 'exists',
- 'exit',
- 'expansion',
- 'expire',
- 'explain',
- 'export',
- 'extended',
- 'extent_size',
- 'factor',
- 'failed_login_attempts',
- 'false',
- 'fast',
- 'faults',
- 'fetch',
- 'fields',
- 'file',
- 'file_block_size',
- 'filter',
- 'finish',
- 'first',
- 'first_value',
- 'flush',
- 'following',
- 'follows',
- 'for',
- 'force',
- 'foreign',
- 'format',
- 'found',
- 'from',
- 'full',
- 'fulltext',
- 'function',
- 'general',
- 'generated',
- 'geomcollection',
- 'get',
- 'get_format',
- 'get_master_public_key',
- 'get_source_public_key',
- 'global',
- 'grant',
- 'grants',
- 'group',
- 'group_replication',
- 'grouping',
- 'groups',
- 'gtid_only',
- 'handler',
- 'hash',
- 'having',
- 'help',
- 'high_priority',
- 'histogram',
- 'history',
- 'host',
- 'hosts',
- 'hour',
- 'hour_microsecond',
- 'hour_minute',
- 'hour_second',
- 'identified',
- 'if',
- 'ignore',
- 'ignore_server_ids',
- 'import',
- 'in',
- 'inactive',
- 'index',
- 'indexes',
- 'infile',
- 'initial',
- 'initial_size',
- 'initiate',
- 'inner',
- 'inout',
- 'insensitive',
- 'insert',
- 'insert_method',
- 'install',
- 'instance',
- 'interval',
- 'into',
- 'invisible',
- 'invoker',
- 'io',
- 'io_after_gtids',
- 'io_before_gtids',
- 'io_thread',
- 'ipc',
- 'is',
- 'isolation',
- 'issuer',
- 'iterate',
- 'join',
- 'json_table',
- 'json_value',
- 'key',
- 'key_block_size',
- 'keyring',
- 'keys',
- 'kill',
- 'lag',
- 'language',
- 'last',
- 'last_value',
- 'lateral',
- 'lead',
- 'leading',
- 'leave',
- 'leaves',
- 'left',
- 'less',
- 'level',
- 'like',
- 'limit',
- 'linear',
- 'lines',
- 'list',
- 'load',
- 'local',
- 'localtime',
- 'localtimestamp',
- 'lock',
- 'locked',
- 'locks',
- 'logfile',
- 'logs',
- 'loop',
- 'low_priority',
- 'master',
- 'master_auto_position',
- 'master_bind',
- 'master_compression_algorithms',
- 'master_connect_retry',
- 'master_delay',
- 'master_heartbeat_period',
- 'master_host',
- 'master_log_file',
- 'master_log_pos',
- 'master_password',
- 'master_port',
- 'master_public_key_path',
- 'master_retry_count',
- 'master_ssl',
- 'master_ssl_ca',
- 'master_ssl_capath',
- 'master_ssl_cert',
- 'master_ssl_cipher',
- 'master_ssl_crl',
- 'master_ssl_crlpath',
- 'master_ssl_key',
- 'master_ssl_verify_server_cert',
- 'master_tls_ciphersuites',
- 'master_tls_version',
- 'master_user',
- 'master_zstd_compression_level',
- 'match',
- 'max_connections_per_hour',
- 'max_queries_per_hour',
- 'max_rows',
- 'max_size',
- 'max_updates_per_hour',
- 'max_user_connections',
- 'maxvalue',
- 'medium',
- 'member',
- 'memory',
- 'merge',
- 'message_text',
- 'microsecond',
- 'migrate',
- 'min_rows',
- 'minute',
- 'minute_microsecond',
- 'minute_second',
- 'mod',
- 'mode',
- 'modifies',
- 'modify',
- 'month',
- 'mutex',
- 'mysql_errno',
- 'name',
- 'names',
- 'natural',
- 'ndb',
- 'ndbcluster',
- 'nested',
- 'network_namespace',
- 'never',
- 'new',
- 'next',
- 'no',
- 'no_wait',
- 'no_write_to_binlog',
- 'nodegroup',
- 'none',
- 'not',
- 'nowait',
- 'nth_value',
- 'ntile',
- 'null',
- 'nulls',
- 'number',
- 'of',
- 'off',
- 'offset',
- 'oj',
- 'old',
- 'on',
- 'one',
- 'only',
- 'open',
- 'optimize',
- 'optimizer_costs',
- 'option',
- 'optional',
- 'optionally',
- 'options',
- 'or',
- 'order',
- 'ordinality',
- 'organization',
- 'others',
- 'out',
- 'outer',
- 'outfile',
- 'over',
- 'owner',
- 'pack_keys',
- 'page',
- 'parser',
- 'partial',
- 'partition',
- 'partitioning',
- 'partitions',
- 'password',
- 'password_lock_time',
- 'path',
- 'percent_rank',
- 'persist',
- 'persist_only',
- 'phase',
- 'plugin',
- 'plugin_dir',
- 'plugins',
- 'port',
- 'precedes',
- 'preceding',
- 'prepare',
- 'preserve',
- 'prev',
- 'primary',
- 'privilege_checks_user',
- 'privileges',
- 'procedure',
- 'process',
- 'processlist',
- 'profile',
- 'profiles',
- 'proxy',
- 'purge',
- 'quarter',
- 'query',
- 'quick',
- 'random',
- 'range',
- 'rank',
- 'read',
- 'read_only',
- 'read_write',
- 'reads',
- 'rebuild',
- 'recover',
- 'recursive',
- 'redo_buffer_size',
- 'redundant',
- 'reference',
- 'references',
- 'regexp',
- 'registration',
- 'relay',
- 'relay_log_file',
- 'relay_log_pos',
- 'relay_thread',
- 'relaylog',
- 'release',
- 'reload',
- 'remove',
- 'rename',
- 'reorganize',
- 'repair',
- 'repeat',
- 'repeatable',
- 'replace',
- 'replica',
- 'replicas',
- 'replicate_do_db',
- 'replicate_do_table',
- 'replicate_ignore_db',
- 'replicate_ignore_table',
- 'replicate_rewrite_db',
- 'replicate_wild_do_table',
- 'replicate_wild_ignore_table',
- 'replication',
- 'require',
- 'require_row_format',
- 'require_table_primary_key_check',
- 'reset',
- 'resignal',
- 'resource',
- 'respect',
- 'restart',
- 'restore',
- 'restrict',
- 'resume',
- 'retain',
- 'return',
- 'returned_sqlstate',
- 'returning',
- 'returns',
- 'reuse',
- 'reverse',
- 'revoke',
- 'right',
- 'rlike',
- 'role',
- 'rollback',
- 'rollup',
- 'rotate',
- 'routine',
- 'row',
- 'row_count',
- 'row_format',
- 'row_number',
- 'rows',
- 'rtree',
- 'savepoint',
- 'schedule',
- 'schema',
- 'schema_name',
- 'schemas',
- 'second',
- 'second_microsecond',
- 'secondary',
- 'secondary_engine',
- 'secondary_engine_attribute',
- 'secondary_load',
- 'secondary_unload',
- 'security',
- 'select',
- 'sensitive',
- 'separator',
- 'serializable',
- 'server',
- 'session',
- 'share',
- 'show',
- 'shutdown',
- 'signal',
- 'signed',
- 'simple',
- 'skip',
- 'slave',
- 'slow',
- 'snapshot',
- 'socket',
- 'some',
- 'soname',
- 'sounds',
- 'source',
- 'source_auto_position',
- 'source_bind',
- 'source_compression_algorithms',
- 'source_connect_retry',
- 'source_connection_auto_failover',
- 'source_delay',
- 'source_heartbeat_period',
- 'source_host',
- 'source_log_file',
- 'source_log_pos',
- 'source_password',
- 'source_port',
- 'source_public_key_path',
- 'source_retry_count',
- 'source_ssl',
- 'source_ssl_ca',
- 'source_ssl_capath',
- 'source_ssl_cert',
- 'source_ssl_cipher',
- 'source_ssl_crl',
- 'source_ssl_crlpath',
- 'source_ssl_key',
- 'source_ssl_verify_server_cert',
- 'source_tls_ciphersuites',
- 'source_tls_version',
- 'source_user',
- 'source_zstd_compression_level',
- 'spatial',
- 'specific',
- 'sql',
- 'sql_after_gtids',
- 'sql_after_mts_gaps',
- 'sql_before_gtids',
- 'sql_big_result',
- 'sql_buffer_result',
- 'sql_calc_found_rows',
- 'sql_no_cache',
- 'sql_small_result',
- 'sql_thread',
- 'sql_tsi_day',
- 'sql_tsi_hour',
- 'sql_tsi_minute',
- 'sql_tsi_month',
- 'sql_tsi_quarter',
- 'sql_tsi_second',
- 'sql_tsi_week',
- 'sql_tsi_year',
- 'sqlexception',
- 'sqlstate',
- 'sqlwarning',
- 'srid',
- 'ssl',
- 'stacked',
- 'start',
- 'starting',
- 'starts',
- 'stats_auto_recalc',
- 'stats_persistent',
- 'stats_sample_pages',
- 'status',
- 'stop',
- 'storage',
- 'stored',
- 'straight_join',
- 'stream',
- 'string',
- 'subclass_origin',
- 'subject',
- 'subpartition',
- 'subpartitions',
- 'super',
- 'suspend',
- 'swaps',
- 'switches',
- 'system',
- 'table',
- 'table_checksum',
- 'table_name',
- 'tables',
- 'tablespace',
- 'temporary',
- 'temptable',
- 'terminated',
- 'than',
- 'then',
- 'thread_priority',
- 'ties',
- 'timestampadd',
- 'timestampdiff',
- 'tls',
- 'to',
- 'trailing',
- 'transaction',
- 'trigger',
- 'triggers',
- 'true',
- 'truncate',
- 'type',
- 'types',
- 'unbounded',
- 'uncommitted',
- 'undefined',
- 'undo',
- 'undo_buffer_size',
- 'undofile',
- 'unicode',
- 'uninstall',
- 'union',
- 'unique',
- 'unknown',
- 'unlock',
- 'unregister',
- 'unsigned',
- 'until',
- 'update',
- 'upgrade',
- 'usage',
- 'use',
- 'use_frm',
- 'user',
- 'user_resources',
- 'using',
- 'utc_date',
- 'utc_time',
- 'utc_timestamp',
- 'validation',
- 'value',
- 'values',
- 'variables',
- 'vcpu',
- 'view',
- 'virtual',
- 'visible',
- 'wait',
- 'warnings',
- 'week',
- 'weight_string',
- 'when',
- 'where',
- 'while',
- 'window',
- 'with',
- 'without',
- 'work',
- 'wrapper',
- 'write',
- 'x509',
- 'xa',
- 'xid',
- 'xml',
- 'xor',
- 'year_month',
- 'zerofill',
- 'zone',
- )
- if __name__ == '__main__': # pragma: no cover
- import re
- from urllib.request import urlopen
- from pygments.util import format_lines
- # MySQL source code
- SOURCE_URL = 'https://github.com/mysql/mysql-server/raw/8.0'
- LEX_URL = SOURCE_URL + '/sql/lex.h'
- ITEM_CREATE_URL = SOURCE_URL + '/sql/item_create.cc'
- def update_myself():
- # Pull content from lex.h.
- lex_file = urlopen(LEX_URL).read().decode('utf8', errors='ignore')
- keywords = parse_lex_keywords(lex_file)
- functions = parse_lex_functions(lex_file)
- optimizer_hints = parse_lex_optimizer_hints(lex_file)
- # Parse content in item_create.cc.
- item_create_file = urlopen(ITEM_CREATE_URL).read().decode('utf8', errors='ignore')
- functions.update(parse_item_create_functions(item_create_file))
- # Remove data types from the set of keywords.
- keywords -= set(MYSQL_DATATYPES)
- update_content('MYSQL_FUNCTIONS', tuple(sorted(functions)))
- update_content('MYSQL_KEYWORDS', tuple(sorted(keywords)))
- update_content('MYSQL_OPTIMIZER_HINTS', tuple(sorted(optimizer_hints)))
- def parse_lex_keywords(f):
- """Parse keywords in lex.h."""
- results = set()
- for m in re.finditer(r'{SYM(?:_HK)?\("(?P<keyword>[a-z0-9_]+)",', f, flags=re.I):
- results.add(m.group('keyword').lower())
- if not results:
- raise ValueError('No keywords found')
- return results
- def parse_lex_optimizer_hints(f):
- """Parse optimizer hints in lex.h."""
- results = set()
- for m in re.finditer(r'{SYM_H\("(?P<keyword>[a-z0-9_]+)",', f, flags=re.I):
- results.add(m.group('keyword').lower())
- if not results:
- raise ValueError('No optimizer hints found')
- return results
- def parse_lex_functions(f):
- """Parse MySQL function names from lex.h."""
- results = set()
- for m in re.finditer(r'{SYM_FN?\("(?P<function>[a-z0-9_]+)",', f, flags=re.I):
- results.add(m.group('function').lower())
- if not results:
- raise ValueError('No lex functions found')
- return results
- def parse_item_create_functions(f):
- """Parse MySQL function names from item_create.cc."""
- results = set()
- for m in re.finditer(r'{"(?P<function>[^"]+?)",\s*SQL_F[^(]+?\(', f, flags=re.I):
- results.add(m.group('function').lower())
- if not results:
- raise ValueError('No item_create functions found')
- return results
- def update_content(field_name, content):
- """Overwrite this file with content parsed from MySQL's source code."""
- with open(__file__, encoding="utf-8") as f:
- data = f.read()
- # Line to start/end inserting
- re_match = re.compile(r'^%s\s*=\s*\($.*?^\s*\)$' % field_name, re.M | re.S)
- m = re_match.search(data)
- if not m:
- raise ValueError('Could not find an existing definition for %s' % field_name)
- new_block = format_lines(field_name, content)
- data = data[:m.start()] + new_block + data[m.end():]
- with open(__file__, 'w', encoding='utf-8', newline='\n') as f:
- f.write(data)
- update_myself()
|