diff options
author | unknown <monty@mysql.com> | 2004-04-08 17:56:45 +0300 |
---|---|---|
committer | unknown <monty@mysql.com> | 2004-04-08 17:56:45 +0300 |
commit | 10e15762b8e38ae09d89e6489de6f2fe68cfd85e (patch) | |
tree | 1eb8cd825c2490f5f90d6e08cd2b0338ce489853 /sql/sql_parse.cc | |
parent | 46bd7be2409e80b36de3cd0d49af33557ffa74a9 (diff) | |
download | mariadb-git-10e15762b8e38ae09d89e6489de6f2fe68cfd85e.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()
sql/ha_myisam.cc:
Don't enable HA_EXTRA_WRITE_CACHE if too few rows
sql/handler.h:
Indentaion fix
sql/mysql_priv.h:
Removed real_alter_table, mysql_add_column and mysql_drop_column
sql/sql_class.cc:
After merge fix
sql/sql_insert.cc:
Don't user bulk_insert if only one row (common case)
sql/sql_parse.cc:
Added mysql_create_index() and mysql_drop_index() as these are only wrappers for mysql_alter_table()
sql/sql_table.cc:
Revert main parts of patch for online index builds
Changed back to use tabs to make merges possible between trees
sql/unireg.cc:
Added comments and minor cleanup
strings/my_vsnprintf.c:
Added support for %lx.
Proper long support
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)); +} |