Current Path : /home/usr.opt/mysql57/mysql-test/suite/query_rewrite_plugins/r/ |
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 |
Current File : //home/usr.opt/mysql57/mysql-test/suite/query_rewrite_plugins/r/prepared_statements.result |
# # Test of prepared statements being rewritten. # CREATE TABLE t1 ( a INTEGER, b CHAR(1) ); INSERT INTO t1 VALUES ( 1, 'a' ), ( 2, 'b' ), ( 3, 'c' ); Warnings: Warning 1681 'RESET QUERY CACHE' is deprecated and will be removed in a future release. Warnings: Warning 1681 'RESET QUERY CACHE' is deprecated and will be removed in a future release. # Query rewrite plugin was installed. INSERT INTO query_rewrite.rewrite_rules ( pattern, replacement ) VALUES ( 'SELECT a FROM test.t1 WHERE a = ?', 'SELECT b FROM test.t1 WHERE a = ?' ), ( 'SELECT 1, ?', 'SELECT "rewritten"' ); CALL query_rewrite.flush_rewrite_rules(); Warnings: Warning 1681 'RESET QUERY CACHE' is deprecated and will be removed in a future release. SELECT a FROM test.t1 WHERE a = 1; b a Warnings: Note 1105 Query 'SELECT a FROM test.t1 WHERE a = 1' rewritten to 'SELECT b FROM test.t1 WHERE a = 1' by a query rewrite plugin PREPARE stmt1 FROM 'SELECT a FROM test.t1 WHERE a = 1'; Warnings: Note 1105 Query 'SELECT a FROM test.t1 WHERE a = 1' rewritten to 'SELECT b FROM test.t1 WHERE a = 1' by a query rewrite plugin EXECUTE stmt1; b a PREPARE stmt2 FROM 'SELECT a FROM test.t1 WHERE a = ?'; Warnings: Note 1105 Query 'SELECT a FROM test.t1 WHERE a = ?' rewritten to 'SELECT b FROM test.t1 WHERE a = ?' by a query rewrite plugin SET @var = 1; EXECUTE stmt2 USING @var; b a SET @var = 2; EXECUTE stmt2 USING @var; b b SET @var = 3; EXECUTE stmt2 USING @var; b c PREPARE stmt3 FROM 'SELECT 1, ?'; Warnings: Note 1105 Query 'SELECT 1, ?' rewritten to 'SELECT "rewritten"' by a query rewrite plugin SET @var= 1; EXECUTE stmt3; rewritten rewritten # Can't be rewritten. We rewrite at prepare time, when we don't know # the value of the first '?'. PREPARE stmt3 FROM 'SELECT ?, ?'; SET @var= 1; EXECUTE stmt3 USING @var, @var; ? ? 1 1 DROP TABLE t1; Warnings: Warning 1620 Plugin is busy and will be uninstalled on shutdown # Query rewrite plugin was queued for uninstalling.