Below is the list of changes that have just been committed into a local
5.0 repository of bell. When bell 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.1892 05/07/29 01:09:09 bell@stripped +6 -0
Added sql_mode saving to mysql_dump (BUG#5891, part 2)
mysql-test/t/sp.test
1.135 05/07/29 01:09:02 bell@stripped +1 -1
now sql_mode preserved in SP
mysql-test/t/mysqldump.test
1.53 05/07/29 01:09:02 bell@stripped +4 -0
changed test, to test sql_mode
mysql-test/r/sp.result
1.140 05/07/29 01:09:01 bell@stripped +4 -4
now sql_mode preserved in SP
mysql-test/r/mysqldump.result
1.59 05/07/29 01:09:01 bell@stripped +38 -4
changed test, to test sql_mode
client/mysqldump.c
1.192 05/07/29 01:09:01 bell@stripped +12 -9
fixed short simbol for trigger
fixed lines break for more compiler compatibility
added sql_mode output
added comments
client/client_priv.h
1.38 05/07/29 01:09:01 bell@stripped +2 -1
add OPT_ for --trigger parameter
# 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: bell
# Host: sanja.is.com.ua
# Root: /home/bell/mysql/bk/work-trigger-5.0
--- 1.191/client/mysqldump.c 2005-07-22 05:11:20 +03:00
+++ 1.192/client/mysqldump.c 2005-07-29 01:09:01 +03:00
@@ -372,7 +372,7 @@
(gptr*) &path, (gptr*) &path, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"tables", OPT_TABLES, "Overrides option --databases (-B).",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"triggers", '/0', "Dump triggers for each dumped table",
+ {"triggers", OPT_TRIGGER, "Dump triggers for each dumped table",
(gptr*) &opt_dump_triggers, (gptr*) &opt_dump_triggers, 0, GET_BOOL,
NO_ARG, 1, 0, 0, 0, 0, 0},
#ifndef DONT_ALLOW_USER_CHANGE
@@ -1335,19 +1335,22 @@
DBUG_RETURN(0);
}
if (mysql_num_rows(tableRes))
- fprintf(sql_file, "\nDELIMITER //;\n");
+ fprintf(sql_file, "\nSET @OLD_SQL_MODE=@@SQL_MODE;\nDELIMITER //;\n");
while ((row=mysql_fetch_row(tableRes)))
{
- fprintf(sql_file, "CREATE TRIGGER %s %s %s ON %s\n"
- "FOR EACH ROW%s//\n\n",
- quote_name(row[0], name_buff, 0),
- row[4],
- row[1],
+ fprintf(sql_file, "SET SESSION SQL_MODE=\"%s\"//\n\
+CREATE TRIGGER %s %s %s ON %s\n\
+FOR EACH ROW%s//\n\n",
+ row[6], /* sql_mode */
+ quote_name(row[0], name_buff, 0), /* Trigger */
+ row[4], /* Timing */
+ row[1], /* Event */
result_table,
- row[3]);
+ row[3] /* Statement */);
}
if (mysql_num_rows(tableRes))
- fprintf(sql_file, "DELIMITER ;//");
+ fprintf(sql_file,
+ "DELIMITER ;//\nSET SESSION SQL_MODE=@OLD_SQL_MODE;");
mysql_free_result(tableRes);
}
}
--- 1.37/client/client_priv.h 2005-05-26 13:58:50 +03:00
+++ 1.38/client/client_priv.h 2005-07-29 01:09:01 +03:00
@@ -49,5 +49,6 @@
#ifdef HAVE_NDBCLUSTER_DB
OPT_NDBCLUSTER, OPT_NDB_CONNECTSTRING,
#endif
- OPT_IGNORE_TABLE,OPT_INSERT_IGNORE,OPT_SHOW_WARNINGS,OPT_DROP_DATABASE
+ OPT_IGNORE_TABLE, OPT_INSERT_IGNORE, OPT_SHOW_WARNINGS, OPT_DROP_DATABASE,
+ OPT_TRIGGER
};
--- 1.139/mysql-test/r/sp.result 2005-07-22 09:11:17 +03:00
+++ 1.140/mysql-test/r/sp.result 2005-07-29 01:09:01 +03:00
@@ -2658,20 +2658,20 @@
drop procedure avg|
drop procedure if exists bug6129|
set @old_mode= @@sql_mode;
-set @@sql_mode= "";
+set @@sql_mode= "ERROR_FOR_DIVISION_BY_ZERO";
create procedure bug6129()
select @@sql_mode|
call bug6129()|
@@sql_mode
-
+ERROR_FOR_DIVISION_BY_ZERO
set @@sql_mode= "NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO"|
call bug6129()|
@@sql_mode
-NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO
+ERROR_FOR_DIVISION_BY_ZERO
set @@sql_mode= "NO_ZERO_IN_DATE"|
call bug6129()|
@@sql_mode
-NO_ZERO_IN_DATE
+ERROR_FOR_DIVISION_BY_ZERO
set @@sql_mode=@old_mode;
drop procedure bug6129|
drop procedure if exists bug9856|
--- 1.134/mysql-test/t/sp.test 2005-07-22 09:11:17 +03:00
+++ 1.135/mysql-test/t/sp.test 2005-07-29 01:09:02 +03:00
@@ -3378,7 +3378,7 @@
drop procedure if exists bug6129|
--enable_warnings
set @old_mode= @@sql_mode;
-set @@sql_mode= "";
+set @@sql_mode= "ERROR_FOR_DIVISION_BY_ZERO";
create procedure bug6129()
select @@sql_mode|
call bug6129()|
--- 1.58/mysql-test/r/mysqldump.result 2005-07-22 05:11:20 +03:00
+++ 1.59/mysql-test/r/mysqldump.result 2005-07-29 01:09:01 +03:00
@@ -1685,6 +1685,7 @@
create trigger trg2 before update on t1 for each row begin
if old.a % 2 = 0 then set new.b := 12; end if;
end|
+set sql_mode="traditional"|
create trigger trg3 after update on t1 for each row
begin
if new.a = -1 then
@@ -1697,24 +1698,25 @@
set @fired:= "No";
end if;
end|
+set sql_mode=default|
show triggers like "t1";
-Trigger Event Table Statement Timing Created
+Trigger Event Table Statement Timing Created sql_mode
trg1 INSERT t1
begin
if new.a > 10 then
set new.a := 10;
set new.a := 11;
end if;
-end BEFORE 0000-00-00 00:00:00
+end BEFORE 0000-00-00 00:00:00
trg2 UPDATE t1 begin
if old.a % 2 = 0 then set new.b := 12; end if;
-end BEFORE 0000-00-00 00:00:00
+end BEFORE 0000-00-00 00:00:00
trg3 UPDATE t1
begin
if new.a = -1 then
set @fired:= "Yes";
end if;
-end AFTER 0000-00-00 00:00:00
+end AFTER 0000-00-00
00:00:00 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
INSERT INTO t1 (a) VALUES (1),(2),(3),(22);
update t1 set a = 4 where a=3;
@@ -1736,7 +1738,9 @@
`b` bigint(20) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET @OLD_SQL_MODE=@@SQL_MODE;
DELIMITER //;
+SET SESSION SQL_MODE=""//
CREATE TRIGGER `trg1` BEFORE INSERT ON `t1`
FOR EACH ROW
begin
@@ -1746,11 +1750,13 @@
end if;
end//
+SET SESSION SQL_MODE=""//
CREATE TRIGGER `trg2` BEFORE UPDATE ON `t1`
FOR EACH ROW begin
if old.a % 2 = 0 then set new.b := 12; end if;
end//
+SET SESSION
SQL_MODE="STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER"//
CREATE TRIGGER `trg3` AFTER UPDATE ON `t1`
FOR EACH ROW
begin
@@ -1760,6 +1766,7 @@
end//
DELIMITER ;//
+SET SESSION SQL_MODE=@OLD_SQL_MODE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
LOCK TABLES `t1` WRITE;
@@ -1771,7 +1778,9 @@
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET @OLD_SQL_MODE=@@SQL_MODE;
DELIMITER //;
+SET SESSION
SQL_MODE="STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER"//
CREATE TRIGGER `trg4` BEFORE INSERT ON `t2`
FOR EACH ROW
begin
@@ -1781,6 +1790,7 @@
end//
DELIMITER ;//
+SET SESSION SQL_MODE=@OLD_SQL_MODE;
/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
LOCK TABLES `t2` WRITE;
@@ -1844,4 +1854,28 @@
Tables_in_test
t1
t2
+show triggers;
+Trigger Event Table Statement Timing Created sql_mode
+trg1 INSERT t1
+begin
+if new.a > 10 then
+set new.a := 10;
+set new.a := 11;
+end if;
+end BEFORE #
+trg2 UPDATE t1 begin
+if old.a % 2 = 0 then set new.b := 12; end if;
+end BEFORE #
+trg3 UPDATE t1
+begin
+if new.a = -1 then
+set @fired:= "Yes";
+end if;
+end AFTER # STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
+trg4 INSERT t2
+begin
+if new.a > 10 then
+set @fired:= "No";
+end if;
+end BEFORE # STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
DROP TABLE t1, t2;
--- 1.52/mysql-test/t/mysqldump.test 2005-07-22 05:11:21 +03:00
+++ 1.53/mysql-test/t/mysqldump.test 2005-07-29 01:09:02 +03:00
@@ -727,6 +727,7 @@
create trigger trg2 before update on t1 for each row begin
if old.a % 2 = 0 then set new.b := 12; end if;
end|
+set sql_mode="traditional"|
create trigger trg3 after update on t1 for each row
begin
if new.a = -1 then
@@ -739,6 +740,7 @@
set @fired:= "No";
end if;
end|
+set sql_mode=default|
delimiter ;|
--replace_column 6 '0000-00-00 00:00:00'
show triggers like "t1";
@@ -754,4 +756,6 @@
--exec $MYSQL test < var/tmp/mysqldump.sql
# Check that tables have been reloaded
show tables;
+--replace_column 6 #
+show triggers;
DROP TABLE t1, t2;
| Thread |
|---|
| • bk commit into 5.0 tree (bell:1.1892) BUG#5891 | sanja | 29 Jul |