config root man

Current Path : /usr/opt/mysql57/mysql-test/suite/query_rewrite_plugins/t/

FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64
Upload File :
Current File : //usr/opt/mysql57/mysql-test/suite/query_rewrite_plugins/t/disabled_rule.test

--echo #
--echo # Test of disabled rules ('NO' in enabled column.)
--echo #

--source suite/query_rewrite_plugins/include/have_plugin_rewriter.inc

CREATE TABLE t1 ( c1 VARCHAR(10), c2 VARCHAR(10) );

INSERT INTO t1 VALUES ( 'abc', 'def' ), ( 'ghi', 'klm' ), ( 'nop', 'qrs' );

CREATE TABLE t2 ( c1 VARCHAR(10) );

INSERT INTO t2 VALUES ( 'abc' ), ( 'klm' );

--source suite/query_rewrite_plugins/include/install_rewriter.inc

INSERT INTO query_rewrite.rewrite_rules ( pattern, replacement, enabled )
VALUES ( 'SELECT * FROM test.t2',
         'SELECT * FROM test.t1 JOIN test.t2 ON test.t1.c1 = test.t2.c1', 'NO'
         );

CALL query_rewrite.flush_rewrite_rules();

--echo # Check that the rewrite rule is not executed.
SELECT * FROM test.t2;

--echo # Check that the rule is indeed disabled.
SELECT pattern, replacement, enabled FROM query_rewrite.rewrite_rules;

--echo # Enable the previously disabled rule.
UPDATE query_rewrite.rewrite_rules
SET enabled = 'YES'
WHERE pattern = 'SELECT * FROM test.t2';

CALL query_rewrite.flush_rewrite_rules();

--echo # Verify that the rewrite rule is enabled.
SELECT * FROM test.t2;

--echo # Disable via UPDATE...
UPDATE query_rewrite.rewrite_rules
SET enabled = 'NO'
WHERE pattern = 'SELECT * FROM test.t2';

CALL query_rewrite.flush_rewrite_rules();

--echo # Verify that the rewrite rule is disabled again.
SELECT * FROM test.t2;

DROP TABLE t1, t2;
--source suite/query_rewrite_plugins/include/uninstall_rewriter.inc

Man Man