summaryrefslogtreecommitdiff
path: root/sql/sql_rename.cc
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2012-07-10 16:34:39 -0700
committerIgor Babaev <igor@askmonty.org>2012-07-10 16:34:39 -0700
commit47fae7f08fd0437cd555bbd6b2533a4117340c8d (patch)
treeeaa1b4c3e8c40420196ff94272d1fa2cd520039d /sql/sql_rename.cc
parent4a6a08309cd78091246a7fd598bc43cd25deba45 (diff)
downloadmariadb-git-47fae7f08fd0437cd555bbd6b2533a4117340c8d.tar.gz
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.
Diffstat (limited to 'sql/sql_rename.cc')
-rw-r--r--sql/sql_rename.cc6
1 files changed, 6 insertions, 0 deletions
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,