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
14DROP DATABASE IF EXISTS test1;
15DROP DATABASE IF EXISTS test2;
16--enable_warnings
17CREATE DATABASE test1;
18CREATE DATABASE test2;
19
20--replace_result $engine_type <engine_to_be_used>
21eval CREATE TABLE test1.t1  (f1 VARCHAR(20)) ENGINE = $engine_type;
22--replace_result $engine_type <engine_to_be_used>
23eval CREATE TABLE test1.t2  (f1 VARCHAR(20)) ENGINE = $engine_type;
24--replace_result $engine_type <engine_to_be_used>
25eval CREATE TABLE test2.t1 (f1 VARCHAR(20)) ENGINE = $engine_type;
26
27--source suite/funcs_1/datadict/tables2.inc
28SHOW TABLES FROM test1;
29SHOW 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
35DROP   USER testuser1@localhost;
36CREATE USER testuser1@localhost;
37GRANT 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
41connect (testuser1,localhost,testuser1,,test1);
42--source suite/funcs_1/datadict/tables2.inc
43SHOW TABLES FROM test1;
44# The lowprivileged user testuser1 will get here an error.
45--disable_abort_on_error
46SHOW TABLES FROM test2;
47--enable_abort_on_error
48
49--echo # Switch to connection default and close connection testuser1
50connection default;
51disconnect testuser1;
52DROP USER testuser1@localhost;
53
54DROP DATABASE test1;
55DROP DATABASE test2;
56