From 47fae7f08fd0437cd555bbd6b2533a4117340c8d Mon Sep 17 00:00:00 2001 From: Igor Babaev Date: Tue, 10 Jul 2012 16:34:39 -0700 Subject: Added procedures to delete records by keys from statistical tables. Now when a table is dropped the statistics on the table is removed from the statistical tables. If the table is altered in such a way that a column is dropped or the type of the column is changed then statistics on the column is removed from the table column_stat. It also triggers removal of the statistics on the indexes who use this column as its component. Added procedures that changes the names of the tables or columns in the statistical tables for. These procedures are used when tables/columns are renamed. Also partly re-factored the code that introduced the persistent statistical tables. Added test cases into statistics.test to cover the new code. --- sql/sql_rename.cc | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'sql/sql_rename.cc') diff --git a/sql/sql_rename.cc b/sql/sql_rename.cc index 6b0d1e980f9..d27989c3b01 100644 --- a/sql/sql_rename.cc +++ b/sql/sql_rename.cc @@ -279,6 +279,12 @@ do_rename(THD *thd, TABLE_LIST *ren_table, char *new_db, char *new_table_name, ren_table->db, old_alias, new_db, new_alias, 0))) { + LEX_STRING db_name= { ren_table->db, ren_table->db_length }; + LEX_STRING table_name= { ren_table->table_name, + ren_table->table_name_length }; + LEX_STRING new_table= { (char *) new_alias, strlen(new_alias) }; + (void) rename_table_in_stat_tables(thd, &db_name, &table_name, + &db_name, &new_table); if ((rc= Table_triggers_list::change_table_name(thd, ren_table->db, old_alias, ren_table->table_name, -- cgit v1.2.1