2
# SELECT .. LOCK IN SHARE MODE
4
# If the engine has its own lock timeouts,
5
# it makes sense to set them to minimum to decrease
6
# the duration of the test.
8
--source ../have_engine.inc
9
--source support_transactions.inc
12
DROP TABLE IF EXISTS t1;
17
--source include/count_sessions.inc
19
--source ../create_table.inc
20
INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'a');
22
--connect (con1,localhost,root,,)
25
SELECT a,b FROM t1 WHERE b='a' LOCK IN SHARE MODE;
28
--let $functionality = LOCK IN SHARE MODE
29
--source ../unexpected_result.inc
33
SET lock_wait_timeout = 1;
35
# Should still be able to select
38
SELECT a,b FROM t1 WHERE b='a';
41
--let $functionality = LOCK IN SHARE MODE
42
--source ../unexpected_result.inc
45
SELECT a,b FROM t1 WHERE b='a' LOCK IN SHARE MODE;
48
--let $functionality = LOCK IN SHARE MODE
49
--source ../unexpected_result.inc
52
--let $error_codes = ER_LOCK_WAIT_TIMEOUT
53
UPDATE t1 SET b='c' WHERE b='a';
54
--source ../check_errors.inc
55
if ($mysql_errname != ER_LOCK_WAIT_TIMEOUT)
57
--let $functionality = LOCK IN SHARE MODE or UPDATE
58
--source ../unexpected_result.inc
68
# Now it can be updated all right
69
UPDATE t1 SET b='c' WHERE b='a';
72
--let $functionality = UPDATE
73
--source ../unexpected_result.inc
80
--source include/wait_until_count_sessions.inc
81
--source ../cleanup_engine.inc