Debian Codegraph @

mysql-test/suite/plugins/t/test_sql_service.test

raw
1 --source include/not_embedded.inc
2 --source include/have_log_bin.inc
3
4 if (!$TEST_SQL_SERVICE_SO) {
5 skip No TEST_SQL_SERVICE plugin;
6 }
7
8 # An unfortunate wait for check-testcase.inc to complete disconnect.
9 let count_sessions= 1;
10 source include/wait_until_count_sessions.inc;
11
12 install plugin test_sql_service soname 'test_sql_service';
13 show status like 'test_sql_service_passed';
14 reset master;
15
16 set global test_sql_service_execute_sql_global= 'create table test.t1 select 1 as a, @@SQL_LOG_BIN';
17 set global test_sql_service_execute_sql_local= 'insert into test.t1 select 2 as a, @@SQL_LOG_BIN';
18 set global test_sql_service_execute_sql_global= 'SET SQL_LOG_BIN=1';
19 set global test_sql_service_execute_sql_global= 'insert into test.t1 select 3 as a, @@SQL_LOG_BIN';
20 set global test_sql_service_execute_sql_global= 'SET SQL_LOG_BIN=0';
21 set global test_sql_service_execute_sql_global= 'insert into test.t1 select 4 as a, @@SQL_LOG_BIN';
22 set global test_sql_service_execute_sql_global= 'SET sql_auto_is_null=1';
23 set global test_sql_service_execute_sql_global= 'insert into test.t1 select 5 as a, @@sql_auto_is_null';
24 set global test_sql_service_execute_sql_global= 'SET sql_auto_is_null=0';
25 set global test_sql_service_execute_sql_global= 'insert into test.t1 select 6 as a, @@sql_auto_is_null';
26 select * from t1 order by a;
27 drop table t1;
28 SET SQL_LOG_BIN=0;
29
30 set global test_sql_service_run_test= 1;
31 show status like 'test_sql_service_passed';
32
33 set global test_sql_service_execute_sql_local= 'create table test.t1(id int)';
34 show status like 'test_sql_query_result';
35
36 set global test_sql_service_execute_sql_local= 'insert into test.t1 values (1), (2)';
37 show status like 'test_sql_query_result';
38
39 set global test_sql_service_execute_sql_local= 'select * from test.t1';
40 show status like 'test_sql_query_result';
41
42 set global test_sql_service_execute_sql_local= 'drop table test.t1';
43 show status like 'test_sql_query_result';
44
45 set global test_sql_service_execute_sql_local= 'drop table test.t1';
46 show status like 'test_sql_query_result';
47
48 set global test_sql_service_execute_sql_global= 'create table test.t1(id int)';
49 show status like 'test_sql_query_result';
50
51 set global test_sql_service_execute_sql_global= 'insert into test.t1 values (1), (2)';
52 show status like 'test_sql_query_result';
53
54 set global test_sql_service_execute_sql_global= 'select * from test.t1';
55 show status like 'test_sql_query_result';
56
57 set global test_sql_service_execute_sql_global= 'drop table test.t1';
58 show status like 'test_sql_query_result';
59
60 set global test_sql_service_execute_sql_global= 'drop table test.t1';
61 show status like 'test_sql_query_result';
62
63 create table t1 (id int, time timestamp not null default now());
64 insert into t1 values (1, NULL), (2, NULL), (3, NULL), (4, NULL), (5, NULL);
65 set global test_sql_service_execute_sql_global= 'select * FROM test.t1 WHERE time < DATE_SUB(NOW(), interval 5 minute)';
66 show status like 'test_sql_query_result';
67 set global test_sql_service_execute_sql_global= 'select * FROM test.t1 WHERE time <= NOW()';
68 show status like 'test_sql_query_result';
69 set global test_sql_service_execute_sql_local= 'select * FROM test.t1 WHERE time < DATE_SUB(NOW(), interval 5 minute)';
70 show status like 'test_sql_query_result';
71 set global test_sql_service_execute_sql_local= 'select * FROM test.t1 WHERE time <= NOW()';
72 show status like 'test_sql_query_result';
73 drop table t1;
74
75 uninstall plugin test_sql_service;
76
77 # Check that statements were executed/binlogged in correct order.
78 --source include/show_binlog_events.inc
79 # --replace_column 2 # 5 #
80 # --replace_regex /xid=[0-9]+/xid=XX/ /GTID [0-9]+-[0-9]+-[0-9]+/GTID #-#-#/
81 # SHOW BINLOG EVENTS LIMIT 3,5;