Loading mysql-test/r/information_schema.result +9 −0 Original line number Diff line number Diff line Loading @@ -940,3 +940,12 @@ f5 19 NULL f6 1 NULL f7 64 NULL drop table t1; create table t1 (f1 integer); create trigger tr1 after insert on t1 for each row set @test_var=42; use information_schema; select trigger_schema, trigger_name from triggers where trigger_name='tr1'; trigger_schema trigger_name test tr1 use test; drop table t1; mysql-test/t/information_schema.test +11 −0 Original line number Diff line number Diff line Loading @@ -622,3 +622,14 @@ select column_name, NUMERIC_PRECISION, NUMERIC_SCALE from information_schema.columns where table_name='t1'; drop table t1; # # Bug #12127 triggers do not show in info_schema before they are used if set to the database # create table t1 (f1 integer); create trigger tr1 after insert on t1 for each row set @test_var=42; use information_schema; select trigger_schema, trigger_name from triggers where trigger_name='tr1'; use test; drop table t1; sql/sql_trigger.cc +9 −0 Original line number Diff line number Diff line Loading @@ -520,6 +520,7 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db, char path_buff[FN_REFLEN]; LEX_STRING path; File_parser *parser; LEX_STRING save_db; DBUG_ENTER("Table_triggers_list::check_n_load"); Loading Loading @@ -581,6 +582,10 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db, thd->lex= &lex; save_db.str= thd->db; save_db.length= thd->db_length; thd->db_length= strlen(db); thd->db= (char *) db; while ((trg_create_str= it++)) { lex_start(thd, (uchar*)trg_create_str->str, trg_create_str->length); Loading Loading @@ -623,6 +628,8 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db, lex_end(&lex); } thd->db= save_db.str; thd->db_length= save_db.length; thd->lex= old_lex; DBUG_RETURN(0); Loading @@ -631,6 +638,8 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db, // QQ: anything else ? lex_end(&lex); thd->lex= old_lex; thd->db= save_db.str; thd->db_length= save_db.length; DBUG_RETURN(1); } Loading Loading
mysql-test/r/information_schema.result +9 −0 Original line number Diff line number Diff line Loading @@ -940,3 +940,12 @@ f5 19 NULL f6 1 NULL f7 64 NULL drop table t1; create table t1 (f1 integer); create trigger tr1 after insert on t1 for each row set @test_var=42; use information_schema; select trigger_schema, trigger_name from triggers where trigger_name='tr1'; trigger_schema trigger_name test tr1 use test; drop table t1;
mysql-test/t/information_schema.test +11 −0 Original line number Diff line number Diff line Loading @@ -622,3 +622,14 @@ select column_name, NUMERIC_PRECISION, NUMERIC_SCALE from information_schema.columns where table_name='t1'; drop table t1; # # Bug #12127 triggers do not show in info_schema before they are used if set to the database # create table t1 (f1 integer); create trigger tr1 after insert on t1 for each row set @test_var=42; use information_schema; select trigger_schema, trigger_name from triggers where trigger_name='tr1'; use test; drop table t1;
sql/sql_trigger.cc +9 −0 Original line number Diff line number Diff line Loading @@ -520,6 +520,7 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db, char path_buff[FN_REFLEN]; LEX_STRING path; File_parser *parser; LEX_STRING save_db; DBUG_ENTER("Table_triggers_list::check_n_load"); Loading Loading @@ -581,6 +582,10 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db, thd->lex= &lex; save_db.str= thd->db; save_db.length= thd->db_length; thd->db_length= strlen(db); thd->db= (char *) db; while ((trg_create_str= it++)) { lex_start(thd, (uchar*)trg_create_str->str, trg_create_str->length); Loading Loading @@ -623,6 +628,8 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db, lex_end(&lex); } thd->db= save_db.str; thd->db_length= save_db.length; thd->lex= old_lex; DBUG_RETURN(0); Loading @@ -631,6 +638,8 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db, // QQ: anything else ? lex_end(&lex); thd->lex= old_lex; thd->db= save_db.str; thd->db_length= save_db.length; DBUG_RETURN(1); } Loading