diff options
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r-- | sql/sql_table.cc | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 9079bca7c1d..20e19484aa7 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2012, Oracle and/or its affiliates. + Copyright (c) 2000, 2013, Oracle and/or its affiliates. Copyright (c) 2010, 2013, Monty Program Ab. This program is free software; you can redistribute it and/or modify @@ -53,6 +53,7 @@ #include "sql_parse.h" #include "sql_show.h" #include "transaction.h" +#include "sql_audit.h" #ifdef __WIN__ #include <io.h> @@ -1686,7 +1687,8 @@ bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags) &syntax_len, TRUE, TRUE, lpt->create_info, - lpt->alter_info))) + lpt->alter_info, + NULL))) { DBUG_RETURN(TRUE); } @@ -1789,7 +1791,8 @@ bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags) &syntax_len, TRUE, TRUE, lpt->create_info, - lpt->alter_info))) + lpt->alter_info, + NULL))) { error= 1; goto err; @@ -2370,6 +2373,10 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists, wrong_tables.append(','); wrong_tables.append(String(table->table_name,system_charset_info)); } + else + { + mysql_audit_drop_table(thd, table); + } DBUG_PRINT("table", ("table: 0x%lx s: 0x%lx", (long) table->table, table->table ? (long) table->table->s : (long) -1)); @@ -4194,7 +4201,8 @@ handler *mysql_create_frm_image(THD *thd, &syntax_len, TRUE, TRUE, create_info, - alter_info))) + alter_info, + NULL))) goto err; part_info->part_info_string= part_syntax_buf; part_info->part_info_len= syntax_len; @@ -4666,6 +4674,8 @@ mysql_rename_table(handlerton *base, const char *old_db, my_error(ER_NOT_SUPPORTED_YET, MYF(0), "ALTER TABLE"); else if (error) my_error(ER_ERROR_ON_RENAME, MYF(0), from, to, error); + else if (!(flags & FN_IS_TMP)) + mysql_audit_rename_table(thd, old_db, old_name, new_db, new_name); DBUG_RETURN(error != 0); } @@ -6321,6 +6331,8 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, mysql_ha_rm_tables(thd, table_list); + mysql_audit_alter_table(thd, table_list); + /* DISCARD/IMPORT TABLESPACE is always alone in an ALTER TABLE */ if (alter_info->tablespace_op != NO_TABLESPACE_OP) /* Conditionally writes to binlog. */ @@ -6990,6 +7002,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, HA_OPTION_PACK_RECORD)); } tmp_disable_binlog(thd); + create_info->options|=HA_CREATE_TMP_ALTER; error= mysql_create_table_no_lock(thd, new_db, tmp_name, create_info, alter_info, NULL, create_table_mode); reenable_binlog(thd); |