Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
96e7df0c
Commit
96e7df0c
authored
Oct 13, 2005
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge pgalbraith@bk-internal.mysql.com:/home/bk/mysql-5.0
into krsna.patg.net:/home/patg/mysql-build/mysql-5.0
parents
acb50e59
365472f6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
127 additions
and
2 deletions
+127
-2
client/mysqldump.c
client/mysqldump.c
+28
-2
mysql-test/r/mysqldump.result
mysql-test/r/mysqldump.result
+65
-0
mysql-test/t/mysqldump.test
mysql-test/t/mysqldump.test
+34
-0
No files found.
client/mysqldump.c
View file @
96e7df0c
...
@@ -975,6 +975,22 @@ static my_bool test_if_special_chars(const char *str)
...
@@ -975,6 +975,22 @@ static my_bool test_if_special_chars(const char *str)
/*
quote_name(name, buff, force)
Quotes char string, taking into account compatible mode
Args
name Unquoted string containing that which will be quoted
buff The buffer that contains the quoted value, also returned
force Flag to make it ignore 'test_if_special_chars'
Returns
buff quoted string
*/
static
char
*
quote_name
(
const
char
*
name
,
char
*
buff
,
my_bool
force
)
static
char
*
quote_name
(
const
char
*
name
,
char
*
buff
,
my_bool
force
)
{
{
char
*
to
=
buff
;
char
*
to
=
buff
;
...
@@ -1782,14 +1798,19 @@ continue_xml:
...
@@ -1782,14 +1798,19 @@ continue_xml:
static
void
dump_triggers_for_table
(
char
*
table
,
char
*
db
)
static
void
dump_triggers_for_table
(
char
*
table
,
char
*
db
)
{
{
MYSQL_RES
*
result
;
MYSQL_ROW
row
;
char
*
result_table
;
char
*
result_table
;
char
name_buff
[
NAME_LEN
*
4
+
3
],
table_buff
[
NAME_LEN
*
2
+
3
];
char
name_buff
[
NAME_LEN
*
4
+
3
],
table_buff
[
NAME_LEN
*
2
+
3
];
char
query_buff
[
512
];
char
query_buff
[
512
];
uint
old_opt_compatible_mode
=
opt_compatible_mode
;
FILE
*
sql_file
=
md_result_file
;
FILE
*
sql_file
=
md_result_file
;
MYSQL_RES
*
result
;
MYSQL_ROW
row
;
DBUG_ENTER
(
"dump_triggers_for_table"
);
DBUG_ENTER
(
"dump_triggers_for_table"
);
DBUG_PRINT
(
"enter"
,
(
"db: %s, table: %s"
,
db
,
table
));
DBUG_PRINT
(
"enter"
,
(
"db: %s, table: %s"
,
db
,
table
));
/* Do not use ANSI_QUOTES on triggers in dump */
opt_compatible_mode
&=
~
MASK_ANSI_QUOTES
;
result_table
=
quote_name
(
table
,
table_buff
,
1
);
result_table
=
quote_name
(
table
,
table_buff
,
1
);
my_snprintf
(
query_buff
,
sizeof
(
query_buff
),
my_snprintf
(
query_buff
,
sizeof
(
query_buff
),
...
@@ -1822,6 +1843,11 @@ DELIMITER ;;\n");
...
@@ -1822,6 +1843,11 @@ DELIMITER ;;\n");
"DELIMITER ;
\n
"
"DELIMITER ;
\n
"
"/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE */;
\n
"
);
"/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE */;
\n
"
);
mysql_free_result
(
result
);
mysql_free_result
(
result
);
/*
make sure to set back opt_compatible mode to
original value
*/
opt_compatible_mode
=
old_opt_compatible_mode
;
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
}
}
...
...
mysql-test/r/mysqldump.result
View file @
96e7df0c
...
@@ -2309,3 +2309,68 @@ UNLOCK TABLES;
...
@@ -2309,3 +2309,68 @@ UNLOCK TABLES;
drop table t1;
drop table t1;
set global time_zone=default;
set global time_zone=default;
set time_zone=default;
set time_zone=default;
DROP TABLE IF EXISTS `t1 test`;
CREATE TABLE `t1 test` (
`a1` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `t2 test`;
CREATE TABLE `t2 test` (
`a2` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
CREATE TRIGGER `test trig` BEFORE INSERT ON `t1 test` FOR EACH ROW BEGIN
INSERT INTO `t2 test` SET a2 = NEW.a1; END //
INSERT INTO `t1 test` VALUES (1);
INSERT INTO `t1 test` VALUES (2);
INSERT INTO `t1 test` VALUES (3);
SELECT * FROM `t2 test`;
a2
1
2
3
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,ANSI' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS "t1 test";
CREATE TABLE "t1 test" (
"a1" int(11) default NULL
);
/*!40000 ALTER TABLE "t1 test" DISABLE KEYS */;
LOCK TABLES "t1 test" WRITE;
INSERT INTO "t1 test" VALUES (1),(2),(3);
UNLOCK TABLES;
/*!40000 ALTER TABLE "t1 test" ENABLE KEYS */;
/*!50003 SET @OLD_SQL_MODE=@@SQL_MODE*/;
DELIMITER ;;
/*!50003 SET SESSION SQL_MODE="" */;;
/*!50003 CREATE TRIGGER `test trig` BEFORE INSERT ON `t1 test` FOR EACH ROW BEGIN
INSERT INTO `t2 test` SET a2 = NEW.a1; END */;;
DELIMITER ;
/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE */;
DROP TABLE IF EXISTS "t2 test";
CREATE TABLE "t2 test" (
"a2" int(11) default NULL
);
/*!40000 ALTER TABLE "t2 test" DISABLE KEYS */;
LOCK TABLES "t2 test" WRITE;
INSERT INTO "t2 test" VALUES (1),(2),(3);
UNLOCK TABLES;
/*!40000 ALTER TABLE "t2 test" ENABLE KEYS */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
DROP TRIGGER `test trig`;
DROP TABLE `t1 test`;
DROP TABLE `t2 test`;
mysql-test/t/mysqldump.test
View file @
96e7df0c
...
@@ -928,3 +928,37 @@ set global time_zone='Europe/Moscow';
...
@@ -928,3 +928,37 @@ set global time_zone='Europe/Moscow';
drop
table
t1
;
drop
table
t1
;
set
global
time_zone
=
default
;
set
global
time_zone
=
default
;
set
time_zone
=
default
;
set
time_zone
=
default
;
#
# Test of fix to BUG 13146 - ansi quotes break loading of triggers
#
--
disable_warnings
DROP
TABLE
IF
EXISTS
`t1 test`
;
CREATE
TABLE
`t1 test`
(
`a1`
int
(
11
)
default
NULL
)
ENGINE
=
MyISAM
DEFAULT
CHARSET
=
latin1
;
DROP
TABLE
IF
EXISTS
`t2 test`
;
CREATE
TABLE
`t2 test`
(
`a2`
int
(
11
)
default
NULL
)
ENGINE
=
MyISAM
DEFAULT
CHARSET
=
latin1
;
--
enable_warnings
DELIMITER
//;
CREATE
TRIGGER
`test trig`
BEFORE
INSERT
ON
`t1 test`
FOR
EACH
ROW
BEGIN
INSERT
INTO
`t2 test`
SET
a2
=
NEW
.
a1
;
END
//
DELIMITER
;
//
INSERT
INTO
`t1 test`
VALUES
(
1
);
INSERT
INTO
`t1 test`
VALUES
(
2
);
INSERT
INTO
`t1 test`
VALUES
(
3
);
SELECT
*
FROM
`t2 test`
;
# dump with compatible=ansi. Everything except triggers should be double
# quoted
--
exec
$MYSQL_DUMP
--
skip
-
comments
--
compatible
=
ansi
--
triggers
test
--
disable_warnings
DROP
TRIGGER
`test trig`
;
DROP
TABLE
`t1 test`
;
DROP
TABLE
`t2 test`
;
--
enable_warnings
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment