mirror of
https://github.com/MariaDB/server.git
synced 2025-07-21 21:22:27 +03:00
MDEV-27595 Backport SQL service, introduced by MDEV-19275.
The SQL SERVICE backported into the 10.4.
This commit is contained in:
70
mysql-test/suite/plugins/r/test_sql_service.result
Normal file
70
mysql-test/suite/plugins/r/test_sql_service.result
Normal file
@ -0,0 +1,70 @@
|
||||
install plugin test_sql_service soname 'test_sql_service';
|
||||
show status like 'test_sql_service_passed';
|
||||
Variable_name Value
|
||||
Test_sql_service_passed 1
|
||||
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);
|
||||
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
|
60
mysql-test/suite/plugins/t/test_sql_service.test
Normal file
60
mysql-test/suite/plugins/t/test_sql_service.test
Normal file
@ -0,0 +1,60 @@
|
||||
--source include/not_embedded.inc
|
||||
|
||||
if (!$TEST_SQL_SERVICE_SO) {
|
||||
skip No TEST_SQL_SERVICE plugin;
|
||||
}
|
||||
|
||||
# An unfortunate wait for check-testcase.test to complete disconnect.
|
||||
let count_sessions= 1;
|
||||
source include/wait_until_count_sessions.inc;
|
||||
|
||||
install plugin test_sql_service soname 'test_sql_service';
|
||||
show status like 'test_sql_service_passed';
|
||||
|
||||
set global test_sql_service_run_test= 1;
|
||||
show status like 'test_sql_service_passed';
|
||||
|
||||
set global test_sql_service_execute_sql_local= 'create table test.t1(id int)';
|
||||
show status like 'test_sql_query_result';
|
||||
|
||||
set global test_sql_service_execute_sql_local= 'insert into test.t1 values (1), (2)';
|
||||
show status like 'test_sql_query_result';
|
||||
|
||||
set global test_sql_service_execute_sql_local= 'select * from test.t1';
|
||||
show status like 'test_sql_query_result';
|
||||
|
||||
set global test_sql_service_execute_sql_local= 'drop table test.t1';
|
||||
show status like 'test_sql_query_result';
|
||||
|
||||
set global test_sql_service_execute_sql_local= 'drop table test.t1';
|
||||
show status like 'test_sql_query_result';
|
||||
|
||||
set global test_sql_service_execute_sql_global= 'create table test.t1(id int)';
|
||||
show status like 'test_sql_query_result';
|
||||
|
||||
set global test_sql_service_execute_sql_global= 'insert into test.t1 values (1), (2)';
|
||||
show status like 'test_sql_query_result';
|
||||
|
||||
set global test_sql_service_execute_sql_global= 'select * from test.t1';
|
||||
show status like 'test_sql_query_result';
|
||||
|
||||
set global test_sql_service_execute_sql_global= 'drop table test.t1';
|
||||
show status like 'test_sql_query_result';
|
||||
|
||||
set global test_sql_service_execute_sql_global= 'drop table test.t1';
|
||||
show status like 'test_sql_query_result';
|
||||
|
||||
create table t1 (id int, time timestamp);
|
||||
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';
|
||||
set global test_sql_service_execute_sql_global= 'select * FROM test.t1 WHERE time <= NOW()';
|
||||
show status like 'test_sql_query_result';
|
||||
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';
|
||||
set global test_sql_service_execute_sql_local= 'select * FROM test.t1 WHERE time <= NOW()';
|
||||
show status like 'test_sql_query_result';
|
||||
drop table t1;
|
||||
|
||||
uninstall plugin test_sql_service;
|
||||
|
Reference in New Issue
Block a user