diff options
author | monty@mysql.com <> | 2004-04-08 17:56:45 +0300 |
---|---|---|
committer | monty@mysql.com <> | 2004-04-08 17:56:45 +0300 |
commit | 62fa4013ce59707988a833a1ba6e873e7c94c63b (patch) | |
tree | 1eb8cd825c2490f5f90d6e08cd2b0338ce489853 /sql/sql_parse.cc | |
parent | 00738a2be0f5c8afd086db476e8a286a38c6ad7a (diff) | |
download | mariadb-git-62fa4013ce59707988a833a1ba6e873e7c94c63b.tar.gz |
Don't enable HA_EXTRA_WRITE_CACHE if too few rows
Revert main parts of patch for online index builds. Should be done differently
Added support for %lx in my_snprintf()
Diffstat (limited to 'sql/sql_parse.cc')
-rw-r--r-- | sql/sql_parse.cc | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 37e0ca7a0c5..f88c8c12448 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -4993,3 +4993,49 @@ Item * all_any_subquery_creator(Item *left_expr, return it; /* ANY/SOME */ } + + +/* + 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. + + In the future ALTER TABLE will notice that only added indexes + and create these one by one for the existing table without having to do + a full rebuild. + + 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, + ALTER_ADD_INDEX, 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, + ALTER_DROP_INDEX, DUP_ERROR)); +} |