Browse Source
Make the InnoDB FOREIGN KEY parser understand multi-statements. (Bug #48024)
Make the InnoDB FOREIGN KEY parser understand multi-statements. (Bug #48024)
Also make InnoDB thinks that /*/ only starts a comment. (Bug #53644). This fixes the bugs in the InnoDB Plugin. ha_innodb.h: Use trx_query_string() instead of trx_query() when available (MySQL 5.1.42 or later). innobase_get_stmt(): New function, to retrieve the currently running SQL statement. struct trx_struct: Remove mysql_query_str. Use innobase_get_stmt() instead. dict_strip_comments(): Add and observe the parameter sql_length. Treat /*/ as the start of a comment. dict_create_foreign_constraints(), row_table_add_foreign_constraints(): Add the parameter sql_length.pull/73/head
12 changed files with 130 additions and 52 deletions
-
10mysql-test/suite/innodb_plugin/r/innodb_bug48024.result
-
20mysql-test/suite/innodb_plugin/t/innodb_bug48024.test
-
51storage/innodb_plugin/dict/dict0dict.c
-
35storage/innodb_plugin/handler/ha_innodb.cc
-
4storage/innodb_plugin/handler/ha_innodb.h
-
1storage/innodb_plugin/include/dict0dict.h
-
12storage/innodb_plugin/include/ha_prototypes.h
-
1storage/innodb_plugin/include/row0mysql.h
-
3storage/innodb_plugin/include/trx0trx.h
-
5storage/innodb_plugin/row/row0mysql.c
-
38storage/innodb_plugin/trx/trx0i_s.c
-
2storage/innodb_plugin/trx/trx0trx.c
@ -0,0 +1,10 @@ |
|||
CREATE TABLE bug48024(a int PRIMARY KEY,b int NOT NULL,KEY(b)) ENGINE=InnoDB; |
|||
CREATE TABLE bug48024_b(b int PRIMARY KEY) ENGINE=InnoDB; |
|||
ALTER TABLE bug48024 /*/ADD CONSTRAINT FOREIGN KEY(c) REFERENCES(a),/*/ |
|||
ADD CONSTRAINT FOREIGN KEY(b) REFERENCES bug48024_b(b); |
|||
DROP TABLE bug48024,bug48024_b; |
|||
CREATE TABLE bug48024(a int PRIMARY KEY,b int NOT NULL,KEY(b)) ENGINE=InnoDB; |
|||
CREATE TABLE bug48024_b(b int PRIMARY KEY) ENGINE=InnoDB; |
|||
ALTER TABLE bug48024 /*/ADD CONSTRAINT FOREIGN KEY(c) REFERENCES(a),/*/ |
|||
ADD CONSTRAINT FOREIGN KEY(b) REFERENCES bug48024_b(b)| |
|||
DROP TABLE bug48024,bug48024_b; |
|||
@ -0,0 +1,20 @@ |
|||
# Bug #48024 Innodb doesn't work with multi-statements |
|||
|
|||
--source include/have_innodb_plugin.inc |
|||
|
|||
CREATE TABLE bug48024(a int PRIMARY KEY,b int NOT NULL,KEY(b)) ENGINE=InnoDB; |
|||
CREATE TABLE bug48024_b(b int PRIMARY KEY) ENGINE=InnoDB; |
|||
# Bug #53644 InnoDB thinks that /*/ starts and ends a comment |
|||
ALTER TABLE bug48024 /*/ADD CONSTRAINT FOREIGN KEY(c) REFERENCES(a),/*/ |
|||
ADD CONSTRAINT FOREIGN KEY(b) REFERENCES bug48024_b(b); |
|||
|
|||
DROP TABLE bug48024,bug48024_b; |
|||
|
|||
delimiter |; |
|||
CREATE TABLE bug48024(a int PRIMARY KEY,b int NOT NULL,KEY(b)) ENGINE=InnoDB; |
|||
CREATE TABLE bug48024_b(b int PRIMARY KEY) ENGINE=InnoDB; |
|||
ALTER TABLE bug48024 /*/ADD CONSTRAINT FOREIGN KEY(c) REFERENCES(a),/*/ |
|||
ADD CONSTRAINT FOREIGN KEY(b) REFERENCES bug48024_b(b)| |
|||
delimiter ;| |
|||
|
|||
DROP TABLE bug48024,bug48024_b; |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue