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--source include/default_charset.inc
13
14# Just have some tables within different databases.
15--disable_warnings
16DROP DATABASE IF EXISTS test1;
17DROP DATABASE IF EXISTS test2;
18--enable_warnings
19CREATE DATABASE test1;
20CREATE DATABASE test2;
21
22--replace_result $engine_type <engine_to_be_used>
23eval CREATE TABLE test1.t1  (f1 VARCHAR(20)) ENGINE = $engine_type;
24--replace_result $engine_type <engine_to_be_used>
25eval CREATE TABLE test1.t2  (f1 VARCHAR(20)) ENGINE = $engine_type;
26--replace_result $engine_type <engine_to_be_used>
27eval CREATE TABLE test2.t1 (f1 VARCHAR(20)) ENGINE = $engine_type;
28
29--source suite/funcs_1/datadict/tables2.inc
30SHOW TABLES FROM test1;
31SHOW TABLES FROM test2;
32
33# Create a low privileged user.
34# Note: The database db_datadict is just a "home" for the low privileged user
35#       and not in the focus of testing.
36--error 0,ER_CANNOT_USER
37DROP   USER testuser1@localhost;
38CREATE USER testuser1@localhost;
39GRANT SELECT ON test1.* TO testuser1@localhost;
40
41--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
42connect (testuser1,localhost,testuser1,,test1);
43--source suite/funcs_1/datadict/tables2.inc
44SHOW TABLES FROM test1;
45# The lowprivileged user testuser1 will get here an error.
46--disable_abort_on_error
47SHOW TABLES FROM test2;
48--enable_abort_on_error
49
50connection default;
51disconnect testuser1;
52DROP USER testuser1@localhost;
53
54DROP DATABASE test1;
55DROP DATABASE test2;
56