-
Notifications
You must be signed in to change notification settings - Fork 31
/
mytap-global-576.sql
41 lines (31 loc) · 1010 Bytes
/
mytap-global-576.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
-- 5.7.6 and upwards
USE tap;
DELIMITER //
/************************************************************************************/
-- Check the state of GLOBAL variables
DROP FUNCTION IF EXISTS _global_var //
CREATE FUNCTION _global_var(var VARCHAR(64))
RETURNS VARCHAR(1024)
DETERMINISTIC
BEGIN
DECLARE ret VARCHAR(1024);
SELECT `variable_value` INTO ret
FROM `performance_schema`.`global_variables`
WHERE `variable_name` = var;
RETURN COALESCE(ret, 0);
END //
DROP FUNCTION IF EXISTS global_is //
CREATE FUNCTION global_is(var VARCHAR(64), want VARCHAR(1024), description TEXT)
RETURNS TEXT
DETERMINISTIC
BEGIN
IF description = '' THEN
SET description = CONCAT('@@GLOBAL.' , var, ' should be correctly set');
END IF;
IF NOT tap.mysql_version() >= 507006 THEN
RETURN CONCAT(ok(FALSE, description),'\n',
diag (CONCAT('This version of MySQL requires the previous version of this function')));
END IF;
RETURN eq(_global_var(var), want, description);
END //
DELIMITER ;