mirror of
				https://github.com/MariaDB/server.git
				synced 2025-11-03 14:33:32 +03:00 
			
		
		
		
	
		
			
				
	
	
		
			101 lines
		
	
	
		
			4.7 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			101 lines
		
	
	
		
			4.7 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
install plugin test_sql_service soname 'test_sql_service';
 | 
						|
show status like 'test_sql_service_passed';
 | 
						|
Variable_name	Value
 | 
						|
Test_sql_service_passed	1
 | 
						|
reset master;
 | 
						|
set global test_sql_service_execute_sql_global= 'create table test.t1 select 1 as a, @@SQL_LOG_BIN';
 | 
						|
set global test_sql_service_execute_sql_local=  'insert into test.t1 select 2 as a, @@SQL_LOG_BIN';
 | 
						|
set global test_sql_service_execute_sql_global= 'SET SQL_LOG_BIN=1';
 | 
						|
set global test_sql_service_execute_sql_global= 'insert into test.t1 select 3 as a, @@SQL_LOG_BIN';
 | 
						|
set global test_sql_service_execute_sql_global= 'SET SQL_LOG_BIN=0';
 | 
						|
set global test_sql_service_execute_sql_global= 'insert into test.t1 select 4 as a, @@SQL_LOG_BIN';
 | 
						|
set global test_sql_service_execute_sql_global= 'SET sql_auto_is_null=1';
 | 
						|
set global test_sql_service_execute_sql_global= 'insert into test.t1 select 5 as a, @@sql_auto_is_null';
 | 
						|
set global test_sql_service_execute_sql_global= 'SET sql_auto_is_null=0';
 | 
						|
set global test_sql_service_execute_sql_global= 'insert into test.t1 select 6 as a, @@sql_auto_is_null';
 | 
						|
select * from t1 order by a;
 | 
						|
a	@@SQL_LOG_BIN
 | 
						|
1	0
 | 
						|
2	0
 | 
						|
3	1
 | 
						|
4	0
 | 
						|
5	1
 | 
						|
6	0
 | 
						|
drop table t1;
 | 
						|
SET SQL_LOG_BIN=0;
 | 
						|
set global test_sql_service_run_test= 1;
 | 
						|
show status like 'test_sql_service_passed';
 | 
						|
Variable_name	Value
 | 
						|
Test_sql_service_passed	1
 | 
						|
set global test_sql_service_execute_sql_local= 'create table test.t1(id int)';
 | 
						|
show status like 'test_sql_query_result';
 | 
						|
Variable_name	Value
 | 
						|
Test_sql_query_result	Query affected 0 rows.
 | 
						|
set global test_sql_service_execute_sql_local= 'insert into test.t1 values (1), (2)';
 | 
						|
show status like 'test_sql_query_result';
 | 
						|
Variable_name	Value
 | 
						|
Test_sql_query_result	Query affected 2 rows.
 | 
						|
set global test_sql_service_execute_sql_local= 'select * from test.t1';
 | 
						|
show status like 'test_sql_query_result';
 | 
						|
Variable_name	Value
 | 
						|
Test_sql_query_result	Query returned 2 rows.
 | 
						|
set global test_sql_service_execute_sql_local= 'drop table test.t1';
 | 
						|
show status like 'test_sql_query_result';
 | 
						|
Variable_name	Value
 | 
						|
Test_sql_query_result	Query affected 0 rows.
 | 
						|
set global test_sql_service_execute_sql_local= 'drop table test.t1';
 | 
						|
show status like 'test_sql_query_result';
 | 
						|
Variable_name	Value
 | 
						|
Test_sql_query_result	Error 1051 returned. Unknown table 'test.t1'
 | 
						|
set global test_sql_service_execute_sql_global= 'create table test.t1(id int)';
 | 
						|
show status like 'test_sql_query_result';
 | 
						|
Variable_name	Value
 | 
						|
Test_sql_query_result	Query affected 0 rows.
 | 
						|
set global test_sql_service_execute_sql_global= 'insert into test.t1 values (1), (2)';
 | 
						|
show status like 'test_sql_query_result';
 | 
						|
Variable_name	Value
 | 
						|
Test_sql_query_result	Query affected 2 rows.
 | 
						|
set global test_sql_service_execute_sql_global= 'select * from test.t1';
 | 
						|
show status like 'test_sql_query_result';
 | 
						|
Variable_name	Value
 | 
						|
Test_sql_query_result	Query returned 2 rows.
 | 
						|
set global test_sql_service_execute_sql_global= 'drop table test.t1';
 | 
						|
show status like 'test_sql_query_result';
 | 
						|
Variable_name	Value
 | 
						|
Test_sql_query_result	Query affected 0 rows.
 | 
						|
set global test_sql_service_execute_sql_global= 'drop table test.t1';
 | 
						|
show status like 'test_sql_query_result';
 | 
						|
Variable_name	Value
 | 
						|
Test_sql_query_result	Error 1051 returned. Unknown table 'test.t1'
 | 
						|
create table t1 (id int, time timestamp not null default now());
 | 
						|
insert into t1 values (1, NULL), (2, NULL), (3, NULL), (4, NULL), (5, NULL);
 | 
						|
set global test_sql_service_execute_sql_global= 'select * FROM test.t1 WHERE time < DATE_SUB(NOW(), interval 5 minute)';
 | 
						|
show status like 'test_sql_query_result';
 | 
						|
Variable_name	Value
 | 
						|
Test_sql_query_result	Query returned 0 rows.
 | 
						|
set global test_sql_service_execute_sql_global= 'select * FROM test.t1 WHERE time <= NOW()';
 | 
						|
show status like 'test_sql_query_result';
 | 
						|
Variable_name	Value
 | 
						|
Test_sql_query_result	Query returned 5 rows.
 | 
						|
set global test_sql_service_execute_sql_local= 'select * FROM test.t1 WHERE time < DATE_SUB(NOW(), interval 5 minute)';
 | 
						|
show status like 'test_sql_query_result';
 | 
						|
Variable_name	Value
 | 
						|
Test_sql_query_result	Query returned 0 rows.
 | 
						|
set global test_sql_service_execute_sql_local= 'select * FROM test.t1 WHERE time <= NOW()';
 | 
						|
show status like 'test_sql_query_result';
 | 
						|
Variable_name	Value
 | 
						|
Test_sql_query_result	Query returned 5 rows.
 | 
						|
drop table t1;
 | 
						|
uninstall plugin test_sql_service;
 | 
						|
Warnings:
 | 
						|
Warning	1620	Plugin is busy and will be uninstalled on shutdown
 | 
						|
include/show_binlog_events.inc
 | 
						|
Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 | 
						|
master-bin.000001	#	Gtid	#	#	BEGIN GTID #-#-#
 | 
						|
master-bin.000001	#	Annotate_rows	#	#	insert into test.t1 select 3 as a, @@SQL_LOG_BIN
 | 
						|
master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 | 
						|
master-bin.000001	#	Write_rows_v1	#	#	table_id: # flags: STMT_END_F
 | 
						|
master-bin.000001	#	Query	#	#	COMMIT
 | 
						|
master-bin.000001	#	Gtid	#	#	GTID #-#-#
 | 
						|
master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t1` /* generated by server */
 |