mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 20:42:30 +01:00
Hand-resolved auto merge
This commit is contained in:
commit
4de7e18b81
9 changed files with 1057 additions and 597 deletions
|
@ -250,6 +250,7 @@ client/thimble
|
|||
client/thread_test
|
||||
client_test
|
||||
cmd-line-utils/libedit/common.h
|
||||
cmd-line-utils/libedit/makelist
|
||||
comon.h
|
||||
config.cache
|
||||
config.h
|
||||
|
@ -300,6 +301,7 @@ innobase/ib_config.h
|
|||
innobase/ib_config.h.in
|
||||
innobase/stamp-h1
|
||||
insert_test
|
||||
install
|
||||
isam/isamchk
|
||||
isam/isamlog
|
||||
isam/pack_isam
|
||||
|
@ -504,6 +506,7 @@ mysys/main.cc
|
|||
mysys/ste5KbMa
|
||||
mysys/test_charset
|
||||
mysys/test_dir
|
||||
mysys/test_gethwaddr
|
||||
mysys/test_io_cache
|
||||
mysys/test_thr_alarm
|
||||
mysys/test_thr_lock
|
||||
|
@ -646,5 +649,3 @@ vio/test-ssl
|
|||
vio/test-sslclient
|
||||
vio/test-sslserver
|
||||
vio/viotest-ssl
|
||||
mysys/test_gethwaddr
|
||||
cmd-line-utils/libedit/makelist
|
||||
|
|
|
@ -90,6 +90,20 @@
|
|||
#define HA_NOT_READ_PREFIX_LAST 32 /* No support for index_read_last() */
|
||||
#define HA_KEY_READ_ONLY 64 /* Support HA_EXTRA_KEYREAD */
|
||||
|
||||
|
||||
/*
|
||||
Bits in index_ddl_flags(KEY *wanted_index)
|
||||
for what ddl you can do with index
|
||||
If none is set, the wanted type of index is not supported
|
||||
by the handler at all. See WorkLog 1563.
|
||||
*/
|
||||
#define HA_DDL_SUPPORT 1 /* Supported by handler */
|
||||
#define HA_DDL_WITH_LOCK 2 /* Can create/drop with locked table */
|
||||
#define HA_DDL_ONLINE 4 /* Can create/drop without lock */
|
||||
|
||||
/* Return value for ddl methods */
|
||||
#define HA_DDL_NOT_IMPLEMENTED -1
|
||||
|
||||
/*
|
||||
Parameters for open() (in register form->filestat)
|
||||
HA_GET_INFO does an implicit HA_ABORT_IF_LOCKED
|
||||
|
@ -355,6 +369,20 @@ public:
|
|||
{
|
||||
return (HA_READ_NEXT | HA_READ_PREV | HA_READ_ORDER | HA_KEY_READ_ONLY);
|
||||
}
|
||||
virtual ulong index_ddl_flags(KEY *wanted_index) const
|
||||
{
|
||||
return (HA_DDL_SUPPORT);
|
||||
}
|
||||
virtual int add_index(TABLE *table, KEY *key_info, uint num_of_keys)
|
||||
{
|
||||
my_error(ER_NOT_SUPPORTED_YET, MYF(0), "online add index");
|
||||
return (HA_DDL_NOT_IMPLEMENTED);
|
||||
}
|
||||
virtual int drop_index(TABLE *table, uint *key_num, uint num_of_keys)
|
||||
{
|
||||
my_error(ER_NOT_SUPPORTED_YET, MYF(0), "online drop index");
|
||||
return (HA_DDL_NOT_IMPLEMENTED);
|
||||
}
|
||||
virtual uint max_record_length() const =0;
|
||||
virtual uint max_keys() const =0;
|
||||
virtual uint max_key_parts() const =0;
|
||||
|
|
|
@ -488,6 +488,11 @@ int mysql_handle_derived(LEX *lex);
|
|||
Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
|
||||
Item ***copy_func, Field **from_field,
|
||||
bool group,bool modify_item);
|
||||
int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
|
||||
List<create_field> &fields,
|
||||
List<Key> &keys, uint &db_options,
|
||||
handler *file, KEY *&key_info_buffer,
|
||||
uint &key_count, int select_field_count);
|
||||
int mysql_create_table(THD *thd,const char *db, const char *table_name,
|
||||
HA_CREATE_INFO *create_info,
|
||||
List<create_field> &fields, List<Key> &keys,
|
||||
|
@ -504,11 +509,23 @@ int mysql_alter_table(THD *thd, char *new_db, char *new_name,
|
|||
List<create_field> &fields,
|
||||
List<Key> &keys,List<Alter_drop> &drop_list,
|
||||
List<Alter_column> &alter_list,
|
||||
uint order_num, ORDER *order,
|
||||
uint order_num, ORDER *order, int alter_flags,
|
||||
enum enum_duplicates handle_duplicates,
|
||||
enum enum_enable_or_disable keys_onoff=LEAVE_AS_IS,
|
||||
enum tablespace_op_type tablespace_op=NO_TABLESPACE_OP,
|
||||
bool simple_alter=0);
|
||||
int real_alter_table(THD *thd, char *new_db, char *new_name,
|
||||
HA_CREATE_INFO *create_info,
|
||||
TABLE_LIST *table_list,
|
||||
TABLE *table,
|
||||
List<create_field> &fields,
|
||||
List<Key> &keys,List<Alter_drop> &drop_list,
|
||||
List<Alter_column> &alter_list,
|
||||
uint order_num, ORDER *order, int alter_flags,
|
||||
enum enum_duplicates handle_duplicates,
|
||||
enum enum_enable_or_disable keys_onoff=LEAVE_AS_IS,
|
||||
enum tablespace_op_type tablespace_op=NO_TABLESPACE_OP,
|
||||
bool simple_alter=0);
|
||||
int mysql_create_like_table(THD *thd, TABLE_LIST *table,
|
||||
HA_CREATE_INFO *create_info,
|
||||
Table_ident *src_table);
|
||||
|
@ -520,6 +537,10 @@ bool mysql_rename_table(enum db_type base,
|
|||
int mysql_create_index(THD *thd, TABLE_LIST *table_list, List<Key> &keys);
|
||||
int mysql_drop_index(THD *thd, TABLE_LIST *table_list,
|
||||
List<Alter_drop> &drop_list);
|
||||
int mysql_add_column(THD *thd, TABLE_LIST *table_list,
|
||||
List<create_field> &fields);
|
||||
int mysql_drop_column(THD *thd, TABLE_LIST *table_list,
|
||||
List<Alter_drop> &drop_list);
|
||||
int mysql_update(THD *thd,TABLE_LIST *tables,List<Item> &fields,
|
||||
List<Item> &values,COND *conds,
|
||||
uint order_num, ORDER *order, ha_rows limit,
|
||||
|
@ -923,6 +944,9 @@ void unlock_table_names(THD *thd, TABLE_LIST *table_list,
|
|||
|
||||
void unireg_init(ulong options);
|
||||
void unireg_end(void);
|
||||
int mysql_create_frm(THD *thd, my_string file_name,HA_CREATE_INFO *create_info,
|
||||
List<create_field> &create_field,
|
||||
uint key_count,KEY *key_info,handler *db_type);
|
||||
int rea_create_table(THD *thd, my_string file_name,HA_CREATE_INFO *create_info,
|
||||
List<create_field> &create_field,
|
||||
uint key_count,KEY *key_info);
|
||||
|
|
|
@ -2604,45 +2604,6 @@ static void mysql_rm_tmp_tables(void)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
CREATE INDEX and DROP INDEX are implemented by calling ALTER TABLE with
|
||||
the proper arguments. This isn't very fast but it should work for most
|
||||
cases.
|
||||
One should normally create all indexes with CREATE TABLE or ALTER TABLE.
|
||||
*/
|
||||
|
||||
int mysql_create_index(THD *thd, TABLE_LIST *table_list, List<Key> &keys)
|
||||
{
|
||||
List<create_field> fields;
|
||||
List<Alter_drop> drop;
|
||||
List<Alter_column> alter;
|
||||
HA_CREATE_INFO create_info;
|
||||
DBUG_ENTER("mysql_create_index");
|
||||
bzero((char*) &create_info,sizeof(create_info));
|
||||
create_info.db_type=DB_TYPE_DEFAULT;
|
||||
create_info.default_table_charset= thd->variables.collation_database;
|
||||
DBUG_RETURN(mysql_alter_table(thd,table_list->db,table_list->real_name,
|
||||
&create_info, table_list,
|
||||
fields, keys, drop, alter, 0, (ORDER*)0,
|
||||
DUP_ERROR));
|
||||
}
|
||||
|
||||
|
||||
int mysql_drop_index(THD *thd, TABLE_LIST *table_list, List<Alter_drop> &drop)
|
||||
{
|
||||
List<create_field> fields;
|
||||
List<Key> keys;
|
||||
List<Alter_column> alter;
|
||||
HA_CREATE_INFO create_info;
|
||||
DBUG_ENTER("mysql_drop_index");
|
||||
bzero((char*) &create_info,sizeof(create_info));
|
||||
create_info.db_type=DB_TYPE_DEFAULT;
|
||||
create_info.default_table_charset= thd->variables.collation_database;
|
||||
DBUG_RETURN(mysql_alter_table(thd,table_list->db,table_list->real_name,
|
||||
&create_info, table_list,
|
||||
fields, keys, drop, alter, 0, (ORDER*)0,
|
||||
DUP_ERROR));
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
unireg support functions
|
||||
|
|
|
@ -509,6 +509,14 @@ public:
|
|||
};
|
||||
typedef class st_select_lex SELECT_LEX;
|
||||
|
||||
#define ALTER_ADD_COLUMN 1
|
||||
#define ALTER_DROP_COLUMN 2
|
||||
#define ALTER_CHANGE_COLUMN 4
|
||||
#define ALTER_ADD_INDEX 8
|
||||
#define ALTER_DROP_INDEX 16
|
||||
#define ALTER_RENAME 32
|
||||
#define ALTER_ORDER 64
|
||||
#define ALTER_OPTIONS 128
|
||||
|
||||
/* The state of the lex parsing. This is saved in the THD struct */
|
||||
|
||||
|
@ -578,6 +586,7 @@ typedef struct st_lex
|
|||
uint grant, grant_tot_col, which_columns;
|
||||
uint fk_delete_opt, fk_update_opt, fk_match_option;
|
||||
uint slave_thd_opt;
|
||||
uint alter_flags;
|
||||
uint8 describe;
|
||||
bool drop_if_exists, drop_temporary, local_file;
|
||||
bool in_comment, ignore_space, verbose, simple_alter, no_write_to_binlog;
|
||||
|
|
|
@ -2391,6 +2391,7 @@ unsent_create_error:
|
|||
lex->key_list, lex->drop_list, lex->alter_list,
|
||||
select_lex->order_list.elements,
|
||||
(ORDER *) select_lex->order_list.first,
|
||||
lex->alter_flags,
|
||||
lex->duplicates,
|
||||
lex->alter_keys_onoff,
|
||||
lex->tablespace_op,
|
||||
|
@ -2541,7 +2542,7 @@ unsent_create_error:
|
|||
res= mysql_alter_table(thd, NullS, NullS, &create_info,
|
||||
tables, lex->create_list,
|
||||
lex->key_list, lex->drop_list, lex->alter_list,
|
||||
0, (ORDER *) 0,
|
||||
0, (ORDER *) 0, 0,
|
||||
DUP_ERROR);
|
||||
}
|
||||
else
|
||||
|
|
1445
sql/sql_table.cc
1445
sql/sql_table.cc
File diff suppressed because it is too large
Load diff
|
@ -1439,10 +1439,29 @@ attribute:
|
|||
{ Lex->on_update_value= new Item_func_now_local(); }
|
||||
| AUTO_INC { Lex->type|= AUTO_INCREMENT_FLAG | NOT_NULL_FLAG; }
|
||||
| SERIAL_SYM DEFAULT VALUE_SYM
|
||||
{ Lex->type|= AUTO_INCREMENT_FLAG | NOT_NULL_FLAG | UNIQUE_FLAG; }
|
||||
| opt_primary KEY_SYM { Lex->type|= PRI_KEY_FLAG | NOT_NULL_FLAG; }
|
||||
| UNIQUE_SYM { Lex->type|= UNIQUE_FLAG; }
|
||||
| UNIQUE_SYM KEY_SYM { Lex->type|= UNIQUE_KEY_FLAG; }
|
||||
{
|
||||
LEX *lex=Lex;
|
||||
lex->type|= AUTO_INCREMENT_FLAG | NOT_NULL_FLAG | UNIQUE_FLAG;
|
||||
lex->alter_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;
|
||||
}
|
||||
| UNIQUE_SYM
|
||||
{
|
||||
LEX *lex=Lex;
|
||||
lex->type|= UNIQUE_FLAG;
|
||||
lex->alter_flags|= ALTER_ADD_INDEX;
|
||||
}
|
||||
| UNIQUE_SYM KEY_SYM
|
||||
{
|
||||
LEX *lex=Lex;
|
||||
lex->type|= UNIQUE_KEY_FLAG;
|
||||
lex->alter_flags|= ALTER_ADD_INDEX;
|
||||
}
|
||||
| COMMENT_SYM TEXT_STRING_sys { Lex->comment= &$2; }
|
||||
| BINARY { Lex->type|= BINCMP_FLAG; }
|
||||
| COLLATE_SYM collation_name
|
||||
|
@ -1700,6 +1719,7 @@ alter:
|
|||
lex->alter_keys_onoff=LEAVE_AS_IS;
|
||||
lex->tablespace_op=NO_TABLESPACE_OP;
|
||||
lex->simple_alter=1;
|
||||
lex->alter_flags=0;
|
||||
}
|
||||
alter_list
|
||||
{}
|
||||
|
@ -1718,16 +1738,28 @@ alter_list:
|
|||
| alter_list ',' alter_list_item;
|
||||
|
||||
add_column:
|
||||
ADD opt_column { Lex->change=0; };
|
||||
ADD opt_column
|
||||
{
|
||||
LEX *lex=Lex;
|
||||
lex->change=0;
|
||||
lex->alter_flags|= ALTER_ADD_COLUMN;
|
||||
};
|
||||
|
||||
alter_list_item:
|
||||
add_column column_def opt_place { Lex->simple_alter=0; }
|
||||
| ADD key_def { Lex->simple_alter=0; }
|
||||
| ADD key_def
|
||||
{
|
||||
LEX *lex=Lex;
|
||||
lex->simple_alter=0;
|
||||
lex->alter_flags|= ALTER_ADD_INDEX;
|
||||
}
|
||||
| add_column '(' field_list ')' { Lex->simple_alter=0; }
|
||||
| CHANGE opt_column field_ident
|
||||
{
|
||||
LEX *lex=Lex;
|
||||
lex->change= $3.str; lex->simple_alter=0;
|
||||
lex->change= $3.str;
|
||||
lex->simple_alter=0;
|
||||
lex->alter_flags|= ALTER_CHANGE_COLUMN;
|
||||
}
|
||||
field_spec opt_place
|
||||
| MODIFY_SYM opt_column field_ident
|
||||
|
@ -1738,6 +1770,7 @@ alter_list_item:
|
|||
lex->comment=0;
|
||||
lex->charset= NULL;
|
||||
lex->simple_alter=0;
|
||||
lex->alter_flags|= ALTER_CHANGE_COLUMN;
|
||||
}
|
||||
type opt_attribute
|
||||
{
|
||||
|
@ -1756,7 +1789,9 @@ alter_list_item:
|
|||
{
|
||||
LEX *lex=Lex;
|
||||
lex->drop_list.push_back(new Alter_drop(Alter_drop::COLUMN,
|
||||
$3.str)); lex->simple_alter=0;
|
||||
$3.str));
|
||||
lex->simple_alter=0;
|
||||
lex->alter_flags|= ALTER_DROP_COLUMN;
|
||||
}
|
||||
| DROP FOREIGN KEY_SYM opt_ident { Lex->simple_alter=0; }
|
||||
| DROP PRIMARY_SYM KEY_SYM
|
||||
|
@ -1765,6 +1800,7 @@ alter_list_item:
|
|||
lex->drop_list.push_back(new Alter_drop(Alter_drop::KEY,
|
||||
primary_key_name));
|
||||
lex->simple_alter=0;
|
||||
lex->alter_flags|= ALTER_DROP_INDEX;
|
||||
}
|
||||
| DROP key_or_index field_ident
|
||||
{
|
||||
|
@ -1772,6 +1808,7 @@ alter_list_item:
|
|||
lex->drop_list.push_back(new Alter_drop(Alter_drop::KEY,
|
||||
$3.str));
|
||||
lex->simple_alter=0;
|
||||
lex->alter_flags|= ALTER_DROP_INDEX;
|
||||
}
|
||||
| DISABLE_SYM KEYS { Lex->alter_keys_onoff=DISABLE; }
|
||||
| ENABLE_SYM KEYS { Lex->alter_keys_onoff=ENABLE; }
|
||||
|
@ -1780,18 +1817,21 @@ alter_list_item:
|
|||
LEX *lex=Lex;
|
||||
lex->alter_list.push_back(new Alter_column($3.str,$6));
|
||||
lex->simple_alter=0;
|
||||
lex->alter_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;
|
||||
}
|
||||
| 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;
|
||||
}
|
||||
| CONVERT_SYM TO_SYM charset charset_name_or_default opt_collate
|
||||
{
|
||||
|
@ -1814,8 +1854,18 @@ alter_list_item:
|
|||
HA_CREATE_USED_DEFAULT_CHARSET);
|
||||
lex->simple_alter= 0;
|
||||
}
|
||||
| create_table_options_space_separated { Lex->simple_alter=0; }
|
||||
| order_clause { Lex->simple_alter=0; };
|
||||
| create_table_options_space_separated
|
||||
{
|
||||
LEX *lex=Lex;
|
||||
lex->simple_alter=0;
|
||||
lex->alter_flags|= ALTER_OPTIONS;
|
||||
}
|
||||
| order_clause
|
||||
{
|
||||
LEX *lex=Lex;
|
||||
lex->simple_alter=0;
|
||||
lex->alter_flags|= ALTER_ORDER;
|
||||
};
|
||||
|
||||
opt_column:
|
||||
/* empty */ {}
|
||||
|
|
|
@ -47,10 +47,11 @@ static bool make_empty_rec(int file, enum db_type table_type,
|
|||
uint reclength,uint null_fields);
|
||||
|
||||
|
||||
int rea_create_table(THD *thd, my_string file_name,
|
||||
int mysql_create_frm(THD *thd, my_string file_name,
|
||||
HA_CREATE_INFO *create_info,
|
||||
List<create_field> &create_fields,
|
||||
uint keys, KEY *key_info)
|
||||
uint keys, KEY *key_info,
|
||||
handler *db_file)
|
||||
{
|
||||
uint reclength,info_length,screens,key_info_length,maxlength,null_fields;
|
||||
File file;
|
||||
|
@ -58,13 +59,13 @@ int rea_create_table(THD *thd, my_string file_name,
|
|||
uchar fileinfo[64],forminfo[288],*keybuff;
|
||||
TYPELIB formnames;
|
||||
uchar *screen_buff;
|
||||
handler *db_file;
|
||||
DBUG_ENTER("rea_create_table");
|
||||
|
||||
formnames.type_names=0;
|
||||
if (!(screen_buff=pack_screens(create_fields,&info_length,&screens,0)))
|
||||
DBUG_RETURN(1);
|
||||
db_file=get_new_handler((TABLE*) 0, create_info->db_type);
|
||||
if (db_file == NULL)
|
||||
db_file=get_new_handler((TABLE*) 0, create_info->db_type);
|
||||
if (pack_header(forminfo, create_info->db_type,create_fields,info_length,
|
||||
screens, create_info->table_options, db_file))
|
||||
{
|
||||
|
@ -155,8 +156,7 @@ int rea_create_table(THD *thd, my_string file_name,
|
|||
if (opt_sync_frm && !(create_info->options & HA_LEX_CREATE_TMP_TABLE) &&
|
||||
my_sync(file, MYF(MY_WME)))
|
||||
goto err2;
|
||||
if (my_close(file,MYF(MY_WME)) ||
|
||||
ha_create_table(file_name,create_info,0))
|
||||
if (my_close(file,MYF(MY_WME)))
|
||||
goto err3;
|
||||
DBUG_RETURN(0);
|
||||
|
||||
|
@ -166,6 +166,23 @@ err:
|
|||
err2:
|
||||
VOID(my_close(file,MYF(MY_WME)));
|
||||
err3:
|
||||
DBUG_RETURN(1);
|
||||
} /* mysql_create_frm */
|
||||
|
||||
int rea_create_table(THD *thd, my_string file_name,
|
||||
HA_CREATE_INFO *create_info,
|
||||
List<create_field> &create_fields,
|
||||
uint keys, KEY *key_info)
|
||||
{
|
||||
DBUG_ENTER("rea_create_table");
|
||||
|
||||
if (mysql_create_frm(thd, file_name, create_info,
|
||||
create_fields, keys, key_info, NULL) ||
|
||||
ha_create_table(file_name,create_info,0))
|
||||
goto err;
|
||||
DBUG_RETURN(0);
|
||||
|
||||
err:
|
||||
my_delete(file_name,MYF(0));
|
||||
DBUG_RETURN(1);
|
||||
} /* rea_create_table */
|
||||
|
|
Loading…
Reference in a new issue