Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Commit 392a956

Browse files
committed
Add a test for the sys_config table and its associated triggers.
1 parent 6f433de commit 392a956

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Reset the sys.sys_config table
2+
3+
# Note, we can *not* reset the set_by column back to NULL
4+
# as the sys.sys_config_update_set_user trigger will overwrite it to the current user
5+
UPDATE sys.sys_config SET value = 64 WHERE variable = 'statement_truncate_len';
6+
7+
DELETE FROM sys.sys_config WHERE variable NOT IN ('statement_truncate_len');
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
DESC sys.sys_config;
2+
Field Type Null Key Default Extra
3+
variable varchar(128) NO PRI NULL
4+
value varchar(128) YES NULL
5+
set_time timestamp NO CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP
6+
set_by varchar(128) YES NULL
7+
SELECT variable, value, set_by FROM sys.sys_config;
8+
variable value set_by
9+
statement_truncate_len 64 NULL
10+
UPDATE sys.sys_config SET value = 128 WHERE variable = 'statement_truncate_len';
11+
SELECT variable, value, set_by FROM sys.sys_config;
12+
variable value set_by
13+
statement_truncate_len 128 root@localhost
14+
INSERT INTO sys.sys_config (variable, value) VALUES ('foo', 'bar');
15+
SELECT variable, value, set_by FROM sys.sys_config;
16+
variable value set_by
17+
foo bar root@localhost
18+
statement_truncate_len 128 root@localhost
19+
UPDATE sys.sys_config SET value = 64 WHERE variable = 'statement_truncate_len';
20+
DELETE FROM sys.sys_config WHERE variable NOT IN ('statement_truncate_len');
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Tests for sys schema
2+
# Verify the sys.sys_config table is as expected
3+
4+
DESC sys.sys_config;
5+
6+
SELECT variable, value, set_by FROM sys.sys_config;
7+
8+
# Ensure the sys.sys_config_update_set_user trigger functions correctly
9+
UPDATE sys.sys_config SET value = 128 WHERE variable = 'statement_truncate_len';
10+
11+
SELECT variable, value, set_by FROM sys.sys_config;
12+
13+
# Ensure the sys.sys_config_insert_set_user trigger functions correctly
14+
INSERT INTO sys.sys_config (variable, value) VALUES ('foo', 'bar');
15+
16+
SELECT variable, value, set_by FROM sys.sys_config;
17+
18+
--source ../include/sys_config_cleanup.inc

0 commit comments

Comments
 (0)