1# suite/funcs_1/datadict/is_table_query.inc
2#
3# Check that every INFORMATION_SCHEMA table can be queried with a SELECT
4# statement, just as if it were an ordinary user-defined table.
5# (Requirement 3.2.1.1)
6#
7# The variable $is_table must be set before sourcing this script.
8#
9# Author:
10# 2008-01-23 mleich WL#4203 Reorganize and fix the data dictionary tests of
11#                           testsuite funcs_1
12#                   Create this script based on older scripts and new code.
13#
14--disable_warnings
15DROP VIEW      IF EXISTS test.v1;
16DROP PROCEDURE IF EXISTS test.p1;
17DROP FUNCTION  IF EXISTS test.f1;
18--enable_warnings
19eval CREATE VIEW test.v1 AS     SELECT * FROM information_schema.$is_table;
20eval CREATE PROCEDURE test.p1() SELECT * FROM information_schema.$is_table;
21delimiter //;
22eval CREATE FUNCTION test.f1() returns BIGINT
23BEGIN
24   DECLARE counter BIGINT DEFAULT NULL;
25   SELECT COUNT(*) INTO counter FROM information_schema.$is_table;
26   RETURN counter;
27END//
28delimiter ;//
29
30
31# We are not interested to check the content here.
32--echo # Attention: The printing of the next result sets is disabled.
33--disable_result_log
34eval SELECT * FROM information_schema.$is_table;
35SELECT * FROM test.v1;
36CALL test.p1;
37SELECT test.f1();
38--enable_result_log
39
40DROP VIEW test.v1;
41DROP PROCEDURE test.p1;
42DROP FUNCTION test.f1;
43