--source include/have_innodb.inc
#
# Mantis bug #220: Mixing with InnoDB table leads to an anomaly
#
--echo #---- Bug 220 ----
--disable_warnings
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
--enable_warnings

--echo # Establish connection conn1 (user = root)
connect (conn1,localhost,root,,);

--echo # Switch to connection default
connection default;
CREATE TABLE t1 (s1 int) Engine Falcon;
CREATE TABLE t2 (s1 int) Engine InnoDB;
SET @@autocommit = 0;
CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t2 VALUES (new.s1);
INSERT INTO t1 VALUES (5);
COMMIT;
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
START TRANSACTION;
INSERT INTO t1 VALUES (6);

--echo # Switch to connection conn1
connection conn1;
SET @@autocommit = 0;
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
START TRANSACTION;
--send DELETE FROM t1

--echo # Switch to connection default
connection default;
COMMIT;

--echo # Switch to connection conn1
connection conn1;
--reap
DELETE FROM t2;
COMMIT;

--echo # Switch to connection default
connection default;
SELECT * FROM t1;
SELECT * FROM t2;

# Final cleanup
disconnect conn1;
DROP TRIGGER t1_bi;
DROP TABLE t1;
DROP TABLE t2;
