Debian Codegraph @

mysql-test/suite/query_rewrite_plugins/t/character_set.test

raw
1 --echo #
2 --echo # Tests that the character set setting is properly picked up by the
3 --echo # session that reads the rules table.
4 --echo #
5
6 --source suite/query_rewrite_plugins/include/have_plugin_rewriter.inc
7 --source suite/query_rewrite_plugins/include/install_rewriter_with_optional_columns.inc
8
9 --source suite/query_rewrite_plugins/include/trivial.inc
10
11 --echo # We now set the global value of the variable, this should not affect
12 --echo # the plugin. It should copy the session value from our session.
13 SET @@global.character_set_client = utf8mb4;
14
15 SELECT * FROM mydb.mytable WHERE mycol = 'xxx';
16
17 --echo # Regenerating the digests should still work.
18 CALL query_rewrite.flush_rewrite_rules();
19 SELECT * FROM mydb.mytable WHERE mycol = 'xxx';
20
21 --echo # We now repeat the above test with a character set where the digests
22 --echo # are known to differ. If we were lucky the last time, it will show now.
23 --echo # The global setting should still be ignored.
24 SET @@global.character_set_client = latin1;
25 SELECT * FROM mydb.mytable WHERE mycol = 'xxx';
26
27 --echo # Regenerating the digests should still work.
28 CALL query_rewrite.flush_rewrite_rules();
29 SELECT * FROM mydb.mytable WHERE mycol = 'xxx';
30
31 SET @@global.character_set_client = DEFAULT;
32
33 --echo #
34 --echo # This is perhaps an unwanted result, but the rules table-reading
35 --echo # session can't access our session's setting.
36 --echo #
37 SET @@session.character_set_client = utf8mb4;
38 --source suite/query_rewrite_plugins/include/trivial.inc
39 SET @@session.character_set_client = DEFAULT;
40
41 --source suite/query_rewrite_plugins/include/uninstall_rewriter.inc