diff options
Diffstat (limited to 'sql/sql_yacc.yy')
-rw-r--r-- | sql/sql_yacc.yy | 158 |
1 files changed, 79 insertions, 79 deletions
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 0874abaca9c..40c0626b33c 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -977,11 +977,7 @@ create: THD *thd= YYTHD; LEX *lex=Lex; lex->sql_command= SQLCOM_CREATE_TABLE; - if (!lex->select_lex.add_table_to_list(thd,$5, - ($2 & - HA_LEX_CREATE_TMP_TABLE ? - &tmp_table_alias : - (LEX_STRING*) 0), + if (!lex->select_lex.add_table_to_list(thd, $5, NULL, TL_OPTION_UPDATING, (using_update_log ? TL_READ_NO_INSERT: @@ -1015,7 +1011,7 @@ create: { LEX *lex=Lex; - lex->key_list.push_back(new Key($2,$4.str, $5, lex->col_list)); + lex->key_list.push_back(new Key($2,$4.str, $5, 0, lex->col_list)); lex->col_list.empty(); } | CREATE DATABASE opt_if_not_exists ident @@ -2218,7 +2214,6 @@ merge_insert_types: opt_select_from: opt_limit_clause {} - | FROM DUAL_SYM {} | select_from select_lock_type; udf_func_type: @@ -2252,25 +2247,29 @@ key_def: key_type opt_ident key_alg '(' key_list ')' { LEX *lex=Lex; - lex->key_list.push_back(new Key($1,$2, $3, lex->col_list)); + lex->key_list.push_back(new Key($1,$2, $3, 0, lex->col_list)); lex->col_list.empty(); /* Alloced by sql_alloc */ } | opt_constraint constraint_key_type opt_ident key_alg '(' key_list ')' { LEX *lex=Lex; const char *key_name= $3 ? $3:$1; - lex->key_list.push_back(new Key($2, key_name, $4, lex->col_list)); + lex->key_list.push_back(new Key($2, key_name, $4, 0, + lex->col_list)); lex->col_list.empty(); /* Alloced by sql_alloc */ } | opt_constraint FOREIGN KEY_SYM opt_ident '(' key_list ')' references { LEX *lex=Lex; - lex->key_list.push_back(new foreign_key($4, lex->col_list, + lex->key_list.push_back(new foreign_key($4 ? $4:$1, lex->col_list, $8, lex->ref_list, lex->fk_delete_opt, lex->fk_update_opt, lex->fk_match_option)); + lex->key_list.push_back(new Key(Key::MULTIPLE, $4 ? $4 : $1, + HA_KEY_ALG_UNDEF, 1, + lex->col_list)); lex->col_list.empty(); /* Alloced by sql_alloc */ } | constraint opt_check_constraint @@ -2521,25 +2520,25 @@ attribute: { LEX *lex=Lex; lex->type|= AUTO_INCREMENT_FLAG | NOT_NULL_FLAG | UNIQUE_FLAG; - lex->alter_flags|= ALTER_ADD_INDEX; + lex->alter_info.flags|= ALTER_ADD_INDEX; } | opt_primary KEY_SYM { LEX *lex=Lex; lex->type|= PRI_KEY_FLAG | NOT_NULL_FLAG; - lex->alter_flags|= ALTER_ADD_INDEX; + lex->alter_info.flags|= ALTER_ADD_INDEX; } | UNIQUE_SYM { LEX *lex=Lex; lex->type|= UNIQUE_FLAG; - lex->alter_flags|= ALTER_ADD_INDEX; + lex->alter_info.flags|= ALTER_ADD_INDEX; } | UNIQUE_SYM KEY_SYM { LEX *lex=Lex; lex->type|= UNIQUE_KEY_FLAG; - lex->alter_flags|= ALTER_ADD_INDEX; + lex->alter_info.flags|= ALTER_ADD_INDEX; } | COMMENT_SYM TEXT_STRING_sys { Lex->comment= &$2; } | BINARY { Lex->type|= BINCMP_FLAG; } @@ -2787,18 +2786,15 @@ alter: lex->create_list.empty(); lex->key_list.empty(); lex->col_list.empty(); - lex->drop_list.empty(); - lex->alter_list.empty(); lex->select_lex.init_order(); lex->select_lex.db=lex->name=0; bzero((char*) &lex->create_info,sizeof(lex->create_info)); lex->create_info.db_type= DB_TYPE_DEFAULT; lex->create_info.default_table_charset= thd->variables.collation_database; lex->create_info.row_type= ROW_TYPE_NOT_USED; - lex->alter_keys_onoff=LEAVE_AS_IS; - lex->tablespace_op=NO_TABLESPACE_OP; - lex->simple_alter=1; - lex->alter_flags=0; + lex->alter_info.clear(); + lex->alter_info.is_simple= 1; + lex->alter_info.flags= 0; } alter_list {} @@ -2841,8 +2837,8 @@ alter: ; alter_list: - | DISCARD TABLESPACE { Lex->tablespace_op=DISCARD_TABLESPACE; } - | IMPORT TABLESPACE { Lex->tablespace_op=IMPORT_TABLESPACE; } + | DISCARD TABLESPACE { Lex->alter_info.tablespace_op= DISCARD_TABLESPACE; } + | IMPORT TABLESPACE { Lex->alter_info.tablespace_op= IMPORT_TABLESPACE; } | alter_list_item | alter_list ',' alter_list_item; @@ -2851,24 +2847,24 @@ add_column: { LEX *lex=Lex; lex->change=0; - lex->alter_flags|= ALTER_ADD_COLUMN; + lex->alter_info.flags|= ALTER_ADD_COLUMN; }; alter_list_item: - add_column column_def opt_place { Lex->simple_alter=0; } + add_column column_def opt_place { Lex->alter_info.is_simple= 0; } | ADD key_def { LEX *lex=Lex; - lex->simple_alter=0; - lex->alter_flags|= ALTER_ADD_INDEX; + lex->alter_info.is_simple= 0; + lex->alter_info.flags|= ALTER_ADD_INDEX; } - | add_column '(' field_list ')' { Lex->simple_alter=0; } + | add_column '(' field_list ')' { Lex->alter_info.is_simple= 0; } | CHANGE opt_column field_ident { LEX *lex=Lex; lex->change= $3.str; - lex->simple_alter=0; - lex->alter_flags|= ALTER_CHANGE_COLUMN; + lex->alter_info.is_simple= 0; + lex->alter_info.flags|= ALTER_CHANGE_COLUMN; } field_spec opt_place | MODIFY_SYM opt_column field_ident @@ -2878,8 +2874,8 @@ alter_list_item: lex->default_value= lex->on_update_value= 0; lex->comment=0; lex->charset= NULL; - lex->simple_alter=0; - lex->alter_flags|= ALTER_CHANGE_COLUMN; + lex->alter_info.is_simple= 0; + lex->alter_info.flags|= ALTER_CHANGE_COLUMN; } type opt_attribute { @@ -2897,50 +2893,51 @@ alter_list_item: | DROP opt_column field_ident opt_restrict { LEX *lex=Lex; - lex->drop_list.push_back(new Alter_drop(Alter_drop::COLUMN, - $3.str)); - lex->simple_alter=0; - lex->alter_flags|= ALTER_DROP_COLUMN; + lex->alter_info.drop_list.push_back(new Alter_drop(Alter_drop::COLUMN, + $3.str)); + lex->alter_info.is_simple= 0; + lex->alter_info.flags|= ALTER_DROP_COLUMN; } - | DROP FOREIGN KEY_SYM opt_ident { Lex->simple_alter=0; } + | DROP FOREIGN KEY_SYM opt_ident { Lex->alter_info.is_simple= 0; } | DROP PRIMARY_SYM KEY_SYM { LEX *lex=Lex; - lex->drop_list.push_back(new Alter_drop(Alter_drop::KEY, - primary_key_name)); - lex->simple_alter=0; - lex->alter_flags|= ALTER_DROP_INDEX; + lex->alter_info.drop_list.push_back(new Alter_drop(Alter_drop::KEY, + primary_key_name)); + lex->alter_info.is_simple= 0; + lex->alter_info.flags|= ALTER_DROP_INDEX; } | DROP key_or_index field_ident { LEX *lex=Lex; - lex->drop_list.push_back(new Alter_drop(Alter_drop::KEY, - $3.str)); - lex->simple_alter=0; - lex->alter_flags|= ALTER_DROP_INDEX; + lex->alter_info.drop_list.push_back(new Alter_drop(Alter_drop::KEY, + $3.str)); + lex->alter_info.is_simple= 0; + lex->alter_info.flags|= ALTER_DROP_INDEX; } - | DISABLE_SYM KEYS { Lex->alter_keys_onoff=DISABLE; } - | ENABLE_SYM KEYS { Lex->alter_keys_onoff=ENABLE; } + | DISABLE_SYM KEYS { Lex->alter_info.keys_onoff= DISABLE; } + | ENABLE_SYM KEYS { Lex->alter_info.keys_onoff= ENABLE; } | ALTER opt_column field_ident SET DEFAULT signed_literal { LEX *lex=Lex; - lex->alter_list.push_back(new Alter_column($3.str,$6)); - lex->simple_alter=0; - lex->alter_flags|= ALTER_CHANGE_COLUMN; + lex->alter_info.alter_list.push_back(new Alter_column($3.str,$6)); + lex->alter_info.is_simple= 0; + lex->alter_info.flags|= ALTER_CHANGE_COLUMN; } | ALTER opt_column field_ident DROP DEFAULT { LEX *lex=Lex; - lex->alter_list.push_back(new Alter_column($3.str,(Item*) 0)); - lex->simple_alter=0; - lex->alter_flags|= ALTER_CHANGE_COLUMN; + lex->alter_info.alter_list.push_back(new Alter_column($3.str, + (Item*) 0)); + lex->alter_info.is_simple= 0; + lex->alter_info.flags|= ALTER_CHANGE_COLUMN; } | RENAME opt_to table_ident { LEX *lex=Lex; lex->select_lex.db=$3->db.str; lex->name= $3->table.str; - lex->alter_flags|= ALTER_RENAME; + lex->alter_info.flags|= ALTER_RENAME; } | CONVERT_SYM TO_SYM charset charset_name_or_default opt_collate { @@ -2961,19 +2958,19 @@ alter_list_item: lex->create_info.default_table_charset= $5; lex->create_info.used_fields|= (HA_CREATE_USED_CHARSET | HA_CREATE_USED_DEFAULT_CHARSET); - lex->simple_alter= 0; + lex->alter_info.is_simple= 0; } | create_table_options_space_separated { LEX *lex=Lex; - lex->simple_alter=0; - lex->alter_flags|= ALTER_OPTIONS; + lex->alter_info.is_simple= 0; + lex->alter_info.flags|= ALTER_OPTIONS; } | order_clause { LEX *lex=Lex; - lex->simple_alter=0; - lex->alter_flags|= ALTER_ORDER; + lex->alter_info.is_simple= 0; + lex->alter_info.flags|= ALTER_ORDER; }; opt_column: @@ -3387,17 +3384,19 @@ select_part2: select_into: opt_limit_clause {} - | FROM DUAL_SYM /* oracle compatibility: oracle always requires FROM - clause, and DUAL is system table without fields. - Is "SELECT 1 FROM DUAL" any better than - "SELECT 1" ? Hmmm :) */ | 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 join_table_list where_clause group_clause having_clause + opt_order_clause opt_limit_clause procedure_clause + | FROM DUAL_SYM /* oracle compatibility: oracle always requires FROM + clause, and DUAL is system table without fields. + Is "SELECT 1 FROM DUAL" any better than + "SELECT 1" ? Hmmm :) */ + ; select_options: /* empty*/ @@ -4828,18 +4827,20 @@ delete_limit_clause: }; ULONG_NUM: - NUM { $$= strtoul($1.str,NULL,10); } - | LONG_NUM { $$= (ulong) strtoll($1.str,NULL,10); } - | ULONGLONG_NUM { $$= (ulong) strtoull($1.str,NULL,10); } - | REAL_NUM { $$= strtoul($1.str,NULL,10); } - | FLOAT_NUM { $$= strtoul($1.str,NULL,10); }; + NUM { int error; $$= (ulong) my_strtoll10($1.str, (char**) 0, &error); } + | LONG_NUM { int error; $$= (ulong) my_strtoll10($1.str, (char**) 0, &error); } + | ULONGLONG_NUM { int error; $$= (ulong) my_strtoll10($1.str, (char**) 0, &error); } + | REAL_NUM { int error; $$= (ulong) my_strtoll10($1.str, (char**) 0, &error); } + | FLOAT_NUM { int error; $$= (ulong) my_strtoll10($1.str, (char**) 0, &error); } + ; ulonglong_num: - NUM { $$= (ulonglong) strtoul($1.str,NULL,10); } - | ULONGLONG_NUM { $$= strtoull($1.str,NULL,10); } - | LONG_NUM { $$= (ulonglong) strtoll($1.str,NULL,10); } - | REAL_NUM { $$= strtoull($1.str,NULL,10); } - | FLOAT_NUM { $$= strtoull($1.str,NULL,10); }; + NUM { int error; $$= (ulonglong) my_strtoll10($1.str, (char**) 0, &error); } + | ULONGLONG_NUM { int error; $$= (ulonglong) my_strtoll10($1.str, (char**) 0, &error); } + | LONG_NUM { int error; $$= (ulonglong) my_strtoll10($1.str, (char**) 0, &error); } + | REAL_NUM { int error; $$= (ulonglong) my_strtoll10($1.str, (char**) 0, &error); } + | FLOAT_NUM { int error; $$= (ulonglong) my_strtoll10($1.str, (char**) 0, &error); } + ; procedure_clause: /* empty */ @@ -4990,9 +4991,9 @@ drop: { LEX *lex=Lex; lex->sql_command= SQLCOM_DROP_INDEX; - lex->drop_list.empty(); - lex->drop_list.push_back(new Alter_drop(Alter_drop::KEY, - $3.str)); + lex->alter_info.drop_list.empty(); + lex->alter_info.drop_list.push_back(new Alter_drop(Alter_drop::KEY, + $3.str)); if (!lex->current_select->add_table_to_list(lex->thd, $5, NULL, TL_OPTION_UPDATING)) YYABORT; @@ -5927,8 +5928,8 @@ literal: | TIMESTAMP text_literal { $$ = $2; }; NUM_literal: - NUM { $$ = new Item_int($1.str, (longlong) strtol($1.str, NULL, 10),$1.length); } - | LONG_NUM { $$ = new Item_int($1.str, (longlong) strtoll($1.str,NULL,10), $1.length); } + NUM { int error; $$ = new Item_int($1.str, (longlong) my_strtoll10($1.str, NULL, &error), $1.length); } + | LONG_NUM { int error; $$ = new Item_int($1.str, (longlong) my_strtoll10($1.str, NULL, &error), $1.length); } | ULONGLONG_NUM { $$ = new Item_uint($1.str, $1.length); } | REAL_NUM { $$ = new Item_real($1.str, $1.length); } | FLOAT_NUM { $$ = new Item_float($1.str, $1.length); } @@ -6207,7 +6208,6 @@ keyword: | DIRECTORY_SYM {} | DISCARD {} | DO_SYM {} - | DUAL_SYM {} | DUMPFILE {} | DUPLICATE_SYM {} | DYNAMIC_SYM {} |