2009-03-03 21:34:18 +01:00
|
|
|
# Establish connection con1 (user=root)
|
|
|
|
# Establish connection con2 (user=root)
|
|
|
|
# Establish connection con3 (user=root)
|
|
|
|
# Switch to connection con1
|
|
|
|
DROP TABLE IF EXISTS t1;
|
|
|
|
CREATE TABLE t1 (a INT) ENGINE=innodb;
|
|
|
|
BEGIN;
|
|
|
|
INSERT INTO t1 VALUES(1);
|
|
|
|
# Switch to connection con2
|
|
|
|
FLUSH TABLES WITH READ LOCK;
|
|
|
|
SELECT * FROM t1;
|
2004-08-20 16:35:23 +02:00
|
|
|
a
|
2009-03-03 21:34:18 +01:00
|
|
|
# Switch to connection con1
|
|
|
|
COMMIT;
|
|
|
|
# Switch to connection con2
|
|
|
|
SELECT * FROM t1;
|
2004-08-20 16:35:23 +02:00
|
|
|
a
|
2009-03-03 21:34:18 +01:00
|
|
|
UNLOCK TABLES;
|
|
|
|
# Switch to connection con1
|
|
|
|
# Switch to connection con1
|
|
|
|
BEGIN;
|
|
|
|
SELECT * FROM t1 FOR UPDATE;
|
2004-08-20 16:35:23 +02:00
|
|
|
a
|
|
|
|
1
|
2009-03-03 21:34:18 +01:00
|
|
|
# Switch to connection con2
|
|
|
|
BEGIN;
|
|
|
|
SELECT * FROM t1 FOR UPDATE;
|
|
|
|
# Switch to connection con3
|
|
|
|
FLUSH TABLES WITH READ LOCK;
|
|
|
|
# Switch to connection con1
|
|
|
|
COMMIT;
|
|
|
|
# Switch to connection con2
|
2004-08-20 16:35:23 +02:00
|
|
|
a
|
|
|
|
1
|
2009-03-03 21:34:18 +01:00
|
|
|
# Switch to connection con3
|
|
|
|
UNLOCK TABLES;
|
|
|
|
# Switch to connection con2
|
|
|
|
COMMIT;
|
|
|
|
# Switch to connection con1
|
|
|
|
BEGIN;
|
|
|
|
INSERT INTO t1 VALUES(10);
|
|
|
|
FLUSH TABLES WITH READ LOCK;
|
|
|
|
COMMIT;
|
|
|
|
UNLOCK TABLES;
|
|
|
|
# Switch to connection con2
|
|
|
|
FLUSH TABLES WITH READ LOCK;
|
|
|
|
UNLOCK TABLES;
|
|
|
|
BEGIN;
|
|
|
|
SELECT * FROM t1;
|
2004-12-17 23:37:43 +01:00
|
|
|
a
|
|
|
|
1
|
|
|
|
10
|
2009-03-03 21:34:18 +01:00
|
|
|
SHOW CREATE DATABASE test;
|
2004-12-17 23:37:43 +01:00
|
|
|
Database Create Database
|
|
|
|
test CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER SET latin1 */
|
2009-03-03 21:34:18 +01:00
|
|
|
DROP TABLE t1;
|
|
|
|
# Switch to connection default and close connections con1, con2, con3
|