Commit 87fbeb40 authored by serg@serg.mysql.com's avatar serg@serg.mysql.com

let's leave "INSERT ... SELECT ... UPDATE" for the future

parent fd11c804
...@@ -682,7 +682,7 @@ query: ...@@ -682,7 +682,7 @@ query:
{ {
send_error(thd,ER_EMPTY_QUERY); send_error(thd,ER_EMPTY_QUERY);
YYABORT; YYABORT;
} }
else else
{ {
thd->lex.sql_command = SQLCOM_EMPTY_QUERY; thd->lex.sql_command = SQLCOM_EMPTY_QUERY;
...@@ -810,7 +810,7 @@ create: ...@@ -810,7 +810,7 @@ create:
LEX *lex=Lex; LEX *lex=Lex;
lex->sql_command= SQLCOM_CREATE_TABLE; lex->sql_command= SQLCOM_CREATE_TABLE;
if (!lex->select_lex.add_table_to_list($5, if (!lex->select_lex.add_table_to_list($5,
($2 & ($2 &
HA_LEX_CREATE_TMP_TABLE ? HA_LEX_CREATE_TMP_TABLE ?
&tmp_table_alias : &tmp_table_alias :
(LEX_STRING*) 0),1, (LEX_STRING*) 0),1,
...@@ -1073,7 +1073,7 @@ type: ...@@ -1073,7 +1073,7 @@ type:
$$=FIELD_TYPE_STRING; } $$=FIELD_TYPE_STRING; }
| char opt_binary { Lex->length=(char*) "1"; | char opt_binary { Lex->length=(char*) "1";
$$=FIELD_TYPE_STRING; } $$=FIELD_TYPE_STRING; }
| BINARY '(' NUM ')' { Lex->length=$3.str; | BINARY '(' NUM ')' { Lex->length=$3.str;
Lex->charset=my_charset_bin; Lex->charset=my_charset_bin;
$$=FIELD_TYPE_STRING; } $$=FIELD_TYPE_STRING; }
| varchar '(' NUM ')' opt_binary { Lex->length=$3.str; | varchar '(' NUM ')' opt_binary { Lex->length=$3.str;
...@@ -1219,15 +1219,15 @@ attribute: ...@@ -1219,15 +1219,15 @@ attribute:
charset_name: charset_name:
BINARY BINARY
{ {
if (!($$=get_charset_by_name("binary",MYF(0)))) if (!($$=get_charset_by_name("binary",MYF(0))))
{ {
net_printf(YYTHD,ER_UNKNOWN_CHARACTER_SET,"binary"); net_printf(YYTHD,ER_UNKNOWN_CHARACTER_SET,"binary");
YYABORT; YYABORT;
} }
} }
| ident | ident
{ {
if (!($$=get_charset_by_name($1.str,MYF(0)))) if (!($$=get_charset_by_name($1.str,MYF(0))))
{ {
net_printf(YYTHD,ER_UNKNOWN_CHARACTER_SET,$1.str); net_printf(YYTHD,ER_UNKNOWN_CHARACTER_SET,$1.str);
...@@ -1373,7 +1373,7 @@ alter: ...@@ -1373,7 +1373,7 @@ alter:
lex->alter_list.empty(); lex->alter_list.empty();
lex->select_lex.init_order(); lex->select_lex.init_order();
lex->select_lex.db=lex->name=0; lex->select_lex.db=lex->name=0;
bzero((char*) &lex->create_info,sizeof(lex->create_info)); bzero((char*) &lex->create_info,sizeof(lex->create_info));
lex->create_info.db_type= DB_TYPE_DEFAULT; lex->create_info.db_type= DB_TYPE_DEFAULT;
lex->create_info.table_charset=thd->db_charset?thd->db_charset:default_charset_info; lex->create_info.table_charset=thd->db_charset?thd->db_charset:default_charset_info;
lex->create_info.row_type= ROW_TYPE_NOT_USED; lex->create_info.row_type= ROW_TYPE_NOT_USED;
...@@ -1617,12 +1617,12 @@ table_to_table_list: ...@@ -1617,12 +1617,12 @@ table_to_table_list:
table_to_table: table_to_table:
table_ident TO_SYM table_ident table_ident TO_SYM table_ident
{ {
SELECT_LEX_NODE *sl= Lex->current_select; SELECT_LEX_NODE *sl= Lex->current_select;
if (!sl->add_table_to_list($1,NULL,1,TL_IGNORE) || if (!sl->add_table_to_list($1,NULL,1,TL_IGNORE) ||
!sl->add_table_to_list($3,NULL,1,TL_IGNORE)) !sl->add_table_to_list($3,NULL,1,TL_IGNORE))
YYABORT; YYABORT;
}; };
/* /*
Select : retrieve data from table Select : retrieve data from table
...@@ -1636,8 +1636,8 @@ select: ...@@ -1636,8 +1636,8 @@ select:
select_init: select_init:
SELECT_SYM select_init2 SELECT_SYM select_init2
| |
'(' SELECT_SYM select_part2 ')' '(' SELECT_SYM select_part2 ')'
{ {
LEX *lex= Lex; LEX *lex= Lex;
SELECT_LEX_NODE * sel= lex->current_select; SELECT_LEX_NODE * sel= lex->current_select;
if (sel->set_braces(true)) if (sel->set_braces(true))
...@@ -1647,12 +1647,12 @@ select_init: ...@@ -1647,12 +1647,12 @@ select_init:
} }
/* select in braces, can't contain global parameters */ /* select in braces, can't contain global parameters */
sel->master_unit()->global_parameters= sel->master_unit()->global_parameters=
sel->master_unit(); sel->master_unit();
} union_opt; } union_opt;
select_init2: select_init2:
select_part2 select_part2
{ {
LEX *lex= Lex; LEX *lex= Lex;
if (lex->current_select->set_braces(false)) if (lex->current_select->set_braces(false))
{ {
...@@ -2901,7 +2901,7 @@ insert: ...@@ -2901,7 +2901,7 @@ insert:
/* for subselects */ /* for subselects */
lex->lock_option= (using_update_log) ? TL_READ_NO_INSERT : TL_READ; lex->lock_option= (using_update_log) ? TL_READ_NO_INSERT : TL_READ;
} insert_lock_option } insert_lock_option
opt_ignore insert2 opt_ignore insert2
{ {
Select->set_lock_for_tables($3); Select->set_lock_for_tables($3);
} }
...@@ -2911,7 +2911,7 @@ insert: ...@@ -2911,7 +2911,7 @@ insert:
replace: replace:
REPLACE REPLACE
{ {
LEX *lex=Lex; LEX *lex=Lex;
lex->sql_command = SQLCOM_REPLACE; lex->sql_command = SQLCOM_REPLACE;
lex->duplicates= DUP_REPLACE; lex->duplicates= DUP_REPLACE;
} }
...@@ -2927,7 +2927,7 @@ insert_lock_option: ...@@ -2927,7 +2927,7 @@ insert_lock_option:
| LOW_PRIORITY { $$= TL_WRITE_LOW_PRIORITY; } | LOW_PRIORITY { $$= TL_WRITE_LOW_PRIORITY; }
| DELAYED_SYM { $$= TL_WRITE_DELAYED; } | DELAYED_SYM { $$= TL_WRITE_DELAYED; }
| HIGH_PRIORITY { $$= TL_WRITE; } | HIGH_PRIORITY { $$= TL_WRITE; }
; ;
replace_lock_option: replace_lock_option:
opt_low_priority { $$= $1; } opt_low_priority { $$= $1; }
...@@ -3039,13 +3039,22 @@ values: ...@@ -3039,13 +3039,22 @@ values:
; ;
expr_or_default: expr_or_default:
expr { $$= $1;} expr { $$= $1;}
| DEFAULT {$$= new Item_default(); } | DEFAULT {$$= new Item_default(); }
; ;
opt_insert_update: opt_insert_update:
/* empty */ /* empty */
| ON DUPLICATE KEY_SYM UPDATE_SYM SET update_list | ON DUPLICATE KEY_SYM UPDATE_SYM SET update_list
{ /* for simplisity, let's forget about
INSERT ... SELECT ... UPDATE
for a moment */
if (Lex->sql_command != SQLCOM_INSERT)
{
send_error(Lex->thd, ER_SYNTAX_ERROR);
YYABORT;
}
}
; ;
/* Update rows in a table */ /* Update rows in a table */
......
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