MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
tables.inc
1 # suite/funcs_1/datadict/tables.inc
2 #
3 # Auxiliary script to be sourced by
4 # is_tables_<engine>.test
5 #
6 # The variable $engine_type has to be assigned before sourcing ths script.
7 #
8 # Author:
9 # 2008-06-04 mleich Create this script based on older scripts and new code.
10 #
11 
12 # Just have some tables within different databases.
13 --disable_warnings
14 DROP DATABASE IF EXISTS test1;
15 DROP DATABASE IF EXISTS test2;
16 --enable_warnings
17 CREATE DATABASE test1;
18 CREATE DATABASE test2;
19 
20 --replace_result $engine_type <engine_to_be_used>
21 eval CREATE TABLE test1.t1 (f1 VARCHAR(20)) ENGINE = $engine_type;
22 --replace_result $engine_type <engine_to_be_used>
23 eval CREATE TABLE test1.t2 (f1 VARCHAR(20)) ENGINE = $engine_type;
24 --replace_result $engine_type <engine_to_be_used>
25 eval CREATE TABLE test2.t1 (f1 VARCHAR(20)) ENGINE = $engine_type;
26 
27 --source suite/funcs_1/datadict/tables2.inc
28 SHOW TABLES FROM test1;
29 SHOW TABLES FROM test2;
30 
31 # Create a low privileged user.
32 # Note: The database db_datadict is just a "home" for the low privileged user
33 # and not in the focus of testing.
34 --error 0,ER_CANNOT_USER
35 DROP USER testuser1@localhost;
36 CREATE USER testuser1@localhost;
37 GRANT SELECT ON test1.* TO testuser1@localhost;
38 
39 --echo # Establish connection testuser1 (user=testuser1)
40 --replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
41 connect (testuser1,localhost,testuser1,,test1);
42 --source suite/funcs_1/datadict/tables2.inc
43 SHOW TABLES FROM test1;
44 # The lowprivileged user testuser1 will get here an error.
45 --disable_abort_on_error
46 SHOW TABLES FROM test2;
47 --enable_abort_on_error
48 
49 --echo # Switch to connection default and close connection testuser1
50 connection default;
51 disconnect testuser1;
52 DROP USER testuser1@localhost;
53 
54 DROP DATABASE test1;
55 DROP DATABASE test2;