Commit e1afce06 authored by unknown's avatar unknown

Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-5.0

into sanja.is.com.ua:/home/bell/mysql/bk/work-multi-5.0

parents b978c663 690ebd81
drop table if exists t1, t2;
drop view if exists v1;
drop database if exists mysqltest;
create table t1 (i int);
create trigger trg before insert on t1 for each row set @a:=1;
set @a:=0;
......@@ -190,3 +191,18 @@ select @del_before, @del_after;
drop trigger t1.trg1;
drop trigger t1.trg2;
drop table t1;
create table t1 (a int);
create trigger trg1 before insert on t1 for each row set new.a= 10;
drop table t1;
create table t1 (a int);
insert into t1 values ();
select * from t1;
a
NULL
drop table t1;
create database mysqltest;
use mysqltest;
create table t1 (i int);
create trigger trg1 before insert on t1 for each row set @a:= 1;
drop database mysqltest;
use test;
......@@ -5,6 +5,7 @@
--disable_warnings
drop table if exists t1, t2;
drop view if exists v1;
drop database if exists mysqltest;
--enable_warnings
create table t1 (i int);
......@@ -229,3 +230,22 @@ select @del_before, @del_after;
drop trigger t1.trg1;
drop trigger t1.trg2;
drop table t1;
# Test for bug #5859 "DROP TABLE does not drop triggers". Trigger should not
# magically reappear when we recreate dropped table.
create table t1 (a int);
create trigger trg1 before insert on t1 for each row set new.a= 10;
drop table t1;
create table t1 (a int);
insert into t1 values ();
select * from t1;
drop table t1;
# Test for bug #6559 "DROP DATABASE forgets to drop triggers".
create database mysqltest;
use mysqltest;
create table t1 (i int);
create trigger trg1 before insert on t1 for each row set @a:= 1;
# This should succeed
drop database mysqltest;
use test;
......@@ -2367,6 +2367,7 @@ TYPELIB *ha_known_exts(void)
known_extensions_id= mysys_usage_id;
found_exts.push_back((char*) ".db");
found_exts.push_back((char*) triggers_file_ext);
for (types= sys_table_types; types->type; types++)
{
if (*types->value == SHOW_OPTION_YES)
......
......@@ -1044,6 +1044,7 @@ extern const char *first_keyword, *my_localhost, *delayed_user, *binary_keyword;
extern const char **errmesg; /* Error messages */
extern const char *myisam_recover_options_str;
extern const char *in_left_expr_name, *in_additional_cond;
extern const char * const triggers_file_ext;
extern Eq_creator eq_creator;
extern Ne_creator ne_creator;
extern Gt_creator gt_creator;
......
......@@ -257,7 +257,19 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
/* Delete the table definition file */
strmov(end,reg_ext);
if (!(new_error=my_delete(path,MYF(MY_WME))))
{
some_tables_deleted=1;
/*
Destroy triggers for this table if there are any.
We won't need this as soon as we will have new .FRM format,
in which we will store trigger definitions in the same .FRM
files as table descriptions.
*/
strmov(end, triggers_file_ext);
if (!access(path, F_OK))
new_error= my_delete(path, MYF(MY_WME));
}
error|= new_error;
}
}
......
......@@ -4,7 +4,8 @@
#include "parse_file.h"
static const LEX_STRING triggers_file_type= {(char *)"TRIGGERS", 8};
static const char * const triggers_file_ext= ".TRG";
const char * const triggers_file_ext= ".TRG";
/*
Table of .TRG file field descriptors.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment