| 1 |
install plugin test_sql_service soname 'test_sql_service'; |
| 2 |
show status like 'test_sql_service_passed'; |
| 3 |
Variable_name Value |
| 4 |
Test_sql_service_passed 1 |
| 5 |
reset master; |
| 6 |
set global test_sql_service_execute_sql_global= 'create table test.t1 select 1 as a, @@SQL_LOG_BIN'; |
| 7 |
set global test_sql_service_execute_sql_local= 'insert into test.t1 select 2 as a, @@SQL_LOG_BIN'; |
| 8 |
set global test_sql_service_execute_sql_global= 'SET SQL_LOG_BIN=1'; |
| 9 |
set global test_sql_service_execute_sql_global= 'insert into test.t1 select 3 as a, @@SQL_LOG_BIN'; |
| 10 |
set global test_sql_service_execute_sql_global= 'SET SQL_LOG_BIN=0'; |
| 11 |
set global test_sql_service_execute_sql_global= 'insert into test.t1 select 4 as a, @@SQL_LOG_BIN'; |
| 12 |
set global test_sql_service_execute_sql_global= 'SET sql_auto_is_null=1'; |
| 13 |
set global test_sql_service_execute_sql_global= 'insert into test.t1 select 5 as a, @@sql_auto_is_null'; |
| 14 |
set global test_sql_service_execute_sql_global= 'SET sql_auto_is_null=0'; |
| 15 |
set global test_sql_service_execute_sql_global= 'insert into test.t1 select 6 as a, @@sql_auto_is_null'; |
| 16 |
select * from t1 order by a; |
| 17 |
a @@SQL_LOG_BIN |
| 18 |
1 0 |
| 19 |
2 0 |
| 20 |
3 1 |
| 21 |
4 0 |
| 22 |
5 1 |
| 23 |
6 0 |
| 24 |
drop table t1; |
| 25 |
SET SQL_LOG_BIN=0; |
| 26 |
set global test_sql_service_run_test= 1; |
| 27 |
show status like 'test_sql_service_passed'; |
| 28 |
Variable_name Value |
| 29 |
Test_sql_service_passed 1 |
| 30 |
set global test_sql_service_execute_sql_local= 'create table test.t1(id int)'; |
| 31 |
show status like 'test_sql_query_result'; |
| 32 |
Variable_name Value |
| 33 |
Test_sql_query_result Query affected 0 rows. |
| 34 |
set global test_sql_service_execute_sql_local= 'insert into test.t1 values (1), (2)'; |
| 35 |
show status like 'test_sql_query_result'; |
| 36 |
Variable_name Value |
| 37 |
Test_sql_query_result Query affected 2 rows. |
| 38 |
set global test_sql_service_execute_sql_local= 'select * from test.t1'; |
| 39 |
show status like 'test_sql_query_result'; |
| 40 |
Variable_name Value |
| 41 |
Test_sql_query_result Query returned 2 rows. |
| 42 |
set global test_sql_service_execute_sql_local= 'drop table test.t1'; |
| 43 |
show status like 'test_sql_query_result'; |
| 44 |
Variable_name Value |
| 45 |
Test_sql_query_result Query affected 0 rows. |
| 46 |
set global test_sql_service_execute_sql_local= 'drop table test.t1'; |
| 47 |
show status like 'test_sql_query_result'; |
| 48 |
Variable_name Value |
| 49 |
Test_sql_query_result Error 1051 returned. Unknown table 'test.t1' |
| 50 |
set global test_sql_service_execute_sql_global= 'create table test.t1(id int)'; |
| 51 |
show status like 'test_sql_query_result'; |
| 52 |
Variable_name Value |
| 53 |
Test_sql_query_result Query affected 0 rows. |
| 54 |
set global test_sql_service_execute_sql_global= 'insert into test.t1 values (1), (2)'; |
| 55 |
show status like 'test_sql_query_result'; |
| 56 |
Variable_name Value |
| 57 |
Test_sql_query_result Query affected 2 rows. |
| 58 |
set global test_sql_service_execute_sql_global= 'select * from test.t1'; |
| 59 |
show status like 'test_sql_query_result'; |
| 60 |
Variable_name Value |
| 61 |
Test_sql_query_result Query returned 2 rows. |
| 62 |
set global test_sql_service_execute_sql_global= 'drop table test.t1'; |
| 63 |
show status like 'test_sql_query_result'; |
| 64 |
Variable_name Value |
| 65 |
Test_sql_query_result Query affected 0 rows. |
| 66 |
set global test_sql_service_execute_sql_global= 'drop table test.t1'; |
| 67 |
show status like 'test_sql_query_result'; |
| 68 |
Variable_name Value |
| 69 |
Test_sql_query_result Error 1051 returned. Unknown table 'test.t1' |
| 70 |
create table t1 (id int, time timestamp not null default now()); |
| 71 |
insert into t1 values (1, NULL), (2, NULL), (3, NULL), (4, NULL), (5, NULL); |
| 72 |
set global test_sql_service_execute_sql_global= 'select * FROM test.t1 WHERE time < DATE_SUB(NOW(), interval 5 minute)'; |
| 73 |
show status like 'test_sql_query_result'; |
| 74 |
Variable_name Value |
| 75 |
Test_sql_query_result Query returned 0 rows. |
| 76 |
set global test_sql_service_execute_sql_global= 'select * FROM test.t1 WHERE time <= NOW()'; |
| 77 |
show status like 'test_sql_query_result'; |
| 78 |
Variable_name Value |
| 79 |
Test_sql_query_result Query returned 5 rows. |
| 80 |
set global test_sql_service_execute_sql_local= 'select * FROM test.t1 WHERE time < DATE_SUB(NOW(), interval 5 minute)'; |
| 81 |
show status like 'test_sql_query_result'; |
| 82 |
Variable_name Value |
| 83 |
Test_sql_query_result Query returned 0 rows. |
| 84 |
set global test_sql_service_execute_sql_local= 'select * FROM test.t1 WHERE time <= NOW()'; |
| 85 |
show status like 'test_sql_query_result'; |
| 86 |
Variable_name Value |
| 87 |
Test_sql_query_result Query returned 5 rows. |
| 88 |
drop table t1; |
| 89 |
uninstall plugin test_sql_service; |
| 90 |
Warnings: |
| 91 |
Warning 1620 Plugin is busy and will be uninstalled on shutdown |
| 92 |
include/show_binlog_events.inc |
| 93 |
Log_name Pos Event_type Server_id End_log_pos Info |
| 94 |
master-bin.000001 # Gtid # # BEGIN GTID #-#-# |
| 95 |
master-bin.000001 # Annotate_rows # # insert into test.t1 select 3 as a, @@SQL_LOG_BIN |
| 96 |
master-bin.000001 # Table_map # # table_id: # (test.t1) |
| 97 |
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F |
| 98 |
master-bin.000001 # Query # # COMMIT |
| 99 |
master-bin.000001 # Gtid # # GTID #-#-# |
| 100 |
master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ |