List:Internals« Previous MessageNext Message »
From:gluh Date:July 26 2005 10:30am
Subject:bk commit into 5.0 tree (gluh:1.1891) BUG#12127
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of gluh. When gluh does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.1891 05/07/26 13:29:55 gluh@stripped +3 -0
  Fix for bug#12127 triggers do not show in info_schema before they are used if set to the
database
    use db name of table which trigger belongs to
    instead of thd->db name during trigger body parsing

  sql/sql_trigger.cc
    1.23 05/07/26 13:29:50 gluh@stripped +9 -0
    Fix for bug#12127 triggers do not show in info_schema before they are used if set to
the database
      use db name of table which trigger belongs to
      instead of thd->db name during trigger body parsing

  mysql-test/t/information_schema.test
    1.46 05/07/26 13:29:50 gluh@stripped +11 -0
    Fix for bug#12127 triggers do not show in info_schema before they are used if set to
the database

  mysql-test/r/information_schema.result
    1.65 05/07/26 13:29:50 gluh@stripped +9 -0
    Fix for bug#12127 triggers do not show in info_schema before they are used if set to
the database

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	gluh
# Host:	eagle.intranet.mysql.r18.ru
# Root:	/home/gluh/MySQL/Merge/5.0

--- 1.22/sql/sql_trigger.cc	Tue Jul 19 21:06:43 2005
+++ 1.23/sql/sql_trigger.cc	Tue Jul 26 13:29:50 2005
@@ -520,9 +520,12 @@
   char path_buff[FN_REFLEN];
   LEX_STRING path;
   File_parser *parser;
+  LEX_STRING save_db;
 
   DBUG_ENTER("Table_triggers_list::check_n_load");
 
+  save_db.str=thd->db;
+  save_db.length=thd->db_length;
   strxnmov(path_buff, FN_REFLEN, mysql_data_home, "/", db, "/", table_name,
            triggers_file_ext, NullS);
   path.length= unpack_filename(path_buff, path_buff);
@@ -581,6 +584,8 @@
 
       thd->lex= &lex;
 
+      thd->db_length= strlen(db);
+      thd->db= thd->strmake(db, thd->db_length);
       while ((trg_create_str= it++))
       {
         lex_start(thd, (uchar*)trg_create_str->str, trg_create_str->length);
@@ -623,6 +628,8 @@
 
         lex_end(&lex);
       }
+      thd->db= save_db.str;
+      thd->db_length= save_db.length;
       thd->lex= old_lex;
 
       DBUG_RETURN(0);
@@ -631,6 +638,8 @@
       // QQ: anything else ?
       lex_end(&lex);
       thd->lex= old_lex;
+      thd->db= save_db.str;
+      thd->db_length= save_db.length;
       DBUG_RETURN(1);
     }
 

--- 1.64/mysql-test/r/information_schema.result	Thu Jul 21 18:43:50 2005
+++ 1.65/mysql-test/r/information_schema.result	Tue Jul 26 13:29:50 2005
@@ -940,3 +940,12 @@
 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;

--- 1.45/mysql-test/t/information_schema.test	Tue Jul 19 21:52:54 2005
+++ 1.46/mysql-test/t/information_schema.test	Tue Jul 26 13:29:50 2005
@@ -622,3 +622,14 @@
 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;
Thread
bk commit into 5.0 tree (gluh:1.1891) BUG#12127gluh26 Jul