query:
END_OF_INPUT
| verb_clause END_OF_INPUT
;
verb_clause:
statement
| begin
;
statement:
alter
| analyze
| backup
| binlog_base64_event
| call
| change
| check
| checksum
| commit
| create
| deallocate
| delete
| describe
| do
| drop
| execute
| flush
| grant
| handler
| help
| insert
| install
| kill
| load
| lock
| optimize
| keycache
| partition_entry
| preload
| prepare
| purge
| release
| rename
| repair
| replace
| reset
| restore
| revoke
| rollback
| savepoint
| select
| set
| show
| slave
| start
| truncate
| uninstall
| unlock
| update
| use
| xa
;
deallocate:
deallocate_or_drop PREPARE_SYM ident
;
deallocate_or_drop:
DEALLOCATE_SYM
| DROP
;
prepare:
PREPARE_SYM ident FROM prepare_src
;
prepare_src:
TEXT_STRING_sys
| '@' ident_or_text
;
execute:
EXECUTE_SYM ident execute_using
;
execute_using:
/* empty */
| USING execute_var_list
;
execute_var_list:
execute_var_list ',' execute_var_ident
| execute_var_ident
;
execute_var_ident:
'@' ident_or_text
;
help:
HELP_SYM ident_or_text
;
change:
CHANGE MASTER_SYM TO_SYM master_defs
;
master_defs:
master_def
| master_defs ',' master_def
;
master_def:
MASTER_HOST_SYM EQ TEXT_STRING_sys
| MASTER_USER_SYM EQ TEXT_STRING_sys
| MASTER_PASSWORD_SYM EQ TEXT_STRING_sys
| MASTER_PORT_SYM EQ ulong_num
| MASTER_CONNECT_RETRY_SYM EQ ulong_num
| MASTER_SSL_SYM EQ ulong_num
| MASTER_SSL_CA_SYM EQ TEXT_STRING_sys
| MASTER_SSL_CAPATH_SYM EQ TEXT_STRING_sys
| MASTER_SSL_CERT_SYM EQ TEXT_STRING_sys
| MASTER_SSL_CIPHER_SYM EQ TEXT_STRING_sys
| MASTER_SSL_KEY_SYM EQ TEXT_STRING_sys
| MASTER_SSL_VERIFY_SERVER_CERT_SYM EQ ulong_num
| master_file_def
;
master_file_def:
MASTER_LOG_FILE_SYM EQ TEXT_STRING_sys
| MASTER_LOG_POS_SYM EQ ulonglong_num
| RELAY_LOG_FILE_SYM EQ TEXT_STRING_sys
| RELAY_LOG_POS_SYM EQ ulong_num
;
create:
CREATE opt_table_options TABLE_SYM opt_if_not_exists table_ident create2
| CREATE opt_unique_or_fulltext INDEX_SYM ident key_alg ON table_ident '(' key_list ')' key_options
| CREATE DATABASE opt_if_not_exists ident opt_create_database_options
| CREATE view_or_trigger_or_sp_or_event
| CREATE USER clear_privileges grant_list
| CREATE LOGFILE_SYM GROUP_SYM logfile_group_info
| CREATE TABLESPACE tablespace_info
| CREATE server_def
;
server_def:
SERVER_SYM ident_or_text FOREIGN DATA_SYM WRAPPER_SYM ident_or_text OPTIONS_SYM '(' server_options_list ')'
;
server_options_list:
server_option
| server_options_list ',' server_option
;
server_option:
USER TEXT_STRING_sys
| HOST_SYM TEXT_STRING_sys
| DATABASE TEXT_STRING_sys
| OWNER_SYM TEXT_STRING_sys
| PASSWORD TEXT_STRING_sys
| SOCKET_SYM TEXT_STRING_sys
| PORT_SYM ulong_num
;
event_tail:
EVENT_SYM opt_if_not_exists sp_name ON SCHEDULE_SYM ev_schedule_time opt_ev_on_completion opt_ev_status opt_ev_comment DO_SYM ev_sql_stmt
;
ev_schedule_time:
EVERY_SYM expr interval ev_starts ev_ends
| AT_SYM expr
;
opt_ev_status:
/* empty */
| ENABLE_SYM
| DISABLE_SYM ON SLAVE
| DISABLE_SYM
;
ev_starts:
/* empty */
| STARTS_SYM expr
;
ev_ends:
/* empty */
| ENDS_SYM expr
;
opt_ev_on_completion:
/* empty */
| ev_on_completion
;
ev_on_completion:
ON COMPLETION_SYM PRESERVE_SYM
| ON COMPLETION_SYM NOT_SYM PRESERVE_SYM
;
opt_ev_comment:
/* empty */
| COMMENT_SYM TEXT_STRING_sys
;
ev_sql_stmt:
ev_sql_stmt_inner
;
ev_sql_stmt_inner:
sp_proc_stmt_statement
| sp_proc_stmt_return
| sp_proc_stmt_if
| case_stmt_specification
| sp_labeled_control
| sp_proc_stmt_unlabeled
| sp_proc_stmt_leave
| sp_proc_stmt_iterate
| sp_proc_stmt_open
| sp_proc_stmt_fetch
| sp_proc_stmt_close
;
clear_privileges:
/* empty */
;
sp_name:
ident '.' ident
| ident
;
sp_a_chistics:
/* empty */
| sp_a_chistics sp_chistic
;
sp_c_chistics:
/* empty */
| sp_c_chistics sp_c_chistic
;
sp_chistic:
COMMENT_SYM TEXT_STRING_sys
| LANGUAGE_SYM SQL_SYM
| NO_SYM SQL_SYM
| CONTAINS_SYM SQL_SYM
| READS_SYM SQL_SYM DATA_SYM
| MODIFIES_SYM SQL_SYM DATA_SYM
| sp_suid
;
sp_c_chistic:
sp_chistic
| DETERMINISTIC_SYM
| not DETERMINISTIC_SYM
;
sp_suid:
SQL_SYM SECURITY_SYM DEFINER_SYM
| SQL_SYM SECURITY_SYM INVOKER_SYM
;
call:
CALL_SYM sp_name opt_sp_cparam_list
;
opt_sp_cparam_list:
/* empty */
| '(' opt_sp_cparams ')'
;
opt_sp_cparams:
/* empty */
| sp_cparams
;
sp_cparams:
sp_cparams ',' expr
| expr
;
sp_fdparam_list:
/* empty */
| sp_fdparams
;
sp_fdparams:
sp_fdparams ',' sp_fdparam
| sp_fdparam
;
sp_init_param:
/* empty */
;
sp_fdparam:
ident sp_init_param type
;
sp_pdparam_list:
/* empty */
| sp_pdparams
;
sp_pdparams:
sp_pdparams ',' sp_pdparam
| sp_pdparam
;
sp_pdparam:
sp_opt_inout sp_init_param ident type
;
sp_opt_inout:
/* empty */
| IN_SYM
| OUT_SYM
| INOUT_SYM
;
sp_proc_stmts:
/* empty */
| sp_proc_stmts sp_proc_stmt ';'
;
sp_proc_stmts1:
sp_proc_stmt ';'
| sp_proc_stmts1 sp_proc_stmt ';'
;
sp_decls:
/* empty */
| sp_decls sp_decl ';'
;
sp_decl:
DECLARE_SYM sp_decl_idents type sp_opt_default
| DECLARE_SYM ident CONDITION_SYM FOR_SYM sp_cond
| DECLARE_SYM sp_handler_type HANDLER_SYM FOR_SYM sp_hcond_list sp_proc_stmt
| DECLARE_SYM ident CURSOR_SYM FOR_SYM sp_cursor_stmt
;
sp_cursor_stmt:
select
;
sp_handler_type:
EXIT_SYM
| CONTINUE_SYM
;
sp_hcond_list:
sp_hcond_element
| sp_hcond_list ',' sp_hcond_element
;
sp_hcond_element:
sp_hcond
;
sp_cond:
ulong_num
| SQLSTATE_SYM opt_value TEXT_STRING_literal
;
opt_value:
/* empty */
| VALUE_SYM
;
sp_hcond:
sp_cond
| ident
| SQLWARNING_SYM
| not FOUND_SYM
| SQLEXCEPTION_SYM
;
sp_decl_idents:
ident
| sp_decl_idents ',' ident
;
sp_opt_default:
/* empty */
| DEFAULT expr
;
sp_proc_stmt:
sp_proc_stmt_statement
| sp_proc_stmt_return
| sp_proc_stmt_if
| case_stmt_specification
| sp_labeled_control
| sp_proc_stmt_unlabeled
| sp_proc_stmt_leave
| sp_proc_stmt_iterate
| sp_proc_stmt_open
| sp_proc_stmt_fetch
| sp_proc_stmt_close
;
sp_proc_stmt_if:
IF sp_if END IF
;
sp_proc_stmt_statement:
statement
;
sp_proc_stmt_return:
RETURN_SYM expr
;
sp_proc_stmt_unlabeled:
sp_unlabeled_control
;
sp_proc_stmt_leave:
LEAVE_SYM label_ident
;
sp_proc_stmt_iterate:
ITERATE_SYM label_ident
;
sp_proc_stmt_open:
OPEN_SYM ident
;
sp_proc_stmt_fetch:
FETCH_SYM sp_opt_fetch_noise ident INTO sp_fetch_list
;
sp_proc_stmt_close:
CLOSE_SYM ident
;
sp_opt_fetch_noise:
/* empty */
| NEXT_SYM FROM
| FROM
;
sp_fetch_list:
ident
| sp_fetch_list ',' ident
;
sp_if:
expr THEN_SYM sp_proc_stmts1 sp_elseifs
;
sp_elseifs:
/* empty */
| ELSEIF_SYM sp_if
| ELSE sp_proc_stmts1
;
case_stmt_specification:
simple_case_stmt
| searched_case_stmt
;
simple_case_stmt:
CASE_SYM expr simple_when_clause_list else_clause_opt END CASE_SYM
;
searched_case_stmt:
CASE_SYM searched_when_clause_list else_clause_opt END CASE_SYM
;
simple_when_clause_list:
simple_when_clause
| simple_when_clause_list simple_when_clause
;
searched_when_clause_list:
searched_when_clause
| searched_when_clause_list searched_when_clause
;
simple_when_clause:
WHEN_SYM expr THEN_SYM sp_proc_stmts1
;
searched_when_clause:
WHEN_SYM expr THEN_SYM sp_proc_stmts1
;
else_clause_opt:
/* empty */
| ELSE sp_proc_stmts1
;
sp_labeled_control:
label_ident ':' sp_unlabeled_control sp_opt_label
;
sp_opt_label:
/* empty */
| label_ident
;
sp_unlabeled_control:
BEGIN_SYM sp_decls sp_proc_stmts END
| LOOP_SYM sp_proc_stmts1 END LOOP_SYM
| WHILE_SYM expr DO_SYM sp_proc_stmts1 END WHILE_SYM
| REPEAT_SYM sp_proc_stmts1 UNTIL_SYM expr END REPEAT_SYM
;
trg_action_time:
BEFORE_SYM
| AFTER_SYM
;
trg_event:
INSERT
| UPDATE_SYM
| DELETE_SYM
;
change_tablespace_access:
tablespace_name ts_access_mode
;
change_tablespace_info:
tablespace_name CHANGE ts_datafile change_ts_option_list
;
tablespace_info:
tablespace_name ADD ts_datafile opt_logfile_group_name tablespace_option_list
;
opt_logfile_group_name:
/* empty */
| USE_SYM LOGFILE_SYM GROUP_SYM ident
;
alter_tablespace_info:
tablespace_name ADD ts_datafile alter_tablespace_option_list
| tablespace_name DROP ts_datafile alter_tablespace_option_list
;
logfile_group_info:
logfile_group_name add_log_file logfile_group_option_list
;
alter_logfile_group_info:
logfile_group_name add_log_file alter_logfile_group_option_list
;
add_log_file:
ADD lg_undofile
| ADD lg_redofile
;
change_ts_option_list:
change_ts_options
;
change_ts_options:
change_ts_option
| change_ts_options change_ts_option
| change_ts_options ',' change_ts_option
;
change_ts_option:
opt_ts_initial_size
| opt_ts_autoextend_size
| opt_ts_max_size
;
tablespace_option_list:
tablespace_options
;
tablespace_options:
tablespace_option
| tablespace_options tablespace_option
| tablespace_options ',' tablespace_option
;
tablespace_option:
opt_ts_initial_size
| opt_ts_autoextend_size
| opt_ts_max_size
| opt_ts_extent_size
| opt_ts_nodegroup
| opt_ts_engine
| ts_wait
| opt_ts_comment
;
alter_tablespace_option_list:
alter_tablespace_options
;
alter_tablespace_options:
alter_tablespace_option
| alter_tablespace_options alter_tablespace_option
| alter_tablespace_options ',' alter_tablespace_option
;
alter_tablespace_option:
opt_ts_initial_size
| opt_ts_autoextend_size
| opt_ts_max_size
| opt_ts_engine
| ts_wait
;
logfile_group_option_list:
logfile_group_options
;
logfile_group_options:
logfile_group_option
| logfile_group_options logfile_group_option
| logfile_group_options ',' logfile_group_option
;
logfile_group_option:
opt_ts_initial_size
| opt_ts_undo_buffer_size
| opt_ts_redo_buffer_size
| opt_ts_nodegroup
| opt_ts_engine
| ts_wait
| opt_ts_comment
;
alter_logfile_group_option_list:
alter_logfile_group_options
;
alter_logfile_group_options:
alter_logfile_group_option
| alter_logfile_group_options alter_logfile_group_option
| alter_logfile_group_options ',' alter_logfile_group_option
;
alter_logfile_group_option:
opt_ts_initial_size
| opt_ts_engine
| ts_wait
;
ts_datafile:
DATAFILE_SYM TEXT_STRING_sys
;
lg_undofile:
UNDOFILE_SYM TEXT_STRING_sys
;
lg_redofile:
REDOFILE_SYM TEXT_STRING_sys
;
tablespace_name:
ident
;
logfile_group_name:
ident
;
ts_access_mode:
READ_ONLY_SYM
| READ_WRITE_SYM
| NOT_SYM ACCESSIBLE_SYM
;
opt_ts_initial_size:
INITIAL_SIZE_SYM opt_equal size_number
;
opt_ts_autoextend_size:
AUTOEXTEND_SIZE_SYM opt_equal size_number
;
opt_ts_max_size:
MAX_SIZE_SYM opt_equal size_number
;
opt_ts_extent_size:
EXTENT_SIZE_SYM opt_equal size_number
;
opt_ts_undo_buffer_size:
UNDO_BUFFER_SIZE_SYM opt_equal size_number
;
opt_ts_redo_buffer_size:
REDO_BUFFER_SIZE_SYM opt_equal size_number
;
opt_ts_nodegroup:
NODEGROUP_SYM opt_equal real_ulong_num
;
opt_ts_comment:
COMMENT_SYM opt_equal TEXT_STRING_sys
;
opt_ts_engine:
opt_storage ENGINE_SYM opt_equal storage_engines
;
opt_ts_wait:
/* empty */
| ts_wait
;
ts_wait:
WAIT_SYM
| NO_WAIT_SYM
;
size_number:
real_ulong_num
| IDENT
;
create2:
'(' create2a
| opt_create_table_options opt_partitioning create3
| LIKE table_ident
| '(' LIKE table_ident ')'
;
create2a:
field_list ')' opt_create_table_options opt_partitioning create3
| opt_partitioning create_select ')' union_opt
;
create3:
/* empty */
| opt_duplicate opt_as create_select union_clause
| opt_duplicate opt_as '(' create_select ')' union_opt
;
opt_partitioning:
/* empty */
| partitioning
;
partitioning:
PARTITION_SYM partition
;
partition_entry:
PARTITION_SYM partition
;
partition:
BY part_type_def opt_no_parts opt_sub_part part_defs
;
part_type_def:
opt_linear KEY_SYM '(' part_field_list ')'
| opt_linear HASH_SYM part_func
| RANGE_SYM part_func
| LIST_SYM part_func
;
opt_linear:
/* empty */
| LINEAR_SYM
;
part_field_list:
/* empty */
| part_field_item_list
;
part_field_item_list:
part_field_item
| part_field_item_list ',' part_field_item
;
part_field_item:
ident
;
part_func:
'(' remember_name part_func_expr remember_end ')'
;
sub_part_func:
'(' remember_name part_func_expr remember_end ')'
;
opt_no_parts:
/* empty */
| PARTITIONS_SYM real_ulong_num
;
opt_sub_part:
/* empty */
| SUBPARTITION_SYM BY opt_linear HASH_SYM sub_part_func opt_no_subparts
| SUBPARTITION_SYM BY opt_linear KEY_SYM '(' sub_part_field_list ')' opt_no_subparts
;
sub_part_field_list:
sub_part_field_item
| sub_part_field_list ',' sub_part_field_item
;
sub_part_field_item:
ident
;
part_func_expr:
bit_expr
;
opt_no_subparts:
/* empty */
| SUBPARTITIONS_SYM real_ulong_num
;
part_defs:
/* empty */
| '(' part_def_list ')'
;
part_def_list:
part_definition
| part_def_list ',' part_definition
;
part_definition:
PARTITION_SYM part_name opt_part_values opt_part_options opt_sub_partition
;
part_name:
ident
;
opt_part_values:
/* empty */
| VALUES LESS_SYM THAN_SYM part_func_max
| VALUES IN_SYM '(' part_list_func ')'
;
part_func_max:
max_value_sym
| part_range_func
;
max_value_sym:
MAX_VALUE_SYM
| '(' MAX_VALUE_SYM ')'
;
part_range_func:
'(' part_bit_expr ')'
;
part_list_func:
part_list_item
| part_list_func ',' part_list_item
;
part_list_item:
part_bit_expr
;
part_bit_expr:
bit_expr
;
opt_sub_partition:
/* empty */
| '(' sub_part_list ')'
;
sub_part_list:
sub_part_definition
| sub_part_list ',' sub_part_definition
;
sub_part_definition:
SUBPARTITION_SYM sub_name opt_part_options
;
sub_name:
ident_or_text
;
opt_part_options:
/* empty */
| opt_part_option_list
;
opt_part_option_list:
opt_part_option_list opt_part_option
| opt_part_option
;
opt_part_option:
TABLESPACE opt_equal ident_or_text
| opt_storage ENGINE_SYM opt_equal storage_engines
| NODEGROUP_SYM opt_equal real_ulong_num
| MAX_ROWS opt_equal real_ulonglong_num
| MIN_ROWS opt_equal real_ulonglong_num
| DATA_SYM DIRECTORY_SYM opt_equal TEXT_STRING_sys
| INDEX_SYM DIRECTORY_SYM opt_equal TEXT_STRING_sys
| COMMENT_SYM opt_equal TEXT_STRING_sys
;
create_select:
SELECT_SYM select_options select_item_list opt_select_from
;
opt_as:
/* empty */
| AS
;
opt_create_database_options:
/* empty */
| create_database_options
;
create_database_options:
create_database_option
| create_database_options create_database_option
;
create_database_option:
default_collation
| default_charset
;
opt_table_options:
/* empty */
| table_options
;
table_options:
table_option
| table_option table_options
;
table_option:
TEMPORARY
;
opt_if_not_exists:
/* empty */
| IF not EXISTS
;
opt_create_table_options:
/* empty */
| create_table_options
;
create_table_options_space_separated:
create_table_option
| create_table_option create_table_options_space_separated
;
create_table_options:
create_table_option
| create_table_option create_table_options
| create_table_option ',' create_table_options
;
create_table_option:
ENGINE_SYM opt_equal storage_engines
| TYPE_SYM opt_equal storage_engines
| MAX_ROWS opt_equal ulonglong_num
| MIN_ROWS opt_equal ulonglong_num
| AVG_ROW_LENGTH opt_equal ulong_num
| PASSWORD opt_equal TEXT_STRING_sys
| COMMENT_SYM opt_equal TEXT_STRING_sys
| AUTO_INC opt_equal ulonglong_num
| PACK_KEYS_SYM opt_equal ulong_num
| PACK_KEYS_SYM opt_equal DEFAULT
| CHECKSUM_SYM opt_equal ulong_num
| DELAY_KEY_WRITE_SYM opt_equal ulong_num
| ROW_FORMAT_SYM opt_equal row_types
| UNION_SYM opt_equal '(' table_list ')'
| default_charset
| default_collation
| INSERT_METHOD opt_equal merge_insert_types
| DATA_SYM DIRECTORY_SYM opt_equal TEXT_STRING_sys
| INDEX_SYM DIRECTORY_SYM opt_equal TEXT_STRING_sys
| TABLESPACE ident
| STORAGE_SYM DISK_SYM
| STORAGE_SYM MEMORY_SYM
| CONNECTION_SYM opt_equal TEXT_STRING_sys
| KEY_BLOCK_SIZE opt_equal ulong_num
| TRANSACTIONAL_SYM opt_equal ulong_num
;
default_charset:
opt_default charset opt_equal charset_name_or_default
;
default_collation:
opt_default COLLATE_SYM opt_equal collation_name_or_default
;
storage_engines:
ident_or_text
;
known_storage_engines:
ident_or_text
;
row_types:
DEFAULT
| FIXED_SYM
| DYNAMIC_SYM
| COMPRESSED_SYM
| REDUNDANT_SYM
| COMPACT_SYM
| PAGE_SYM
;
merge_insert_types:
NO_SYM
| FIRST_SYM
| LAST_SYM
;
opt_select_from:
opt_limit_clause
| select_from select_lock_type
;
udf_type:
STRING_SYM
| REAL
| DECIMAL_SYM
| INT_SYM
;
field_list:
field_list_item
| field_list ',' field_list_item
;
field_list_item:
column_def
| key_def
;
column_def:
field_spec opt_check_constraint
| field_spec references
;
key_def:
key_type opt_ident key_alg '(' key_list ')' key_options
| opt_constraint constraint_key_type opt_ident key_alg '(' key_list ')' key_options
| opt_constraint FOREIGN KEY_SYM opt_ident '(' key_list ')' references
| constraint opt_check_constraint
| opt_constraint check_constraint
;
opt_check_constraint:
/* empty */
| check_constraint
;
check_constraint:
CHECK_SYM expr
;
opt_constraint:
/* empty */
| constraint
;
constraint:
CONSTRAINT opt_ident
;
field_spec:
field_ident type opt_attribute
;
type:
int_type opt_len field_options
| real_type opt_precision field_options
| FLOAT_SYM float_options field_options
| BIT_SYM
| BIT_SYM '(' NUM ')'
| BOOL_SYM
| BOOLEAN_SYM
| char '(' NUM ')' opt_binary
| char opt_binary
| nchar '(' NUM ')' opt_bin_mod
| nchar opt_bin_mod
| BINARY '(' NUM ')'
| BINARY
| varchar '(' NUM ')' opt_binary
| nvarchar '(' NUM ')' opt_bin_mod
| VARBINARY '(' NUM ')'
| YEAR_SYM opt_len field_options
| DATE_SYM
| TIME_SYM
| TIMESTAMP opt_len
| DATETIME
| TINYBLOB
| BLOB_SYM opt_len
| spatial_type
| MEDIUMBLOB
| LONGBLOB
| LONG_SYM VARBINARY
| LONG_SYM varchar opt_binary
| TINYTEXT opt_binary
| TEXT_SYM opt_len opt_binary
| MEDIUMTEXT opt_binary
| LONGTEXT opt_binary
| DECIMAL_SYM float_options field_options
| NUMERIC_SYM float_options field_options
| FIXED_SYM float_options field_options
| ENUM '(' string_list ')' opt_binary
| SET '(' string_list ')' opt_binary
| LONG_SYM opt_binary
| SERIAL_SYM
;
spatial_type:
GEOMETRY_SYM
| GEOMETRYCOLLECTION
| POINT_SYM
| MULTIPOINT
| LINESTRING
| MULTILINESTRING
| POLYGON
| MULTIPOLYGON
;
char:
CHAR_SYM
;
nchar:
NCHAR_SYM
| NATIONAL_SYM CHAR_SYM
;
varchar:
char VARYING
| VARCHAR
;
nvarchar:
NATIONAL_SYM VARCHAR
| NVARCHAR_SYM
| NCHAR_SYM VARCHAR
| NATIONAL_SYM CHAR_SYM VARYING
| NCHAR_SYM VARYING
;
int_type:
INT_SYM
| TINYINT
| SMALLINT
| MEDIUMINT
| BIGINT
;
real_type:
REAL
| DOUBLE_SYM
| DOUBLE_SYM PRECISION
;
float_options:
/* empty */
| '(' NUM ')'
| precision
;
precision:
'(' NUM ',' NUM ')'
;
field_options:
/* empty */
| field_opt_list
;
field_opt_list:
field_opt_list field_option
| field_option
;
field_option:
SIGNED_SYM
| UNSIGNED
| ZEROFILL
;
opt_len:
/* empty */
| '(' NUM ')'
;
opt_precision:
/* empty */
| precision
;
opt_attribute:
/* empty */
| opt_attribute_list
;
opt_attribute_list:
opt_attribute_list attribute
| attribute
;
attribute:
NULL_SYM
| not NULL_SYM
| DEFAULT now_or_signed_literal
| ON UPDATE_SYM NOW_SYM optional_braces
| AUTO_INC
| SERIAL_SYM DEFAULT VALUE_SYM
| opt_primary KEY_SYM
| UNIQUE_SYM
| UNIQUE_SYM KEY_SYM
| COMMENT_SYM TEXT_STRING_sys
| COLLATE_SYM collation_name
;
now_or_signed_literal:
NOW_SYM optional_braces
| signed_literal
;
charset:
CHAR_SYM SET
| CHARSET
;
charset_name:
ident_or_text
| BINARY
;
charset_name_or_default:
charset_name
| DEFAULT
;
opt_load_data_charset:
/* empty */
| charset charset_name_or_default
;
old_or_new_charset_name:
ident_or_text
| BINARY
;
old_or_new_charset_name_or_default:
old_or_new_charset_name
| DEFAULT
;
collation_name:
ident_or_text
;
opt_collate:
/* empty */
| COLLATE_SYM collation_name_or_default
;
collation_name_or_default:
collation_name
| DEFAULT
;
opt_default:
/* empty */
| DEFAULT
;
opt_binary:
/* empty */
| ASCII_SYM opt_bin_mod
| BYTE_SYM
| UNICODE_SYM opt_bin_mod
| charset charset_name opt_bin_mod
| BINARY opt_bin_charset
;
opt_bin_mod:
/* empty */
| BINARY
;
opt_bin_charset:
/* empty */
| ASCII_SYM
| UNICODE_SYM
| charset charset_name
;
opt_primary:
/* empty */
| PRIMARY_SYM
;
references:
REFERENCES table_ident opt_ref_list
;
opt_ref_list:
opt_on_delete
| '(' ref_list ')' opt_on_delete
;
ref_list:
ref_list ',' ident
| ident
;
opt_on_delete:
/* empty */
| opt_on_delete_list
;
opt_on_delete_list:
opt_on_delete_list opt_on_delete_item
| opt_on_delete_item
;
opt_on_delete_item:
ON DELETE_SYM delete_option
| ON UPDATE_SYM delete_option
| MATCH FULL
| MATCH PARTIAL
| MATCH SIMPLE_SYM
;
delete_option:
RESTRICT
| CASCADE
| SET NULL_SYM
| NO_SYM ACTION
| SET DEFAULT
;
key_type:
key_or_index
| FULLTEXT_SYM opt_key_or_index
| SPATIAL_SYM opt_key_or_index
;
constraint_key_type:
PRIMARY_SYM KEY_SYM
| UNIQUE_SYM opt_key_or_index
;
key_or_index:
KEY_SYM
| INDEX_SYM
;
opt_key_or_index:
/* empty */
| key_or_index
;
keys_or_index:
KEYS
| INDEX_SYM
| INDEXES
;
opt_unique_or_fulltext:
/* empty */
| UNIQUE_SYM
| FULLTEXT_SYM
| SPATIAL_SYM
;
init_key_options:
/* empty */
;
key_alg:
init_key_options
| init_key_options key_using_alg
;
key_options:
/* empty */
| key_opts
;
key_opts:
key_opt
| key_opts key_opt
;
key_using_alg:
USING btree_or_rtree
| TYPE_SYM btree_or_rtree
;
key_opt:
key_using_alg
| KEY_BLOCK_SIZE opt_equal ulong_num
| WITH PARSER_SYM IDENT_sys
;
btree_or_rtree:
BTREE_SYM
| RTREE_SYM
| HASH_SYM
;
key_list:
key_list ',' key_part order_dir
| key_part order_dir
;
key_part:
ident
| ident '(' NUM ')'
;
opt_ident:
/* empty */
| field_ident
;
opt_component:
/* empty */
| '.' ident
;
string_list:
text_string
| string_list ',' text_string
;
alter:
ALTER opt_ignore TABLE_SYM table_ident alter_commands
| ALTER DATABASE ident_or_empty create_database_options
| ALTER DATABASE ident UPGRADE_SYM DATA_SYM DIRECTORY_SYM NAME_SYM
| ALTER PROCEDURE sp_name sp_a_chistics
| ALTER FUNCTION_SYM sp_name sp_a_chistics
| ALTER view_algorithm definer_opt view_tail
| ALTER definer_opt view_tail
| ALTER definer_opt EVENT_SYM sp_name ev_alter_on_schedule_completion opt_ev_rename_to opt_ev_status opt_ev_comment opt_ev_sql_stmt
| ALTER TABLESPACE alter_tablespace_info
| ALTER LOGFILE_SYM GROUP_SYM alter_logfile_group_info
| ALTER TABLESPACE change_tablespace_info
| ALTER TABLESPACE change_tablespace_access
| ALTER SERVER_SYM ident_or_text OPTIONS_SYM '(' server_options_list ')'
;
ev_alter_on_schedule_completion:
/* empty */
| ON SCHEDULE_SYM ev_schedule_time
| ev_on_completion
| ON SCHEDULE_SYM ev_schedule_time ev_on_completion
;
opt_ev_rename_to:
/* empty */
| RENAME TO_SYM sp_name
;
opt_ev_sql_stmt:
/* empty */
| DO_SYM ev_sql_stmt
;
ident_or_empty:
/* empty */
| ident
;
alter_commands:
/* empty */
| DISCARD TABLESPACE
| IMPORT TABLESPACE
| alter_list opt_partitioning
| alter_list remove_partitioning
| remove_partitioning
| partitioning
| add_partition_rule
| DROP PARTITION_SYM alt_part_name_list
| REBUILD_SYM PARTITION_SYM opt_no_write_to_binlog all_or_alt_part_name_list
| OPTIMIZE PARTITION_SYM opt_no_write_to_binlog all_or_alt_part_name_list opt_no_write_to_binlog
| ANALYZE_SYM PARTITION_SYM opt_no_write_to_binlog all_or_alt_part_name_list
| CHECK_SYM PARTITION_SYM all_or_alt_part_name_list opt_mi_check_type
| REPAIR PARTITION_SYM opt_no_write_to_binlog all_or_alt_part_name_list opt_mi_repair_type
| COALESCE PARTITION_SYM opt_no_write_to_binlog real_ulong_num
| reorg_partition_rule
;
remove_partitioning:
REMOVE_SYM PARTITIONING_SYM
;
all_or_alt_part_name_list:
ALL
| alt_part_name_list
;
add_partition_rule:
ADD PARTITION_SYM opt_no_write_to_binlog add_part_extra
;
add_part_extra:
/* empty */
| '(' part_def_list ')'
| PARTITIONS_SYM real_ulong_num
;
reorg_partition_rule:
REORGANIZE_SYM PARTITION_SYM opt_no_write_to_binlog reorg_parts_rule
;
reorg_parts_rule:
/* empty */
| alt_part_name_list INTO '(' part_def_list ')'
;
alt_part_name_list:
alt_part_name_item
| alt_part_name_list ',' alt_part_name_item
;
alt_part_name_item:
ident
;
alter_list:
alter_list_item
| alter_list ',' alter_list_item
;
add_column:
ADD opt_column
;
alter_list_item:
add_column column_def opt_place
| ADD key_def
| add_column '(' field_list ')'
| CHANGE opt_column field_ident field_spec opt_place
| MODIFY_SYM opt_column field_ident type opt_attribute opt_place
| DROP opt_column field_ident opt_restrict
| DROP FOREIGN KEY_SYM opt_ident
| DROP PRIMARY_SYM KEY_SYM
| DROP key_or_index field_ident
| DISABLE_SYM KEYS
| ENABLE_SYM KEYS
| ALTER opt_column field_ident SET DEFAULT signed_literal
| ALTER opt_column field_ident DROP DEFAULT
| RENAME opt_to table_ident
| CONVERT_SYM TO_SYM charset charset_name_or_default opt_collate
| create_table_options_space_separated
| FORCE_SYM
| alter_order_clause
;
opt_column:
/* empty */
| COLUMN_SYM
;
opt_ignore:
/* empty */
| IGNORE_SYM
;
opt_restrict:
/* empty */
| RESTRICT
| CASCADE
;
opt_place:
/* empty */
| AFTER_SYM ident
| FIRST_SYM
;
opt_to:
/* empty */
| TO_SYM
| EQ
| AS
;
slave:
START_SYM SLAVE slave_thread_opts slave_until
| STOP_SYM SLAVE slave_thread_opts
| SLAVE START_SYM slave_thread_opts slave_until
| SLAVE STOP_SYM slave_thread_opts
;
start:
START_SYM TRANSACTION_SYM start_transaction_opts
;
start_transaction_opts:
/* empty */
| WITH CONSISTENT_SYM SNAPSHOT_SYM
;
slave_thread_opts:
slave_thread_opt_list
;
slave_thread_opt_list:
slave_thread_opt
| slave_thread_opt_list ',' slave_thread_opt
;
slave_thread_opt:
/* empty */
| SQL_THREAD
| RELAY_THREAD
;
slave_until:
/* empty */
| UNTIL_SYM slave_until_opts
;
slave_until_opts:
master_file_def
| slave_until_opts ',' master_file_def
;
restore:
RESTORE_SYM table_or_tables table_list FROM TEXT_STRING_sys
;
backup:
BACKUP_SYM table_or_tables table_list TO_SYM TEXT_STRING_sys
;
checksum:
CHECKSUM_SYM table_or_tables table_list opt_checksum_type
;
opt_checksum_type:
/* empty */
| QUICK
| EXTENDED_SYM
;
repair:
REPAIR opt_no_write_to_binlog table_or_tables table_list opt_mi_repair_type
;
opt_mi_repair_type:
/* empty */
| mi_repair_types
;
mi_repair_types:
mi_repair_type
| mi_repair_type mi_repair_types
;
mi_repair_type:
QUICK
| EXTENDED_SYM
| USE_FRM
;
analyze:
ANALYZE_SYM opt_no_write_to_binlog table_or_tables table_list
;
binlog_base64_event:
BINLOG_SYM TEXT_STRING_sys
;
check:
CHECK_SYM table_or_tables table_list opt_mi_check_type
;
opt_mi_check_type:
/* empty */
| mi_check_types
;
mi_check_types:
mi_check_type
| mi_check_type mi_check_types
;
mi_check_type:
QUICK
| FAST_SYM
| MEDIUM_SYM
| EXTENDED_SYM
| CHANGED
| FOR_SYM UPGRADE_SYM
;
optimize:
OPTIMIZE opt_no_write_to_binlog table_or_tables table_list
;
opt_no_write_to_binlog:
/* empty */
| NO_WRITE_TO_BINLOG
| LOCAL_SYM
;
rename:
RENAME table_or_tables table_to_table_list
| RENAME USER clear_privileges rename_list
;
rename_list:
user TO_SYM user
| rename_list ',' user TO_SYM user
;
table_to_table_list:
table_to_table
| table_to_table_list ',' table_to_table
;
table_to_table:
table_ident TO_SYM table_ident
;
keycache:
CACHE_SYM INDEX_SYM keycache_list IN_SYM key_cache_name
;
keycache_list:
assign_to_keycache
| keycache_list ',' assign_to_keycache
;
assign_to_keycache:
table_ident cache_keys_spec
;
key_cache_name:
ident
| DEFAULT
;
preload:
LOAD INDEX_SYM INTO CACHE_SYM preload_list
;
preload_list:
preload_keys
| preload_list ',' preload_keys
;
preload_keys:
table_ident cache_keys_spec opt_ignore_leaves
;
cache_keys_spec:
cache_key_list_or_empty
;
cache_key_list_or_empty:
/* empty */
| key_or_index '(' opt_key_usage_list ')'
;
opt_ignore_leaves:
/* empty */
| IGNORE_SYM LEAVES
;
select:
select_init
;
select_init:
SELECT_SYM select_init2
| '(' select_paren ')' union_opt
;
select_paren:
SELECT_SYM select_part2
| '(' select_paren ')'
;
select_init2:
select_part2 union_clause
;
select_part2:
select_options select_item_list select_into select_lock_type
;
select_into:
opt_order_clause opt_limit_clause
| into
| select_from
| into select_from
| select_from into
;
select_from:
FROM join_table_list where_clause group_clause having_clause opt_order_clause opt_limit_clause procedure_clause
| FROM DUAL_SYM where_clause opt_limit_clause
;
select_options:
/* empty */
| select_option_list
;
select_option_list:
select_option_list select_option
| select_option
;
select_option:
STRAIGHT_JOIN
| HIGH_PRIORITY
| DISTINCT
| SQL_SMALL_RESULT
| SQL_BIG_RESULT
| SQL_BUFFER_RESULT
| SQL_CALC_FOUND_ROWS
| SQL_NO_CACHE_SYM
| SQL_CACHE_SYM
| ALL
;
select_lock_type:
/* empty */
| FOR_SYM UPDATE_SYM
| LOCK_SYM IN_SYM SHARE_SYM MODE_SYM
;
select_item_list:
select_item_list ',' select_item
| select_item
| '*'
;
select_item:
remember_name select_item2 remember_end select_alias
;
remember_name:
/* empty */
;
remember_end:
/* empty */
;
select_item2:
table_wild
| expr
;
select_alias:
/* empty */
| AS ident
| AS TEXT_STRING_sys
| ident
| TEXT_STRING_sys
;
optional_braces:
/* empty */
| '(' ')'
;
expr:
expr or expr %prec OR_SYM
| expr XOR expr %prec XOR
| expr and expr %prec AND_SYM
| NOT_SYM expr %prec NOT_SYM
| bool_pri IS TRUE_SYM %prec IS
| bool_pri IS not TRUE_SYM %prec IS
| bool_pri IS FALSE_SYM %prec IS
| bool_pri IS not FALSE_SYM %prec IS
| bool_pri IS UNKNOWN_SYM %prec IS
| bool_pri IS not UNKNOWN_SYM %prec IS
| bool_pri
;
bool_pri:
bool_pri IS NULL_SYM %prec IS
| bool_pri IS not NULL_SYM %prec IS
| bool_pri EQUAL_SYM predicate %prec EQUAL_SYM
| bool_pri comp_op predicate %prec EQ
| bool_pri comp_op all_or_any '(' subselect ')' %prec EQ
| predicate
;
predicate:
bit_expr IN_SYM '(' subselect ')'
| bit_expr not IN_SYM '(' subselect ')'
| bit_expr IN_SYM '(' expr ')'
| bit_expr IN_SYM '(' expr ',' expr_list ')'
| bit_expr not IN_SYM '(' expr ')'
| bit_expr not IN_SYM '(' expr ',' expr_list ')'
| bit_expr BETWEEN_SYM bit_expr AND_SYM predicate
| bit_expr not BETWEEN_SYM bit_expr AND_SYM predicate
| bit_expr SOUNDS_SYM LIKE bit_expr
| bit_expr LIKE simple_expr opt_escape
| bit_expr not LIKE simple_expr opt_escape
| bit_expr REGEXP bit_expr
| bit_expr not REGEXP bit_expr
| bit_expr
;
bit_expr:
bit_expr '|' bit_expr %prec '|'
| bit_expr '&' bit_expr %prec '&'
| bit_expr SHIFT_LEFT bit_expr %prec SHIFT_LEFT
| bit_expr SHIFT_RIGHT bit_expr %prec SHIFT_RIGHT
| bit_expr '+' bit_expr %prec '+'
| bit_expr '-' bit_expr %prec '-'
| bit_expr '+' INTERVAL_SYM expr interval %prec '+'
| bit_expr '-' INTERVAL_SYM expr interval %prec '-'
| bit_expr '*' bit_expr %prec '*'
| bit_expr '/' bit_expr %prec '/'
| bit_expr '%' bit_expr %prec '%'
| bit_expr DIV_SYM bit_expr %prec DIV_SYM
| bit_expr MOD_SYM bit_expr %prec MOD_SYM
| bit_expr '^' bit_expr
| simple_expr
;
or:
OR_SYM
| OR2_SYM
;
and:
AND_SYM
| AND_AND_SYM
;
not:
NOT_SYM
| NOT2_SYM
;
not2:
'!'
| NOT2_SYM
;
comp_op:
EQ
| GE
| GT_SYM
| LE
| LT
| NE
;
all_or_any:
ALL
| ANY_SYM
;
simple_expr:
simple_ident
| function_call_keyword
| function_call_nonkeyword
| function_call_generic
| function_call_conflict
| simple_expr COLLATE_SYM ident_or_text %prec NEG
| literal
| param_marker
| variable
| sum_expr
| simple_expr OR_OR_SYM simple_expr
| '+' simple_expr %prec NEG
| '-' simple_expr %prec NEG
| '~' simple_expr %prec NEG
| not2 simple_expr %prec NEG
| '(' subselect ')'
| '(' expr ')'
| '(' expr ',' expr_list ')'
| ROW_SYM '(' expr ',' expr_list ')'
| EXISTS '(' subselect ')'
| '{' ident expr '}'
| MATCH ident_list_arg AGAINST '(' bit_expr fulltext_options ')'
| BINARY simple_expr %prec NEG
| CAST_SYM '(' expr AS cast_type ')'
| CASE_SYM opt_expr when_list opt_else END
| CONVERT_SYM '(' expr ',' cast_type ')'
| CONVERT_SYM '(' expr USING charset_name ')'
| DEFAULT '(' simple_ident ')'
| VALUES '(' simple_ident_nospvar ')'
| INTERVAL_SYM expr interval '+' expr %prec INTERVAL_SYM
;
function_call_keyword:
CHAR_SYM '(' expr_list ')'
| CHAR_SYM '(' expr_list USING charset_name ')'
| CURRENT_USER optional_braces
| DATE_SYM '(' expr ')'
| DAY_SYM '(' expr ')'
| HOUR_SYM '(' expr ')'
| INSERT '(' expr ',' expr ',' expr ',' expr ')'
| INTERVAL_SYM '(' expr ',' expr ')' %prec INTERVAL_SYM
| INTERVAL_SYM '(' expr ',' expr ',' expr_list ')' %prec INTERVAL_SYM
| LEFT '(' expr ',' expr ')'
| MINUTE_SYM '(' expr ')'
| MONTH_SYM '(' expr ')'
| RIGHT '(' expr ',' expr ')'
| SECOND_SYM '(' expr ')'
| TIME_SYM '(' expr ')'
| TIMESTAMP '(' expr ')'
| TIMESTAMP '(' expr ',' expr ')'
| TRIM '(' expr ')'
| TRIM '(' LEADING expr FROM expr ')'
| TRIM '(' TRAILING expr FROM expr ')'
| TRIM '(' BOTH expr FROM expr ')'
| TRIM '(' LEADING FROM expr ')'
| TRIM '(' TRAILING FROM expr ')'
| TRIM '(' BOTH FROM expr ')'
| TRIM '(' expr FROM expr ')'
| USER '(' ')'
| YEAR_SYM '(' expr ')'
;
function_call_nonkeyword:
ADDDATE_SYM '(' expr ',' expr ')'
| ADDDATE_SYM '(' expr ',' INTERVAL_SYM expr interval ')'
| CURDATE optional_braces
| CURTIME optional_braces
| CURTIME '(' expr ')'
| DATE_ADD_INTERVAL '(' expr ',' INTERVAL_SYM expr interval ')' %prec INTERVAL_SYM
| DATE_SUB_INTERVAL '(' expr ',' INTERVAL_SYM expr interval ')' %prec INTERVAL_SYM
| EXTRACT_SYM '(' interval FROM expr ')'
| GET_FORMAT '(' date_time_type ',' expr ')'
| NOW_SYM optional_braces
| NOW_SYM '(' expr ')'
| POSITION_SYM '(' bit_expr IN_SYM expr ')'
| SUBDATE_SYM '(' expr ',' expr ')'
| SUBDATE_SYM '(' expr ',' INTERVAL_SYM expr interval ')'
| SUBSTRING '(' expr ',' expr ',' expr ')'
| SUBSTRING '(' expr ',' expr ')'
| SUBSTRING '(' expr FROM expr FOR_SYM expr ')'
| SUBSTRING '(' expr FROM expr ')'
| SYSDATE optional_braces
| SYSDATE '(' expr ')'
| TIMESTAMP_ADD '(' interval_time_st ',' expr ',' expr ')'
| TIMESTAMP_DIFF '(' interval_time_st ',' expr ',' expr ')'
| UTC_DATE_SYM optional_braces
| UTC_TIME_SYM optional_braces
| UTC_TIMESTAMP_SYM optional_braces
;
function_call_conflict:
ASCII_SYM '(' expr ')'
| CHARSET '(' expr ')'
| COALESCE '(' expr_list ')'
| COLLATION_SYM '(' expr ')'
| DATABASE '(' ')'
| IF '(' expr ',' expr ',' expr ')'
| MICROSECOND_SYM '(' expr ')'
| MOD_SYM '(' expr ',' expr ')'
| OLD_PASSWORD '(' expr ')'
| PASSWORD '(' expr ')'
| QUARTER_SYM '(' expr ')'
| REPEAT_SYM '(' expr ',' expr ')'
| REPLACE '(' expr ',' expr ',' expr ')'
| TRUNCATE_SYM '(' expr ',' expr ')'
| WEEK_SYM '(' expr ')'
| WEEK_SYM '(' expr ',' expr ')'
| geometry_function
;
geometry_function:
CONTAINS_SYM '(' expr ',' expr ')'
| GEOMETRYCOLLECTION '(' expr_list ')'
| LINESTRING '(' expr_list ')'
| MULTILINESTRING '(' expr_list ')'
| MULTIPOINT '(' expr_list ')'
| MULTIPOLYGON '(' expr_list ')'
| POINT_SYM '(' expr ',' expr ')'
| POLYGON '(' expr_list ')'
;
function_call_generic:
IDENT_sys '(' opt_udf_expr_list ')'
| ident '.' ident '(' opt_expr_list ')'
;
fulltext_options:
opt_natural_language_mode opt_query_expansion
| IN_SYM BOOLEAN_SYM MODE_SYM
;
opt_natural_language_mode:
/* empty */
| IN_SYM NATURAL LANGUAGE_SYM MODE_SYM
;
opt_query_expansion:
/* empty */
| WITH QUERY_SYM EXPANSION_SYM
;
opt_udf_expr_list:
/* empty */
| udf_expr_list
;
udf_expr_list:
udf_expr
| udf_expr_list ',' udf_expr
;
udf_expr:
remember_name expr remember_end select_alias
;
sum_expr:
AVG_SYM '(' in_sum_expr ')'
| AVG_SYM '(' DISTINCT in_sum_expr ')'
| BIT_AND '(' in_sum_expr ')'
| BIT_OR '(' in_sum_expr ')'
| BIT_XOR '(' in_sum_expr ')'
| COUNT_SYM '(' opt_all '*' ')'
| COUNT_SYM '(' in_sum_expr ')'
| COUNT_SYM '(' DISTINCT expr_list ')'
| MIN_SYM '(' in_sum_expr ')'
| MIN_SYM '(' DISTINCT in_sum_expr ')'
| MAX_SYM '(' in_sum_expr ')'
| MAX_SYM '(' DISTINCT in_sum_expr ')'
| STD_SYM '(' in_sum_expr ')'
| VARIANCE_SYM '(' in_sum_expr ')'
| STDDEV_SAMP_SYM '(' in_sum_expr ')'
| VAR_SAMP_SYM '(' in_sum_expr ')'
| SUM_SYM '(' in_sum_expr ')'
| SUM_SYM '(' DISTINCT in_sum_expr ')'
| GROUP_CONCAT_SYM '(' opt_distinct expr_list opt_gorder_clause opt_gconcat_separator ')'
;
variable:
'@' variable_aux
;
variable_aux:
ident_or_text SET_VAR expr
| ident_or_text
| '@' opt_var_ident_type ident_or_text opt_component
;
opt_distinct:
/* empty */
| DISTINCT
;
opt_gconcat_separator:
/* empty */
| SEPARATOR_SYM text_string
;
opt_gorder_clause:
/* empty */
| order_clause
;
in_sum_expr:
opt_all expr
;
cast_type:
BINARY opt_len
| CHAR_SYM opt_len opt_binary
| NCHAR_SYM opt_len
| SIGNED_SYM
| SIGNED_SYM INT_SYM
| UNSIGNED
| UNSIGNED INT_SYM
| DATE_SYM
| TIME_SYM
| DATETIME
| DECIMAL_SYM float_options
;
opt_expr_list:
/* empty */
| expr_list
;
expr_list:
expr
| expr_list ',' expr
;
ident_list_arg:
ident_list
| '(' ident_list ')'
;
ident_list:
simple_ident
| ident_list ',' simple_ident
;
opt_expr:
/* empty */
| expr
;
opt_else:
/* empty */
| ELSE expr
;
when_list:
WHEN_SYM expr THEN_SYM expr
| when_list WHEN_SYM expr THEN_SYM expr
;
table_ref:
table_factor
| join_table
;
join_table_list:
derived_table_list
;
derived_table_list:
table_ref
| derived_table_list ',' table_ref
;
join_table:
table_ref normal_join table_ref %prec TABLE_REF_PRIORITY
| table_ref STRAIGHT_JOIN table_factor
| table_ref normal_join table_ref ON expr
| table_ref STRAIGHT_JOIN table_factor ON expr
| table_ref normal_join table_ref USING '(' using_list ')'
| table_ref NATURAL JOIN_SYM table_factor
| table_ref LEFT opt_outer JOIN_SYM table_ref ON expr
| table_ref LEFT opt_outer JOIN_SYM table_factor USING '(' using_list ')'
| table_ref NATURAL LEFT opt_outer JOIN_SYM table_factor
| table_ref RIGHT opt_outer JOIN_SYM table_ref ON expr
| table_ref RIGHT opt_outer JOIN_SYM table_factor USING '(' using_list ')'
| table_ref NATURAL RIGHT opt_outer JOIN_SYM table_factor
;
normal_join:
JOIN_SYM
| INNER_SYM JOIN_SYM
| CROSS JOIN_SYM
;
table_factor:
table_ident opt_table_alias opt_key_definition
| '{' ident table_ref LEFT OUTER JOIN_SYM table_ref ON expr '}'
| select_derived_init get_select_lex select_derived2
| '(' get_select_lex select_derived union_opt ')' opt_table_alias
;
select_derived:
get_select_lex derived_table_list
;
select_derived2:
select_options select_item_list opt_select_from
;
get_select_lex:
/* empty */
;
select_derived_init:
SELECT_SYM
;
opt_outer:
/* empty */
| OUTER
;
index_hint_clause:
/* empty */
| FOR_SYM JOIN_SYM
| FOR_SYM ORDER_SYM BY
| FOR_SYM GROUP_SYM BY
;
index_hint_type:
FORCE_SYM
| IGNORE_SYM
;
index_hint_definition:
index_hint_type key_or_index index_hint_clause '(' key_usage_list ')'
| USE_SYM key_or_index index_hint_clause '(' opt_key_usage_list ')'
;
index_hints_list:
index_hint_definition
| index_hints_list index_hint_definition
;
opt_index_hints_list:
/* empty */
| index_hints_list
;
opt_key_definition:
opt_index_hints_list
;
opt_key_usage_list:
/* empty */
| key_usage_list
;
key_usage_element:
ident
| PRIMARY_SYM
;
key_usage_list:
key_usage_element
| key_usage_list ',' key_usage_element
;
using_list:
ident
| using_list ',' ident
;
interval:
interval_time_st
| DAY_HOUR_SYM
| DAY_MICROSECOND_SYM
| DAY_MINUTE_SYM
| DAY_SECOND_SYM
| HOUR_MICROSECOND_SYM
| HOUR_MINUTE_SYM
| HOUR_SECOND_SYM
| MICROSECOND_SYM
| MINUTE_MICROSECOND_SYM
| MINUTE_SECOND_SYM
| SECOND_MICROSECOND_SYM
| YEAR_MONTH_SYM
;
interval_time_st:
DAY_SYM
| WEEK_SYM
| HOUR_SYM
| FRAC_SECOND_SYM
| MINUTE_SYM
| MONTH_SYM
| QUARTER_SYM
| SECOND_SYM
| YEAR_SYM
;
date_time_type:
DATE_SYM
| TIME_SYM
| DATETIME
| TIMESTAMP
;
table_alias:
/* empty */
| AS
| EQ
;
opt_table_alias:
/* empty */
| table_alias ident
;
opt_all:
/* empty */
| ALL
;
where_clause:
/* empty */
| WHERE expr
;
having_clause:
/* empty */
| HAVING expr
;
opt_escape:
ESCAPE_SYM simple_expr
| /* empty */
;
group_clause:
/* empty */
| GROUP_SYM BY group_list olap_opt
;
group_list:
group_list ',' order_ident order_dir
| order_ident order_dir
;
olap_opt:
/* empty */
| WITH CUBE_SYM
| WITH ROLLUP_SYM
;
alter_order_clause:
ORDER_SYM BY alter_order_list
;
alter_order_list:
alter_order_list ',' alter_order_item
| alter_order_item
;
alter_order_item:
simple_ident_nospvar order_dir
;
opt_order_clause:
/* empty */
| order_clause
;
order_clause:
ORDER_SYM BY order_list
;
order_list:
order_list ',' order_ident order_dir
| order_ident order_dir
;
order_dir:
/* empty */
| ASC
| DESC
;
opt_limit_clause_init:
/* empty */
| limit_clause
;
opt_limit_clause:
/* empty */
| limit_clause
;
limit_clause:
LIMIT limit_options
;
limit_options:
limit_option
| limit_option ',' limit_option
| limit_option OFFSET_SYM limit_option
;
limit_option:
param_marker
| ULONGLONG_NUM
| LONG_NUM
| NUM
;
delete_limit_clause:
/* empty */
| LIMIT limit_option
;
ulong_num:
NUM
| HEX_NUM
| LONG_NUM
| ULONGLONG_NUM
| DECIMAL_NUM
| FLOAT_NUM
;
real_ulong_num:
NUM
| HEX_NUM
| LONG_NUM
| ULONGLONG_NUM
| dec_num_error
;
ulonglong_num:
NUM
| ULONGLONG_NUM
| LONG_NUM
| DECIMAL_NUM
| FLOAT_NUM
;
real_ulonglong_num:
NUM
| ULONGLONG_NUM
| LONG_NUM
| dec_num_error
;
dec_num_error:
dec_num
;
dec_num:
DECIMAL_NUM
| FLOAT_NUM
;
procedure_clause:
/* empty */
| PROCEDURE ident '(' procedure_list ')'
;
procedure_list:
/* empty */
| procedure_list2
;
procedure_list2:
procedure_list2 ',' procedure_item
| procedure_item
;
procedure_item:
remember_name expr remember_end
;
select_var_list_init:
select_var_list
;
select_var_list:
select_var_list ',' select_var_ident
| select_var_ident
;
select_var_ident:
'@' ident_or_text
| ident_or_text
;
into:
INTO into_destination
;
into_destination:
OUTFILE TEXT_STRING_filesystem opt_field_term opt_line_term
| DUMPFILE TEXT_STRING_filesystem
| select_var_list_init
;
do:
DO_SYM expr_list
;
drop:
DROP opt_temporary table_or_tables if_exists table_list opt_restrict
| DROP INDEX_SYM ident ON table_ident
| DROP DATABASE if_exists ident
| DROP FUNCTION_SYM if_exists ident '.' ident
| DROP FUNCTION_SYM if_exists ident
| DROP PROCEDURE if_exists sp_name
| DROP USER clear_privileges user_list
| DROP VIEW_SYM if_exists table_list opt_restrict
| DROP EVENT_SYM if_exists sp_name
| DROP TRIGGER_SYM if_exists sp_name
| DROP TABLESPACE tablespace_name opt_ts_engine opt_ts_wait
| DROP LOGFILE_SYM GROUP_SYM logfile_group_name opt_ts_engine opt_ts_wait
| DROP SERVER_SYM if_exists ident_or_text
;
table_list:
table_name
| table_list ',' table_name
;
table_name:
table_ident
;
table_alias_ref_list:
table_alias_ref
| table_alias_ref_list ',' table_alias_ref
;
table_alias_ref:
table_ident
;
if_exists:
/* empty */
| IF EXISTS
;
opt_temporary:
/* empty */
| TEMPORARY
;
insert:
INSERT insert_lock_option opt_ignore insert2 insert_field_spec opt_insert_update
;
replace:
REPLACE replace_lock_option insert2 insert_field_spec
;
insert_lock_option:
/* empty */
| LOW_PRIORITY
| DELAYED_SYM
| HIGH_PRIORITY
;
replace_lock_option:
opt_low_priority
| DELAYED_SYM
;
insert2:
INTO insert_table
| insert_table
;
insert_table:
table_name
;
insert_field_spec:
insert_values
| '(' ')' insert_values
| '(' fields ')' insert_values
| SET ident_eq_list
;
fields:
fields ',' insert_ident
| insert_ident
;
insert_values:
VALUES values_list
| VALUE_SYM values_list
| create_select union_clause
| '(' create_select ')' union_opt
;
values_list:
values_list ',' no_braces
| no_braces
;
ident_eq_list:
ident_eq_list ',' ident_eq_value
| ident_eq_value
;
ident_eq_value:
simple_ident_nospvar equal expr_or_default
;
equal:
EQ
| SET_VAR
;
opt_equal:
/* empty */
| equal
;
no_braces:
'(' opt_values ')'
;
opt_values:
/* empty */
| values
;
values:
values ',' expr_or_default
| expr_or_default
;
expr_or_default:
expr
| DEFAULT
;
opt_insert_update:
/* empty */
| ON DUPLICATE_SYM KEY_SYM UPDATE_SYM insert_update_list
;
update:
UPDATE_SYM opt_low_priority opt_ignore join_table_list SET update_list where_clause opt_order_clause delete_limit_clause
;
update_list:
update_list ',' update_elem
| update_elem
;
update_elem:
simple_ident_nospvar equal expr_or_default
;
insert_update_list:
insert_update_list ',' insert_update_elem
| insert_update_elem
;
insert_update_elem:
simple_ident_nospvar equal expr_or_default
;
opt_low_priority:
/* empty */
| LOW_PRIORITY
;
delete:
DELETE_SYM opt_delete_options single_multi
;
single_multi:
FROM table_ident where_clause opt_order_clause delete_limit_clause
| table_wild_list FROM join_table_list where_clause
| FROM table_alias_ref_list USING join_table_list where_clause
;
table_wild_list:
table_wild_one
| table_wild_list ',' table_wild_one
;
table_wild_one:
ident opt_wild opt_table_alias
| ident '.' ident opt_wild opt_table_alias
;
opt_wild:
/* empty */
| '.' '*'
;
opt_delete_options:
/* empty */
| opt_delete_option opt_delete_options
;
opt_delete_option:
QUICK
| LOW_PRIORITY
| IGNORE_SYM
;
truncate:
TRUNCATE_SYM opt_table_sym table_name
;
opt_table_sym:
/* empty */
| TABLE_SYM
;
show:
SHOW show_param
;
show_param:
DATABASES wild_and_where
| opt_full TABLES opt_db wild_and_where
| opt_full TRIGGERS_SYM opt_db wild_and_where
| EVENTS_SYM opt_db wild_and_where
| TABLE_SYM STATUS_SYM opt_db wild_and_where
| OPEN_SYM TABLES opt_db wild_and_where
| opt_full PLUGIN_SYM
| PLUGINS_SYM
| ENGINE_SYM known_storage_engines show_engine_param
| ENGINE_SYM ALL show_engine_param
| opt_full COLUMNS from_or_in table_ident opt_db wild_and_where
| NEW_SYM MASTER_SYM FOR_SYM SLAVE WITH MASTER_LOG_FILE_SYM EQ TEXT_STRING_sys AND_SYM MASTER_LOG_POS_SYM EQ ulonglong_num AND_SYM MASTER_SERVER_ID_SYM EQ ulong_num
| master_or_binary LOGS_SYM
| SLAVE HOSTS_SYM
| BINLOG_SYM EVENTS_SYM binlog_in binlog_from opt_limit_clause_init
| keys_or_index from_or_in table_ident opt_db where_clause
| COLUMN_SYM TYPES_SYM
| TABLE_SYM TYPES_SYM
| opt_storage ENGINES_SYM
| AUTHORS_SYM
| CONTRIBUTORS_SYM
| PRIVILEGES
| COUNT_SYM '(' '*' ')' WARNINGS
| COUNT_SYM '(' '*' ')' ERRORS
| WARNINGS opt_limit_clause_init
| ERRORS opt_limit_clause_init
| opt_var_type STATUS_SYM wild_and_where
| INNOBASE_SYM STATUS_SYM
| MUTEX_SYM STATUS_SYM
| opt_full PROCESSLIST_SYM
| opt_var_type VARIABLES wild_and_where
| charset wild_and_where
| COLLATION_SYM wild_and_where
| GRANTS
| GRANTS FOR_SYM user
| CREATE DATABASE opt_if_not_exists ident
| CREATE TABLE_SYM table_ident
| CREATE VIEW_SYM table_ident
| MASTER_SYM STATUS_SYM
| SLAVE STATUS_SYM
| CREATE PROCEDURE sp_name
| CREATE FUNCTION_SYM sp_name
| CREATE TRIGGER_SYM sp_name
| PROCEDURE STATUS_SYM wild_and_where
| FUNCTION_SYM STATUS_SYM wild_and_where
| PROCEDURE CODE_SYM sp_name
| FUNCTION_SYM CODE_SYM sp_name
| CREATE EVENT_SYM sp_name
;
show_engine_param:
STATUS_SYM
| MUTEX_SYM
| LOGS_SYM
;
master_or_binary:
MASTER_SYM
| BINARY
;
opt_storage:
/* empty */
| STORAGE_SYM
;
opt_db:
/* empty */
| from_or_in ident
;
opt_full:
/* empty */
| FULL
;
from_or_in:
FROM
| IN_SYM
;
binlog_in:
/* empty */
| IN_SYM TEXT_STRING_sys
;
binlog_from:
/* empty */
| FROM ulonglong_num
;
wild_and_where:
/* empty */
| LIKE TEXT_STRING_sys
| WHERE expr
;
describe:
describe_command table_ident opt_describe_column
| describe_command opt_extended_describe select
;
describe_command:
DESC
| DESCRIBE
;
opt_extended_describe:
/* empty */
| EXTENDED_SYM
| PARTITIONS_SYM
;
opt_describe_column:
/* empty */
| text_string
| ident
;
flush:
FLUSH_SYM opt_no_write_to_binlog flush_options
;
flush_options:
flush_options ',' flush_option
| flush_option
;
flush_option:
table_or_tables opt_table_list
| TABLES WITH READ_SYM LOCK_SYM
| QUERY_SYM CACHE_SYM
| HOSTS_SYM
| PRIVILEGES
| LOGS_SYM
| STATUS_SYM
| SLAVE
| MASTER_SYM
| DES_KEY_FILE
| RESOURCES
;
opt_table_list:
/* empty */
| table_list
;
reset:
RESET_SYM reset_options
;
reset_options:
reset_options ',' reset_option
| reset_option
;
reset_option:
SLAVE
| MASTER_SYM
| QUERY_SYM CACHE_SYM
;
purge:
PURGE purge_options
;
purge_options:
master_or_binary LOGS_SYM purge_option
;
purge_option:
TO_SYM TEXT_STRING_sys
| BEFORE_SYM expr
;
kill:
KILL_SYM kill_option expr
;
kill_option:
/* empty */
| CONNECTION_SYM
| QUERY_SYM
;
use:
USE_SYM ident
;
load:
LOAD DATA_SYM load_data
| LOAD TABLE_SYM table_ident FROM MASTER_SYM
;
load_data:
load_data_lock opt_local INFILE TEXT_STRING_filesystem opt_duplicate INTO TABLE_SYM table_ident opt_load_data_charset opt_field_term opt_line_term opt_ignore_lines opt_field_or_var_spec opt_load_data_set_spec
| FROM MASTER_SYM
;
opt_local:
/* empty */
| LOCAL_SYM
;
load_data_lock:
/* empty */
| CONCURRENT
| LOW_PRIORITY
;
opt_duplicate:
/* empty */
| REPLACE
| IGNORE_SYM
;
opt_field_term:
/* empty */
| COLUMNS field_term_list
;
field_term_list:
field_term_list field_term
| field_term
;
field_term:
TERMINATED BY text_string
| OPTIONALLY ENCLOSED BY text_string
| ENCLOSED BY text_string
| ESCAPED BY text_string
;
opt_line_term:
/* empty */
| LINES line_term_list
;
line_term_list:
line_term_list line_term
| line_term
;
line_term:
TERMINATED BY text_string
| STARTING BY text_string
;
opt_ignore_lines:
/* empty */
| IGNORE_SYM NUM LINES
;
opt_field_or_var_spec:
/* empty */
| '(' fields_or_vars ')'
| '(' ')'
;
fields_or_vars:
fields_or_vars ',' field_or_var
| field_or_var
;
field_or_var:
simple_ident_nospvar
| '@' ident_or_text
;
opt_load_data_set_spec:
/* empty */
| SET insert_update_list
;
text_literal:
TEXT_STRING
| NCHAR_STRING
| UNDERSCORE_CHARSET TEXT_STRING
| text_literal TEXT_STRING_literal
;
text_string:
TEXT_STRING_literal
| HEX_NUM
| BIN_NUM
;
param_marker:
PARAM_MARKER
;
signed_literal:
literal
| '+' NUM_literal
| '-' NUM_literal
;
literal:
text_literal
| NUM_literal
| NULL_SYM
| FALSE_SYM
| TRUE_SYM
| HEX_NUM
| BIN_NUM
| UNDERSCORE_CHARSET HEX_NUM
| UNDERSCORE_CHARSET BIN_NUM
| DATE_SYM text_literal
| TIME_SYM text_literal
| TIMESTAMP text_literal
;
NUM_literal:
NUM
| LONG_NUM
| ULONGLONG_NUM
| DECIMAL_NUM
| FLOAT_NUM
;
insert_ident:
simple_ident_nospvar
| table_wild
;
table_wild:
ident '.' '*'
| ident '.' ident '.' '*'
;
order_ident:
expr
;
simple_ident:
ident
| simple_ident_q
;
simple_ident_nospvar:
ident
| simple_ident_q
;
simple_ident_q:
ident '.' ident
| '.' ident '.' ident
| ident '.' ident '.' ident
;
field_ident:
ident
| ident '.' ident '.' ident
| ident '.' ident
| '.' ident
;
table_ident:
ident
| ident '.' ident
| '.' ident
;
table_ident_nodb:
ident
;
IDENT_sys:
IDENT
| IDENT_QUOTED
;
TEXT_STRING_sys:
TEXT_STRING
;
TEXT_STRING_literal:
TEXT_STRING
;
TEXT_STRING_filesystem:
TEXT_STRING
;
ident:
IDENT_sys
| READ_ONLY_SYM
| keyword
;
label_ident:
IDENT_sys
| keyword_sp
;
ident_or_text:
ident
| TEXT_STRING_sys
| LEX_HOSTNAME
;
user:
ident_or_text
| ident_or_text '@' ident_or_text
| CURRENT_USER optional_braces
;
keyword:
keyword_sp
| ASCII_SYM
| BACKUP_SYM
| BEGIN_SYM
| BYTE_SYM
| CACHE_SYM
| CHARSET
| CHECKSUM_SYM
| CLOSE_SYM
| COMMENT_SYM
| COMMIT_SYM
| CONTAINS_SYM
| DEALLOCATE_SYM
| DO_SYM
| END
| EXECUTE_SYM
| FLUSH_SYM
| HANDLER_SYM
| HELP_SYM
| HOST_SYM
| INSTALL_SYM
| LANGUAGE_SYM
| NO_SYM
| OPEN_SYM
| OPTIONS_SYM
| OWNER_SYM
| PARSER_SYM
| PARTITION_SYM
| PORT_SYM
| PREPARE_SYM
| REMOVE_SYM
| REPAIR
| RESET_SYM
| RESTORE_SYM
| ROLLBACK_SYM
| SAVEPOINT_SYM
| SECURITY_SYM
| SERVER_SYM
| SIGNED_SYM
| SOCKET_SYM
| SLAVE
| SONAME_SYM
| START_SYM
| STOP_SYM
| TRUNCATE_SYM
| UNICODE_SYM
| UNINSTALL_SYM
| WRAPPER_SYM
| XA_SYM
| UPGRADE_SYM
;
keyword_sp:
ACTION
| ADDDATE_SYM
| AFTER_SYM
| AGAINST
| AGGREGATE_SYM
| ALGORITHM_SYM
| ANY_SYM
| AT_SYM
| AUTHORS_SYM
| AUTO_INC
| AUTOEXTEND_SIZE_SYM
| AVG_ROW_LENGTH
| AVG_SYM
| BINLOG_SYM
| BIT_SYM
| BOOL_SYM
| BOOLEAN_SYM
| BTREE_SYM
| CASCADED
| CHAIN_SYM
| CHANGED
| CIPHER_SYM
| CLIENT_SYM
| COALESCE
| CODE_SYM
| COLLATION_SYM
| COLUMNS
| COMMITTED_SYM
| COMPACT_SYM
| COMPLETION_SYM
| COMPRESSED_SYM
| CONCURRENT
| CONNECTION_SYM
| CONSISTENT_SYM
| CONTRIBUTORS_SYM
| CUBE_SYM
| DATA_SYM
| DATAFILE_SYM
| DATETIME
| DATE_SYM
| DAY_SYM
| DEFINER_SYM
| DELAY_KEY_WRITE_SYM
| DES_KEY_FILE
| DIRECTORY_SYM
| DISABLE_SYM
| DISCARD
| DISK_SYM
| DUMPFILE
| DUPLICATE_SYM
| DYNAMIC_SYM
| ENDS_SYM
| ENUM
| ENGINE_SYM
| ENGINES_SYM
| ERRORS
| ESCAPE_SYM
| EVENT_SYM
| EVENTS_SYM
| EVERY_SYM
| EXPANSION_SYM
| EXTENDED_SYM
| EXTENT_SIZE_SYM
| FAST_SYM
| FOUND_SYM
| ENABLE_SYM
| FULL
| FILE_SYM
| FIRST_SYM
| FIXED_SYM
| FRAC_SECOND_SYM
| GEOMETRY_SYM
| GEOMETRYCOLLECTION
| GET_FORMAT
| GRANTS
| GLOBAL_SYM
| HASH_SYM
| HOSTS_SYM
| HOUR_SYM
| IDENTIFIED_SYM
| INVOKER_SYM
| IMPORT
| INDEXES
| INITIAL_SIZE_SYM
| ISOLATION
| ISSUER_SYM
| INNOBASE_SYM
| INSERT_METHOD
| KEY_BLOCK_SIZE
| LAST_SYM
| LEAVES
| LESS_SYM
| LEVEL_SYM
| LINESTRING
| LIST_SYM
| LOCAL_SYM
| LOCKS_SYM
| LOGFILE_SYM
| LOGS_SYM
| MAX_ROWS
| MASTER_SYM
| MASTER_HOST_SYM
| MASTER_PORT_SYM
| MASTER_LOG_FILE_SYM
| MASTER_LOG_POS_SYM
| MASTER_USER_SYM
| MASTER_PASSWORD_SYM
| MASTER_SERVER_ID_SYM
| MASTER_CONNECT_RETRY_SYM
| MASTER_SSL_SYM
| MASTER_SSL_CA_SYM
| MASTER_SSL_CAPATH_SYM
| MASTER_SSL_CERT_SYM
| MASTER_SSL_CIPHER_SYM
| MASTER_SSL_KEY_SYM
| MAX_CONNECTIONS_PER_HOUR
| MAX_QUERIES_PER_HOUR
| MAX_SIZE_SYM
| MAX_UPDATES_PER_HOUR
| MAX_USER_CONNECTIONS_SYM
| MAX_VALUE_SYM
| MEDIUM_SYM
| MEMORY_SYM
| MERGE_SYM
| MICROSECOND_SYM
| MIGRATE_SYM
| MINUTE_SYM
| MIN_ROWS
| MODIFY_SYM
| MODE_SYM
| MONTH_SYM
| MULTILINESTRING
| MULTIPOINT
| MULTIPOLYGON
| MUTEX_SYM
| NAME_SYM
| NAMES_SYM
| NATIONAL_SYM
| NCHAR_SYM
| NDBCLUSTER_SYM
| NEXT_SYM
| NEW_SYM
| NO_WAIT_SYM
| NODEGROUP_SYM
| NONE_SYM
| NVARCHAR_SYM
| OFFSET_SYM
| OLD_PASSWORD
| ONE_SHOT_SYM
| ONE_SYM
| PACK_KEYS_SYM
| PAGE_SYM
| PARTIAL
| PARTITIONING_SYM
| PARTITIONS_SYM
| PASSWORD
| PHASE_SYM
| PLUGIN_SYM
| PLUGINS_SYM
| POINT_SYM
| POLYGON
| PRESERVE_SYM
| PREV_SYM
| PRIVILEGES
| PROCESS
| PROCESSLIST_SYM
| QUARTER_SYM
| QUERY_SYM
| QUICK
| REBUILD_SYM
| RECOVER_SYM
| REDO_BUFFER_SIZE_SYM
| REDOFILE_SYM
| REDUNDANT_SYM
| RELAY_LOG_FILE_SYM
| RELAY_LOG_POS_SYM
| RELAY_THREAD
| RELOAD
| REORGANIZE_SYM
| REPEATABLE_SYM
| REPLICATION
| RESOURCES
| RESUME_SYM
| RETURNS_SYM
| ROLLUP_SYM
| ROUTINE_SYM
| ROWS_SYM
| ROW_FORMAT_SYM
| ROW_SYM
| RTREE_SYM
| SCHEDULE_SYM
| SECOND_SYM
| SERIAL_SYM
| SERIALIZABLE_SYM
| SESSION_SYM
| SIMPLE_SYM
| SHARE_SYM
| SHUTDOWN
| SNAPSHOT_SYM
| SOUNDS_SYM
| SQL_CACHE_SYM
| SQL_BUFFER_RESULT
| SQL_NO_CACHE_SYM
| SQL_THREAD
| STARTS_SYM
| STATUS_SYM
| STORAGE_SYM
| STRING_SYM
| SUBDATE_SYM
| SUBJECT_SYM
| SUBPARTITION_SYM
| SUBPARTITIONS_SYM
| SUPER_SYM
| SUSPEND_SYM
| TABLES
| TABLESPACE
| TEMPORARY
| TEMPTABLE_SYM
| TEXT_SYM
| THAN_SYM
| TRANSACTION_SYM
| TRANSACTIONAL_SYM
| TRIGGERS_SYM
| TIMESTAMP
| TIMESTAMP_ADD
| TIMESTAMP_DIFF
| TIME_SYM
| TYPES_SYM
| TYPE_SYM
| UDF_RETURNS_SYM
| FUNCTION_SYM
| UNCOMMITTED_SYM
| UNDEFINED_SYM
| UNDO_BUFFER_SIZE_SYM
| UNDOFILE_SYM
| UNKNOWN_SYM
| UNTIL_SYM
| USER
| USE_FRM
| VARIABLES
| VIEW_SYM
| VALUE_SYM
| WARNINGS
| WAIT_SYM
| WEEK_SYM
| WORK_SYM
| X509_SYM
| YEAR_SYM
;
set:
SET opt_option option_value_list
;
opt_option:
/* empty */
| OPTION
;
option_value_list:
option_type_value
| option_value_list ',' option_type_value
;
option_type_value:
ext_option_value
;
option_type:
option_type2
| GLOBAL_SYM
| LOCAL_SYM
| SESSION_SYM
;
option_type2:
/* empty */
| ONE_SHOT_SYM
;
opt_var_type:
/* empty */
| GLOBAL_SYM
| LOCAL_SYM
| SESSION_SYM
;
opt_var_ident_type:
/* empty */
| GLOBAL_SYM '.'
| LOCAL_SYM '.'
| SESSION_SYM '.'
;
ext_option_value:
sys_option_value
| option_type2 option_value
;
sys_option_value:
option_type internal_variable_name equal set_expr_or_default
| option_type TRANSACTION_SYM ISOLATION LEVEL_SYM isolation_types
;
option_value:
'@' ident_or_text equal expr
| '@' '@' opt_var_ident_type internal_variable_name equal set_expr_or_default
| charset old_or_new_charset_name_or_default
| NAMES_SYM equal expr
| NAMES_SYM charset_name_or_default opt_collate
| PASSWORD equal text_or_password
| PASSWORD FOR_SYM user equal text_or_password
;
internal_variable_name:
ident
| ident '.' ident
| DEFAULT '.' ident
;
isolation_types:
READ_SYM UNCOMMITTED_SYM
| READ_SYM COMMITTED_SYM
| REPEATABLE_SYM READ_SYM
| SERIALIZABLE_SYM
;
text_or_password:
TEXT_STRING
| PASSWORD '(' TEXT_STRING ')'
| OLD_PASSWORD '(' TEXT_STRING ')'
;
set_expr_or_default:
expr
| DEFAULT
| ON
| ALL
| BINARY
;
lock:
LOCK_SYM table_or_tables table_lock_list
;
table_or_tables:
TABLE_SYM
| TABLES
;
table_lock_list:
table_lock
| table_lock_list ',' table_lock
;
table_lock:
table_ident opt_table_alias lock_option
;
lock_option:
READ_SYM
| WRITE_SYM
| LOW_PRIORITY WRITE_SYM
| READ_SYM LOCAL_SYM
;
unlock:
UNLOCK_SYM table_or_tables
;
handler:
HANDLER_SYM table_ident OPEN_SYM opt_table_alias
| HANDLER_SYM table_ident_nodb CLOSE_SYM
| HANDLER_SYM table_ident_nodb READ_SYM handler_read_or_scan where_clause opt_limit_clause
;
handler_read_or_scan:
handler_scan_function
| ident handler_rkey_function
;
handler_scan_function:
FIRST_SYM
| NEXT_SYM
;
handler_rkey_function:
FIRST_SYM
| NEXT_SYM
| PREV_SYM
| LAST_SYM
| handler_rkey_mode '(' values ')'
;
handler_rkey_mode:
EQ
| GE
| LE
| GT_SYM
| LT
;
revoke:
REVOKE clear_privileges revoke_command
;
revoke_command:
grant_privileges ON opt_table grant_ident FROM grant_list
| grant_privileges ON FUNCTION_SYM grant_ident FROM grant_list
| grant_privileges ON PROCEDURE grant_ident FROM grant_list
| ALL opt_privileges ',' GRANT OPTION FROM grant_list
;
grant:
GRANT clear_privileges grant_command
;
grant_command:
grant_privileges ON opt_table grant_ident TO_SYM grant_list require_clause grant_options
| grant_privileges ON FUNCTION_SYM grant_ident TO_SYM grant_list require_clause grant_options
| grant_privileges ON PROCEDURE grant_ident TO_SYM grant_list require_clause grant_options
;
opt_table:
/* empty */
| TABLE_SYM
;
grant_privileges:
object_privilege_list
| ALL opt_privileges
;
opt_privileges:
/* empty */
| PRIVILEGES
;
object_privilege_list:
object_privilege
| object_privilege_list ',' object_privilege
;
object_privilege:
SELECT_SYM opt_column_list
| INSERT opt_column_list
| UPDATE_SYM opt_column_list
| REFERENCES opt_column_list
| DELETE_SYM
| USAGE
| INDEX_SYM
| ALTER
| CREATE
| DROP
| EXECUTE_SYM
| RELOAD
| SHUTDOWN
| PROCESS
| FILE_SYM
| GRANT OPTION
| SHOW DATABASES
| SUPER_SYM
| CREATE TEMPORARY TABLES
| LOCK_SYM TABLES
| REPLICATION SLAVE
| REPLICATION CLIENT_SYM
| CREATE VIEW_SYM
| SHOW VIEW_SYM
| CREATE ROUTINE_SYM
| ALTER ROUTINE_SYM
| CREATE USER
| EVENT_SYM
| TRIGGER_SYM
;
opt_and:
/* empty */
| AND_SYM
;
require_list:
require_list_element opt_and require_list
| require_list_element
;
require_list_element:
SUBJECT_SYM TEXT_STRING
| ISSUER_SYM TEXT_STRING
| CIPHER_SYM TEXT_STRING
;
grant_ident:
'*'
| ident '.' '*'
| '*' '.' '*'
| table_ident
;
user_list:
user
| user_list ',' user
;
grant_list:
grant_user
| grant_list ',' grant_user
;
grant_user:
user IDENTIFIED_SYM BY TEXT_STRING
| user IDENTIFIED_SYM BY PASSWORD TEXT_STRING
| user
;
opt_column_list:
/* empty */
| '(' column_list ')'
;
column_list:
column_list ',' column_list_id
| column_list_id
;
column_list_id:
ident
;
require_clause:
/* empty */
| REQUIRE_SYM require_list
| REQUIRE_SYM SSL_SYM
| REQUIRE_SYM X509_SYM
| REQUIRE_SYM NONE_SYM
;
grant_options:
/* empty */
| WITH grant_option_list
;
grant_option_list:
grant_option_list grant_option
| grant_option
;
grant_option:
GRANT OPTION
| MAX_QUERIES_PER_HOUR ulong_num
| MAX_UPDATES_PER_HOUR ulong_num
| MAX_CONNECTIONS_PER_HOUR ulong_num
| MAX_USER_CONNECTIONS_SYM ulong_num
;
begin:
BEGIN_SYM opt_work
;
opt_work:
/* empty */
| WORK_SYM
;
opt_chain:
/* empty */
| AND_SYM NO_SYM CHAIN_SYM
| AND_SYM CHAIN_SYM
;
opt_release:
/* empty */
| RELEASE_SYM
| NO_SYM RELEASE_SYM
;
opt_savepoint:
/* empty */
| SAVEPOINT_SYM
;
commit:
COMMIT_SYM opt_work opt_chain opt_release
;
rollback:
ROLLBACK_SYM opt_work opt_chain opt_release
| ROLLBACK_SYM opt_work TO_SYM opt_savepoint ident
;
savepoint:
SAVEPOINT_SYM ident
;
release:
RELEASE_SYM SAVEPOINT_SYM ident
;
union_clause:
/* empty */
| union_list
;
union_list:
UNION_SYM union_option select_init
;
union_opt:
/* empty */
| union_list
| union_order_or_limit
;
union_order_or_limit:
order_or_limit
;
order_or_limit:
order_clause opt_limit_clause_init
| limit_clause
;
union_option:
/* empty */
| DISTINCT
| ALL
;
take_first_select:
/* empty */
;
subselect:
SELECT_SYM subselect_start select_init2 take_first_select subselect_end
| '(' subselect_start select_paren take_first_select subselect_end ')'
;
subselect_start:
/* empty */
;
subselect_end:
/* empty */
;
view_or_trigger_or_sp_or_event:
definer definer_tail
| no_definer no_definer_tail
| view_replace_or_algorithm definer_opt view_tail
;
definer_tail:
view_tail
| trigger_tail
| sp_tail
| sf_tail
| event_tail
;
no_definer_tail:
view_tail
| trigger_tail
| sp_tail
| sf_tail
| udf_tail
| event_tail
;
definer_opt:
no_definer
| definer
;
no_definer:
/* empty */
;
definer:
DEFINER_SYM EQ user
;
view_replace_or_algorithm:
view_replace
| view_replace view_algorithm
| view_algorithm
;
view_replace:
OR_SYM REPLACE
;
view_algorithm:
ALGORITHM_SYM EQ UNDEFINED_SYM
| ALGORITHM_SYM EQ MERGE_SYM
| ALGORITHM_SYM EQ TEMPTABLE_SYM
;
view_suid:
/* empty */
| SQL_SYM SECURITY_SYM DEFINER_SYM
| SQL_SYM SECURITY_SYM INVOKER_SYM
;
view_tail:
view_suid VIEW_SYM table_ident view_list_opt AS view_select
;
view_list_opt:
/* empty */
| '(' view_list ')'
;
view_list:
ident
| view_list ',' ident
;
view_select:
view_select_aux view_check_option
;
view_select_aux:
SELECT_SYM select_init2
| '(' select_paren ')' union_opt
;
view_check_option:
/* empty */
| WITH CHECK_SYM OPTION
| WITH CASCADED CHECK_SYM OPTION
| WITH LOCAL_SYM CHECK_SYM OPTION
;
trigger_tail:
TRIGGER_SYM remember_name sp_name trg_action_time trg_event ON remember_name table_ident FOR_SYM remember_name EACH_SYM ROW_SYM sp_proc_stmt
;
udf_tail:
AGGREGATE_SYM remember_name FUNCTION_SYM ident RETURNS_SYM udf_type SONAME_SYM TEXT_STRING_sys
| remember_name FUNCTION_SYM ident RETURNS_SYM udf_type SONAME_SYM TEXT_STRING_sys
;
sf_tail:
remember_name FUNCTION_SYM sp_name '(' sp_fdparam_list ')' RETURNS_SYM type sp_c_chistics sp_proc_stmt
;
sp_tail:
PROCEDURE remember_name sp_name '(' sp_pdparam_list ')' sp_c_chistics sp_proc_stmt
;
xa:
XA_SYM begin_or_start xid opt_join_or_resume
| XA_SYM END xid opt_suspend
| XA_SYM PREPARE_SYM xid
| XA_SYM COMMIT_SYM xid opt_one_phase
| XA_SYM ROLLBACK_SYM xid
| XA_SYM RECOVER_SYM
;
xid:
text_string
| text_string ',' text_string
| text_string ',' text_string ',' ulong_num
;
begin_or_start:
BEGIN_SYM
| START_SYM
;
opt_join_or_resume:
/* empty */
| JOIN_SYM
| RESUME_SYM
;
opt_one_phase:
/* empty */
| ONE_SYM PHASE_SYM
;
opt_suspend:
/* empty */
| SUSPEND_SYM opt_migrate
;
opt_migrate:
/* empty */
| FOR_SYM MIGRATE_SYM
;
install:
INSTALL_SYM PLUGIN_SYM ident SONAME_SYM TEXT_STRING_sys
;
uninstall:
UNINSTALL_SYM PLUGIN_SYM ident
;