-
-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(tianmu): Fix crashes caused by transaction errors when autocommit…
…=ON (#400) Co-authored-by: dfx <duanfuxiang>
- Loading branch information
1 parent
c8fd9a5
commit f52441b
Showing
3 changed files
with
64 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
USE test; | ||
CREATE TABLE `t_test1`( | ||
`id` INT NOT NULL AUTO_INCREMENT, | ||
`first_name` VARCHAR(10) NOT NULL, | ||
`last_name` VARCHAR(10) NOT NULL, | ||
`sex` VARCHAR(5) NOT NULL, | ||
`score` INT NOT NULL, | ||
`copy_id` INT NOT NULL, | ||
PRIMARY KEY (`id`) | ||
) ENGINE=tianmu; | ||
CREATE TABLE `t_test2`( | ||
`id` INT NOT NULL AUTO_INCREMENT, | ||
`first_name` VARCHAR(10) NOT NULL, | ||
`last_name` VARCHAR(10) NOT NULL, | ||
`sex` VARCHAR(5) NOT NULL, | ||
`score` INT NOT NULL, | ||
`copy_id` INT NOT NULL, | ||
PRIMARY KEY (`id`) | ||
) ENGINE=tianmu; | ||
CREATE TRIGGER insert_trigger_t_test2 AFTER INSERT ON t_test1 FOR EACH ROW | ||
BEGIN | ||
INSERT INTO t_test2(id,first_name,last_name,sex,score,copy_id) VALUES (new.id,new.first_name,new.last_name,new.sex,new.score,new.copy_id); | ||
END| | ||
INSERT INTO t_test1 values(1,'张','三','1',100,1); | ||
SELECT id FROM t_test2; | ||
id | ||
1 | ||
DROP TRIGGER insert_trigger_t_test2; | ||
DROP TABLE t_test2; | ||
DROP TABLE t_test1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
USE test; | ||
CREATE TABLE `t_test1`( | ||
`id` INT NOT NULL AUTO_INCREMENT, | ||
`first_name` VARCHAR(10) NOT NULL, | ||
`last_name` VARCHAR(10) NOT NULL, | ||
`sex` VARCHAR(5) NOT NULL, | ||
`score` INT NOT NULL, | ||
`copy_id` INT NOT NULL, | ||
PRIMARY KEY (`id`) | ||
) ENGINE=tianmu; | ||
CREATE TABLE `t_test2`( | ||
`id` INT NOT NULL AUTO_INCREMENT, | ||
`first_name` VARCHAR(10) NOT NULL, | ||
`last_name` VARCHAR(10) NOT NULL, | ||
`sex` VARCHAR(5) NOT NULL, | ||
`score` INT NOT NULL, | ||
`copy_id` INT NOT NULL, | ||
PRIMARY KEY (`id`) | ||
) ENGINE=tianmu; | ||
DELIMITER |; | ||
CREATE TRIGGER insert_trigger_t_test2 AFTER INSERT ON t_test1 FOR EACH ROW | ||
BEGIN | ||
INSERT INTO t_test2(id,first_name,last_name,sex,score,copy_id) VALUES (new.id,new.first_name,new.last_name,new.sex,new.score,new.copy_id); | ||
END| | ||
DELIMITER ;| | ||
INSERT INTO t_test1 values(1,'张','三','1',100,1); | ||
SELECT id FROM t_test2; | ||
DROP TRIGGER insert_trigger_t_test2; | ||
DROP TABLE t_test2; | ||
DROP TABLE t_test1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters