summaryrefslogtreecommitdiff
path: root/client/mysqldump.c
diff options
context:
space:
mode:
authorunknown <tnurnberg@blasphemy.mysql.com>2007-05-14 09:02:40 +0200
committerunknown <tnurnberg@blasphemy.mysql.com>2007-05-14 09:02:40 +0200
commit434eeb508ffbad7a8278bb99cc737cf7fad319a8 (patch)
tree30558bd6b6000dce927cc559535c5cea564d4128 /client/mysqldump.c
parente5353e2f48a75e20df595b7e14e00ee1b74f44c0 (diff)
downloadmariadb-git-434eeb508ffbad7a8278bb99cc737cf7fad319a8.tar.gz
Bug#28223: mysqldump --compact --routines restores from @OLD_SQL_MODE w/o ever setting it
mysqldump generated output that set OLD_SQL_MODE twice, to different values (for triggers), or not at all (for routines) in some cases. --- Merge blasphemy.mysql.com:/home/tnurnberg/28223/50-28223 into blasphemy.mysql.com:/home/tnurnberg/28223/51-28223 client/mysqldump.c: Bug#28223: mysqldump --compact --routines restores from @OLD_SQL_MODE w/o ever setting it Only save SQL_MODE in dump_triggers if in --compact mode. Otherwise, it's already been saved in write_header(). Likewise for dumpe_routines, where it was never saved. mysql-test/r/mysqldump.result: Bug#28223: mysqldump --compact --routines restores from @OLD_SQL_MODE w/o ever setting it mysqldump output has subtly changed. Adjust test-results. This also shows OLD_SQL_MODE is always set exactly once now. --- manual merge
Diffstat (limited to 'client/mysqldump.c')
-rw-r--r--client/mysqldump.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/client/mysqldump.c b/client/mysqldump.c
index afefa467cce..149e07ded90 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -1608,6 +1608,9 @@ static uint dump_routines_for_db(char *db)
if (lock_tables)
mysql_query(mysql, "LOCK TABLES mysql.proc READ");
+ if (opt_compact)
+ fprintf(sql_file, "\n/*!50003 SET @OLD_SQL_MODE=@@SQL_MODE*/;\n");
+
fprintf(sql_file, "DELIMITER ;;\n");
/* 0, retrieve and dump functions, 1, procedures */
@@ -2264,8 +2267,11 @@ static void dump_triggers_for_table(char *table,
DBUG_VOID_RETURN;
}
if (mysql_num_rows(result))
- fprintf(sql_file, "\n/*!50003 SET @OLD_SQL_MODE=@@SQL_MODE*/;\n\
-DELIMITER ;;\n");
+ {
+ if (opt_compact)
+ fprintf(sql_file, "\n/*!50003 SET @OLD_SQL_MODE=@@SQL_MODE*/;\n");
+ fprintf(sql_file, "\nDELIMITER ;;\n");
+ }
while ((row= mysql_fetch_row(result)))
{
fprintf(sql_file,