Introduced parameter object "ALTER_INFO" for mysql_alter_table

to make list of parameters in mysql_alter_table shorted
to avoid warning in MSVC (windows) building 
parent 98c10ced
...@@ -519,13 +519,10 @@ int mysql_alter_table(THD *thd, char *new_db, char *new_name, ...@@ -519,13 +519,10 @@ int mysql_alter_table(THD *thd, char *new_db, char *new_name,
HA_CREATE_INFO *create_info, HA_CREATE_INFO *create_info,
TABLE_LIST *table_list, TABLE_LIST *table_list,
List<create_field> &fields, List<create_field> &fields,
List<Key> &keys,List<Alter_drop> &drop_list, List<Key> &keys,
List<Alter_column> &alter_list, uint order_num, ORDER *order,
uint order_num, ORDER *order, uint alter_flags,
enum enum_duplicates handle_duplicates, enum enum_duplicates handle_duplicates,
enum enum_enable_or_disable keys_onoff=LEAVE_AS_IS, ALTER_INFO *alter_info);
enum tablespace_op_type tablespace_op=NO_TABLESPACE_OP,
bool simple_alter=0);
int mysql_create_like_table(THD *thd, TABLE_LIST *table, int mysql_create_like_table(THD *thd, TABLE_LIST *table,
HA_CREATE_INFO *create_info, HA_CREATE_INFO *create_info,
Table_ident *src_table); Table_ident *src_table);
...@@ -536,7 +533,7 @@ bool mysql_rename_table(enum db_type base, ...@@ -536,7 +533,7 @@ bool mysql_rename_table(enum db_type base,
const char * new_name); const char * new_name);
int mysql_create_index(THD *thd, TABLE_LIST *table_list, List<Key> &keys); int mysql_create_index(THD *thd, TABLE_LIST *table_list, List<Key> &keys);
int mysql_drop_index(THD *thd, TABLE_LIST *table_list, int mysql_drop_index(THD *thd, TABLE_LIST *table_list,
List<Alter_drop> &drop_list); ALTER_INFO *alter_info);
int mysql_prepare_update(THD *thd, TABLE_LIST *table_list, int mysql_prepare_update(THD *thd, TABLE_LIST *table_list,
TABLE_LIST *update_table_list, TABLE_LIST *update_table_list,
Item **conds, uint order_num, ORDER *order); Item **conds, uint order_num, ORDER *order);
......
...@@ -532,6 +532,20 @@ typedef class st_select_lex SELECT_LEX; ...@@ -532,6 +532,20 @@ typedef class st_select_lex SELECT_LEX;
#define ALTER_ORDER 64 #define ALTER_ORDER 64
#define ALTER_OPTIONS 128 #define ALTER_OPTIONS 128
typedef struct st_alter_info
{
List<Alter_drop> drop_list;
List<Alter_column> alter_list;
uint flags;
enum enum_enable_or_disable keys_onoff;
enum tablespace_op_type tablespace_op;
bool is_simple;
st_alter_info(){clear();}
void clear(){keys_onoff= LEAVE_AS_IS;tablespace_op= NO_TABLESPACE_OP;}
void reset(){drop_list.empty();alter_list.empty();clear();}
} ALTER_INFO;
/* The state of the lex parsing. This is saved in the THD struct */ /* The state of the lex parsing. This is saved in the THD struct */
typedef struct st_lex typedef struct st_lex
...@@ -564,8 +578,6 @@ typedef struct st_lex ...@@ -564,8 +578,6 @@ typedef struct st_lex
List<key_part_spec> col_list; List<key_part_spec> col_list;
List<key_part_spec> ref_list; List<key_part_spec> ref_list;
List<Alter_drop> drop_list;
List<Alter_column> alter_list;
List<String> interval_list; List<String> interval_list;
List<LEX_USER> users_list; List<LEX_USER> users_list;
List<LEX_COLUMN> columns; List<LEX_COLUMN> columns;
...@@ -593,19 +605,17 @@ typedef struct st_lex ...@@ -593,19 +605,17 @@ typedef struct st_lex
enum enum_tx_isolation tx_isolation; enum enum_tx_isolation tx_isolation;
enum enum_ha_read_modes ha_read_mode; enum enum_ha_read_modes ha_read_mode;
enum ha_rkey_function ha_rkey_mode; enum ha_rkey_function ha_rkey_mode;
enum enum_enable_or_disable alter_keys_onoff;
enum enum_var_type option_type; enum enum_var_type option_type;
enum tablespace_op_type tablespace_op;
uint uint_geom_type; uint uint_geom_type;
uint grant, grant_tot_col, which_columns; uint grant, grant_tot_col, which_columns;
uint fk_delete_opt, fk_update_opt, fk_match_option; uint fk_delete_opt, fk_update_opt, fk_match_option;
uint slave_thd_opt; uint slave_thd_opt;
uint alter_flags;
uint8 describe; uint8 describe;
bool drop_if_exists, drop_temporary, local_file; bool drop_if_exists, drop_temporary, local_file;
bool in_comment, ignore_space, verbose, simple_alter, no_write_to_binlog; bool in_comment, ignore_space, verbose, no_write_to_binlog;
bool derived_tables; bool derived_tables;
bool safe_to_cache_query; bool safe_to_cache_query;
ALTER_INFO alter_info;
st_lex() {} st_lex() {}
inline void uncacheable(uint8 cause) inline void uncacheable(uint8 cause)
{ {
......
...@@ -2368,14 +2368,10 @@ unsent_create_error: ...@@ -2368,14 +2368,10 @@ unsent_create_error:
res= mysql_alter_table(thd, select_lex->db, lex->name, res= mysql_alter_table(thd, select_lex->db, lex->name,
&lex->create_info, &lex->create_info,
tables, lex->create_list, tables, lex->create_list,
lex->key_list, lex->drop_list, lex->alter_list, lex->key_list,
select_lex->order_list.elements, select_lex->order_list.elements,
(ORDER *) select_lex->order_list.first, (ORDER *) select_lex->order_list.first,
lex->alter_flags, lex->duplicates, &lex->alter_info);
lex->duplicates,
lex->alter_keys_onoff,
lex->tablespace_op,
lex->simple_alter);
} }
break; break;
} }
...@@ -2514,17 +2510,15 @@ unsent_create_error: ...@@ -2514,17 +2510,15 @@ unsent_create_error:
lex->create_list.empty(); lex->create_list.empty();
lex->key_list.empty(); lex->key_list.empty();
lex->col_list.empty(); lex->col_list.empty();
lex->drop_list.empty(); lex->alter_info.reset();
lex->alter_list.empty();
bzero((char*) &create_info,sizeof(create_info)); bzero((char*) &create_info,sizeof(create_info));
create_info.db_type=DB_TYPE_DEFAULT; create_info.db_type=DB_TYPE_DEFAULT;
create_info.row_type=ROW_TYPE_DEFAULT; create_info.row_type=ROW_TYPE_DEFAULT;
create_info.default_table_charset=default_charset_info; create_info.default_table_charset=default_charset_info;
res= mysql_alter_table(thd, NullS, NullS, &create_info, res= mysql_alter_table(thd, NullS, NullS, &create_info,
tables, lex->create_list, tables, lex->create_list,
lex->key_list, lex->drop_list, lex->alter_list, lex->key_list, 0, (ORDER *) 0,
0, (ORDER *) 0, 0, DUP_ERROR, &lex->alter_info);
DUP_ERROR);
} }
else else
res = mysql_optimize_table(thd, tables, &lex->check_opt); res = mysql_optimize_table(thd, tables, &lex->check_opt);
...@@ -2754,7 +2748,7 @@ unsent_create_error: ...@@ -2754,7 +2748,7 @@ unsent_create_error:
if (end_active_trans(thd)) if (end_active_trans(thd))
res= -1; res= -1;
else else
res = mysql_drop_index(thd, tables, lex->drop_list); res = mysql_drop_index(thd, tables, &lex->alter_info);
break; break;
case SQLCOM_SHOW_DATABASES: case SQLCOM_SHOW_DATABASES:
#if defined(DONT_ALLOW_SHOW_COMMANDS) #if defined(DONT_ALLOW_SHOW_COMMANDS)
...@@ -4903,8 +4897,9 @@ Item * all_any_subquery_creator(Item *left_expr, ...@@ -4903,8 +4897,9 @@ Item * all_any_subquery_creator(Item *left_expr,
int mysql_create_index(THD *thd, TABLE_LIST *table_list, List<Key> &keys) int mysql_create_index(THD *thd, TABLE_LIST *table_list, List<Key> &keys)
{ {
List<create_field> fields; List<create_field> fields;
List<Alter_drop> drop; ALTER_INFO alter_info;
List<Alter_column> alter; alter_info.flags= ALTER_ADD_INDEX;
alter_info.is_simple= 0;
HA_CREATE_INFO create_info; HA_CREATE_INFO create_info;
DBUG_ENTER("mysql_create_index"); DBUG_ENTER("mysql_create_index");
bzero((char*) &create_info,sizeof(create_info)); bzero((char*) &create_info,sizeof(create_info));
...@@ -4912,25 +4907,27 @@ int mysql_create_index(THD *thd, TABLE_LIST *table_list, List<Key> &keys) ...@@ -4912,25 +4907,27 @@ int mysql_create_index(THD *thd, TABLE_LIST *table_list, List<Key> &keys)
create_info.default_table_charset= thd->variables.collation_database; create_info.default_table_charset= thd->variables.collation_database;
DBUG_RETURN(mysql_alter_table(thd,table_list->db,table_list->real_name, DBUG_RETURN(mysql_alter_table(thd,table_list->db,table_list->real_name,
&create_info, table_list, &create_info, table_list,
fields, keys, drop, alter, 0, (ORDER*)0, fields, keys, 0, (ORDER*)0,
ALTER_ADD_INDEX, DUP_ERROR)); DUP_ERROR, &alter_info));
} }
int mysql_drop_index(THD *thd, TABLE_LIST *table_list, List<Alter_drop> &drop) int mysql_drop_index(THD *thd, TABLE_LIST *table_list, ALTER_INFO *alter_info)
{ {
List<create_field> fields; List<create_field> fields;
List<Key> keys; List<Key> keys;
List<Alter_column> alter;
HA_CREATE_INFO create_info; HA_CREATE_INFO create_info;
DBUG_ENTER("mysql_drop_index"); DBUG_ENTER("mysql_drop_index");
bzero((char*) &create_info,sizeof(create_info)); bzero((char*) &create_info,sizeof(create_info));
create_info.db_type=DB_TYPE_DEFAULT; create_info.db_type=DB_TYPE_DEFAULT;
create_info.default_table_charset= thd->variables.collation_database; create_info.default_table_charset= thd->variables.collation_database;
alter_info->clear();
alter_info->flags= ALTER_DROP_INDEX;
alter_info->is_simple= 0;
DBUG_RETURN(mysql_alter_table(thd,table_list->db,table_list->real_name, DBUG_RETURN(mysql_alter_table(thd,table_list->db,table_list->real_name,
&create_info, table_list, &create_info, table_list,
fields, keys, drop, alter, 0, (ORDER*)0, fields, keys, 0, (ORDER*)0,
ALTER_DROP_INDEX, DUP_ERROR)); DUP_ERROR, alter_info));
} }
......
...@@ -2467,14 +2467,10 @@ int mysql_drop_indexes(THD *thd, TABLE_LIST *table_list, ...@@ -2467,14 +2467,10 @@ int mysql_drop_indexes(THD *thd, TABLE_LIST *table_list,
int mysql_alter_table(THD *thd,char *new_db, char *new_name, int mysql_alter_table(THD *thd,char *new_db, char *new_name,
HA_CREATE_INFO *create_info, HA_CREATE_INFO *create_info,
TABLE_LIST *table_list, TABLE_LIST *table_list,
List<create_field> &fields, List<create_field> &fields, List<Key> &keys,
List<Key> &keys,List<Alter_drop> &drop_list, uint order_num, ORDER *order,
List<Alter_column> &alter_list,
uint order_num, ORDER *order, uint alter_flags,
enum enum_duplicates handle_duplicates, enum enum_duplicates handle_duplicates,
enum enum_enable_or_disable keys_onoff, ALTER_INFO *alter_info)
enum tablespace_op_type tablespace_op,
bool simple_alter)
{ {
TABLE *table,*new_table; TABLE *table,*new_table;
int error; int error;
...@@ -2499,9 +2495,9 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, ...@@ -2499,9 +2495,9 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
mysql_ha_closeall(thd, table_list); mysql_ha_closeall(thd, table_list);
/* DISCARD/IMPORT TABLESPACE is always alone in an ALTER TABLE */ /* DISCARD/IMPORT TABLESPACE is always alone in an ALTER TABLE */
if (tablespace_op != NO_TABLESPACE_OP) if (alter_info->tablespace_op != NO_TABLESPACE_OP)
DBUG_RETURN(mysql_discard_or_import_tablespace(thd,table_list, DBUG_RETURN(mysql_discard_or_import_tablespace(thd,table_list,
tablespace_op)); alter_info->tablespace_op));
if (!(table=open_ltable(thd,table_list,TL_WRITE_ALLOW_READ))) if (!(table=open_ltable(thd,table_list,TL_WRITE_ALLOW_READ)))
DBUG_RETURN(-1); DBUG_RETURN(-1);
...@@ -2570,7 +2566,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, ...@@ -2570,7 +2566,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
create_info->row_type=table->row_type; create_info->row_type=table->row_type;
thd->proc_info="setup"; thd->proc_info="setup";
if (simple_alter && !table->tmp_table) if (alter_info->is_simple && !table->tmp_table)
{ {
error=0; error=0;
if (new_name != table_name || new_db != db) if (new_name != table_name || new_db != db)
...@@ -2596,7 +2592,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, ...@@ -2596,7 +2592,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
if (!error) if (!error)
{ {
switch (keys_onoff) { switch (alter_info->keys_onoff) {
case LEAVE_AS_IS: case LEAVE_AS_IS:
break; break;
case ENABLE: case ENABLE:
...@@ -2656,9 +2652,9 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, ...@@ -2656,9 +2652,9 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
create_info->default_table_charset= table->table_charset; create_info->default_table_charset= table->table_charset;
restore_record(table,default_values); // Empty record for DEFAULT restore_record(table,default_values); // Empty record for DEFAULT
List_iterator<Alter_drop> drop_it(drop_list); List_iterator<Alter_drop> drop_it(alter_info->drop_list);
List_iterator<create_field> def_it(fields); List_iterator<create_field> def_it(fields);
List_iterator<Alter_column> alter_it(alter_list); List_iterator<Alter_column> alter_it(alter_info->alter_list);
List<create_field> create_list; // Add new fields here List<create_field> create_list; // Add new fields here
List<Key> key_list; // Add new keys here List<Key> key_list; // Add new keys here
create_field *def; create_field *def;
...@@ -2762,9 +2758,10 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, ...@@ -2762,9 +2758,10 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
find_it.after(def); // Put element after this find_it.after(def); // Put element after this
} }
} }
if (alter_list.elements) if (alter_info->alter_list.elements)
{ {
my_error(ER_BAD_FIELD_ERROR,MYF(0),alter_list.head()->name,table_name); my_error(ER_BAD_FIELD_ERROR,MYF(0),alter_info->alter_list.head()->name,
table_name);
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
if (!create_list.elements) if (!create_list.elements)
...@@ -2864,14 +2861,16 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, ...@@ -2864,14 +2861,16 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
} }
} }
if (drop_list.elements) if (alter_info->drop_list.elements)
{ {
my_error(ER_CANT_DROP_FIELD_OR_KEY,MYF(0),drop_list.head()->name); my_error(ER_CANT_DROP_FIELD_OR_KEY,MYF(0),
alter_info->drop_list.head()->name);
goto err; goto err;
} }
if (alter_list.elements) if (alter_info->alter_list.elements)
{ {
my_error(ER_CANT_DROP_FIELD_OR_KEY,MYF(0),alter_list.head()->name); my_error(ER_CANT_DROP_FIELD_OR_KEY,MYF(0),
alter_info->alter_list.head()->name);
goto err; goto err;
} }
......
...@@ -1459,25 +1459,25 @@ attribute: ...@@ -1459,25 +1459,25 @@ attribute:
{ {
LEX *lex=Lex; LEX *lex=Lex;
lex->type|= AUTO_INCREMENT_FLAG | NOT_NULL_FLAG | UNIQUE_FLAG; 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 | opt_primary KEY_SYM
{ {
LEX *lex=Lex; LEX *lex=Lex;
lex->type|= PRI_KEY_FLAG | NOT_NULL_FLAG; lex->type|= PRI_KEY_FLAG | NOT_NULL_FLAG;
lex->alter_flags|= ALTER_ADD_INDEX; lex->alter_info.flags|= ALTER_ADD_INDEX;
} }
| UNIQUE_SYM | UNIQUE_SYM
{ {
LEX *lex=Lex; LEX *lex=Lex;
lex->type|= UNIQUE_FLAG; lex->type|= UNIQUE_FLAG;
lex->alter_flags|= ALTER_ADD_INDEX; lex->alter_info.flags|= ALTER_ADD_INDEX;
} }
| UNIQUE_SYM KEY_SYM | UNIQUE_SYM KEY_SYM
{ {
LEX *lex=Lex; LEX *lex=Lex;
lex->type|= UNIQUE_KEY_FLAG; 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; } | COMMENT_SYM TEXT_STRING_sys { Lex->comment= &$2; }
| BINARY { Lex->type|= BINCMP_FLAG; } | BINARY { Lex->type|= BINCMP_FLAG; }
...@@ -1725,18 +1725,15 @@ alter: ...@@ -1725,18 +1725,15 @@ alter:
lex->create_list.empty(); lex->create_list.empty();
lex->key_list.empty(); lex->key_list.empty();
lex->col_list.empty(); lex->col_list.empty();
lex->drop_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.default_table_charset= thd->variables.collation_database; lex->create_info.default_table_charset= thd->variables.collation_database;
lex->create_info.row_type= ROW_TYPE_NOT_USED; lex->create_info.row_type= ROW_TYPE_NOT_USED;
lex->alter_keys_onoff=LEAVE_AS_IS; lex->alter_info.clear();
lex->tablespace_op=NO_TABLESPACE_OP; lex->alter_info.is_simple= 1;
lex->simple_alter=1; lex->alter_info.flags= 0;
lex->alter_flags=0;
} }
alter_list alter_list
{} {}
...@@ -1749,8 +1746,8 @@ alter: ...@@ -1749,8 +1746,8 @@ alter:
alter_list: alter_list:
| DISCARD TABLESPACE { Lex->tablespace_op=DISCARD_TABLESPACE; } | DISCARD TABLESPACE { Lex->alter_info.tablespace_op= DISCARD_TABLESPACE; }
| IMPORT TABLESPACE { Lex->tablespace_op=IMPORT_TABLESPACE; } | IMPORT TABLESPACE { Lex->alter_info.tablespace_op= IMPORT_TABLESPACE; }
| alter_list_item | alter_list_item
| alter_list ',' alter_list_item; | alter_list ',' alter_list_item;
...@@ -1759,24 +1756,24 @@ add_column: ...@@ -1759,24 +1756,24 @@ add_column:
{ {
LEX *lex=Lex; LEX *lex=Lex;
lex->change=0; lex->change=0;
lex->alter_flags|= ALTER_ADD_COLUMN; lex->alter_info.flags|= ALTER_ADD_COLUMN;
}; };
alter_list_item: 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 | ADD key_def
{ {
LEX *lex=Lex; LEX *lex=Lex;
lex->simple_alter=0; lex->alter_info.is_simple= 0;
lex->alter_flags|= ALTER_ADD_INDEX; 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 | CHANGE opt_column field_ident
{ {
LEX *lex=Lex; LEX *lex=Lex;
lex->change= $3.str; lex->change= $3.str;
lex->simple_alter=0; lex->alter_info.is_simple= 0;
lex->alter_flags|= ALTER_CHANGE_COLUMN; lex->alter_info.flags|= ALTER_CHANGE_COLUMN;
} }
field_spec opt_place field_spec opt_place
| MODIFY_SYM opt_column field_ident | MODIFY_SYM opt_column field_ident
...@@ -1786,8 +1783,8 @@ alter_list_item: ...@@ -1786,8 +1783,8 @@ alter_list_item:
lex->default_value= lex->on_update_value= 0; lex->default_value= lex->on_update_value= 0;
lex->comment=0; lex->comment=0;
lex->charset= NULL; lex->charset= NULL;
lex->simple_alter=0; lex->alter_info.is_simple= 0;
lex->alter_flags|= ALTER_CHANGE_COLUMN; lex->alter_info.flags|= ALTER_CHANGE_COLUMN;
} }
type opt_attribute type opt_attribute
{ {
...@@ -1805,50 +1802,51 @@ alter_list_item: ...@@ -1805,50 +1802,51 @@ alter_list_item:
| DROP opt_column field_ident opt_restrict | DROP opt_column field_ident opt_restrict
{ {
LEX *lex=Lex; LEX *lex=Lex;
lex->drop_list.push_back(new Alter_drop(Alter_drop::COLUMN, lex->alter_info.drop_list.push_back(new Alter_drop(Alter_drop::COLUMN,
$3.str)); $3.str));
lex->simple_alter=0; lex->alter_info.is_simple= 0;
lex->alter_flags|= ALTER_DROP_COLUMN; 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 | DROP PRIMARY_SYM KEY_SYM
{ {
LEX *lex=Lex; LEX *lex=Lex;
lex->drop_list.push_back(new Alter_drop(Alter_drop::KEY, lex->alter_info.drop_list.push_back(new Alter_drop(Alter_drop::KEY,
primary_key_name)); primary_key_name));
lex->simple_alter=0; lex->alter_info.is_simple= 0;
lex->alter_flags|= ALTER_DROP_INDEX; lex->alter_info.flags|= ALTER_DROP_INDEX;
} }
| DROP key_or_index field_ident | DROP key_or_index field_ident
{ {
LEX *lex=Lex; LEX *lex=Lex;
lex->drop_list.push_back(new Alter_drop(Alter_drop::KEY, lex->alter_info.drop_list.push_back(new Alter_drop(Alter_drop::KEY,
$3.str)); $3.str));
lex->simple_alter=0; lex->alter_info.is_simple= 0;
lex->alter_flags|= ALTER_DROP_INDEX; lex->alter_info.flags|= ALTER_DROP_INDEX;
} }
| DISABLE_SYM KEYS { Lex->alter_keys_onoff=DISABLE; } | DISABLE_SYM KEYS { Lex->alter_info.keys_onoff= DISABLE; }
| ENABLE_SYM KEYS { Lex->alter_keys_onoff=ENABLE; } | ENABLE_SYM KEYS { Lex->alter_info.keys_onoff= ENABLE; }
| ALTER opt_column field_ident SET DEFAULT signed_literal | ALTER opt_column field_ident SET DEFAULT signed_literal
{ {
LEX *lex=Lex; LEX *lex=Lex;
lex->alter_list.push_back(new Alter_column($3.str,$6)); lex->alter_info.alter_list.push_back(new Alter_column($3.str,$6));
lex->simple_alter=0; lex->alter_info.is_simple= 0;
lex->alter_flags|= ALTER_CHANGE_COLUMN; lex->alter_info.flags|= ALTER_CHANGE_COLUMN;
} }
| ALTER opt_column field_ident DROP DEFAULT | ALTER opt_column field_ident DROP DEFAULT
{ {
LEX *lex=Lex; LEX *lex=Lex;
lex->alter_list.push_back(new Alter_column($3.str,(Item*) 0)); lex->alter_info.alter_list.push_back(new Alter_column($3.str,
lex->simple_alter=0; (Item*) 0));
lex->alter_flags|= ALTER_CHANGE_COLUMN; lex->alter_info.is_simple= 0;
lex->alter_info.flags|= ALTER_CHANGE_COLUMN;
} }
| RENAME opt_to table_ident | RENAME opt_to table_ident
{ {
LEX *lex=Lex; LEX *lex=Lex;
lex->select_lex.db=$3->db.str; lex->select_lex.db=$3->db.str;
lex->name= $3->table.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 | CONVERT_SYM TO_SYM charset charset_name_or_default opt_collate
{ {
...@@ -1869,19 +1867,19 @@ alter_list_item: ...@@ -1869,19 +1867,19 @@ alter_list_item:
lex->create_info.default_table_charset= $5; lex->create_info.default_table_charset= $5;
lex->create_info.used_fields|= (HA_CREATE_USED_CHARSET | lex->create_info.used_fields|= (HA_CREATE_USED_CHARSET |
HA_CREATE_USED_DEFAULT_CHARSET); HA_CREATE_USED_DEFAULT_CHARSET);
lex->simple_alter= 0; lex->alter_info.is_simple= 0;
} }
| create_table_options_space_separated | create_table_options_space_separated
{ {
LEX *lex=Lex; LEX *lex=Lex;
lex->simple_alter=0; lex->alter_info.is_simple= 0;
lex->alter_flags|= ALTER_OPTIONS; lex->alter_info.flags|= ALTER_OPTIONS;
} }
| order_clause | order_clause
{ {
LEX *lex=Lex; LEX *lex=Lex;
lex->simple_alter=0; lex->alter_info.is_simple= 0;
lex->alter_flags|= ALTER_ORDER; lex->alter_info.flags|= ALTER_ORDER;
}; };
opt_column: opt_column:
...@@ -3780,9 +3778,9 @@ drop: ...@@ -3780,9 +3778,9 @@ drop:
{ {
LEX *lex=Lex; LEX *lex=Lex;
lex->sql_command= SQLCOM_DROP_INDEX; lex->sql_command= SQLCOM_DROP_INDEX;
lex->drop_list.empty(); lex->alter_info.drop_list.empty();
lex->drop_list.push_back(new Alter_drop(Alter_drop::KEY, lex->alter_info.drop_list.push_back(new Alter_drop(Alter_drop::KEY,
$3.str)); $3.str));
if (!lex->current_select->add_table_to_list(lex->thd, $5, NULL, if (!lex->current_select->add_table_to_list(lex->thd, $5, NULL,
TL_OPTION_UPDATING)) TL_OPTION_UPDATING))
YYABORT; YYABORT;
......
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