Commit 9c89341f authored by serg@serg.mylan's avatar serg@serg.mylan

new syntax:

  CREATE TABLE ...(SELECT ...) UNION ...
  INSERT ...      (SELECT ...) UNION ...
parent b5c092ba
......@@ -803,18 +803,35 @@ create:
};
create2:
'(' field_list ')' opt_create_table_options create3 {}
'(' create2a {}
| opt_create_table_options create3 {};
create2a:
field_list ')' opt_create_table_options create3 {}
| create_select ')' { Select->braces= 1;} union_opt {}
;
create3:
/* empty */ {}
| opt_duplicate opt_as SELECT_SYM
| opt_duplicate opt_as create_select
{ Select->braces= 0;} opt_union {}
| opt_duplicate opt_as '(' create_select ')'
{ Select->braces= 1;} union_opt {}
;
create_select:
SELECT_SYM
{
LEX *lex=Lex;
lex->lock_option= (using_update_log) ? TL_READ_NO_INSERT : TL_READ;
switch(lex->sql_command) {
case SQLCOM_INSERT: lex->sql_command=SQLCOM_INSERT_SELECT; break;
case SQLCOM_REPLACE: lex->sql_command=SQLCOM_REPLACE_SELECT; break;
}
mysql_init_select(lex);
}
select_options select_item_list opt_select_from opt_union {};
select_options select_item_list opt_select_from
;
opt_as:
/* empty */ {}
......@@ -2613,7 +2630,9 @@ insert_table:
};
insert_field_spec:
opt_field_spec insert_values {}
insert_values {}
| '(' ')' insert_values {}
| '(' fields ')' insert_values {}
| SET
{
LEX *lex=Lex;
......@@ -2634,16 +2653,9 @@ fields:
insert_values:
VALUES values_list {}
| SELECT_SYM
{
LEX *lex=Lex;
lex->sql_command = (lex->sql_command == SQLCOM_INSERT ?
SQLCOM_INSERT_SELECT : SQLCOM_REPLACE_SELECT);
lex->lock_option= (using_update_log) ? TL_READ_NO_INSERT : TL_READ;
mysql_init_select(lex);
}
select_options select_item_list select_from select_lock_type
opt_union {};
| create_select { Select->braces= 0;} opt_union {}
| '(' create_select ')' { Select->braces= 1;} union_opt {}
;
values_list:
values_list ',' no_braces
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment