1 --echo ####################################
3 --echo ####################################
5 # -----------------------------------
6 # SQL Queries to test normalizations.
7 # -----------------------------------
11 SELECT 1, 2, 3, 4 FROM t1;
14 SELECT 1, 2, 3, 4 FROM t2;
17 INSERT INTO t1 VALUES (1);
18 INSERT INTO t2 VALUES (1);
21 INSERT INTO t3 VALUES (1, 2);
22 INSERT INTO t4 VALUES (1, 2);
23 # (NUM,NUM,NUM) => (#,#)
24 INSERT INTO t5 VALUES (1, 2, 3);
26 # (NUM),(NUM) => (#),(#)
27 INSERT INTO t1 VALUES (1), (2), (3);
28 # (NUM),(NUM),(NUM) => (#),(#)
29 INSERT INTO t1 VALUES (1), (2), (3), (4);
31 # (NUM,NUM),(NUM,NUM) => (#,#),(#,#)
32 INSERT INTO t3 VALUES (1, 2), (3, 4), (5, 6);
33 # (NUM,NUM,NUM),(NUM,NUM,NUM),(NUM,NUM,NUM) => (#,#),(#,#)
34 INSERT INTO t5 VALUES (1, 2, 3), (4, 5, 6), (7, 8, 9);
36 # -----------------------------------------------------------------------
37 # Test case to handle NULL. If alone, not normalized otherwise normalized.
38 # -----------------------------------------------------------------------
39 INSERT INTO t1 VALUES (NULL);
40 INSERT INTO t3 VALUES (NULL,NULL);
41 INSERT INTO t3 VALUES (1,NULL);
42 INSERT INTO t3 VALUES (NULL,1);
43 INSERT INTO t6 VALUES (NULL, NULL, NULL, NULL);
44 INSERT INTO t6 VALUES (1, NULL, NULL, NULL);
45 INSERT INTO t6 VALUES (NULL, 2, NULL, NULL);
46 INSERT INTO t6 VALUES (1, 2, 3, NULL);
47 INSERT INTO t6 VALUES (1, 2, NULL, 4);
49 # -----------------------------------------------------------------------
50 # Test case for handling spaces in statement.
51 # -----------------------------------------------------------------------
55 # -----------------------------------------------------------------------
56 # Test case for handling comments.
57 # -----------------------------------------------------------------------
59 # comment starting with "--"
60 # TODO : SELECT 1; -- This comment continues to the end of line
61 # comment starting from "#"
62 SELECT 1; # This comment continues
to the end of line
67 # Multiple line comments
75 # -----------------------------------------------------------------------
76 # Tests to show how the digest behaves with tokens that can have multiple
77 # names (such as DATABASE = "DATABASE" or "SCHEMA", SUBSTRING, STD_SYM,
79 # -----------------------------------------------------------------------
82 CREATE SCHEMA statements_digest_temp;
83 DROP SCHEMA statements_digest_temp;
84 CREATE DATABASE statements_digest_temp;
85 DROP DATABASE statements_digest_temp;
89 # -----------------------------------------------------------------------
90 # Test case to show stats for statements giving ERRORS/WARNINGS, are also
92 # -----------------------------------------------------------------------
93 --ERROR ER_NO_SUCH_TABLE
94 SELECT 1 FROM no_such_table;
95 CREATE
TABLE dup_table (c
char(4));
96 --ERROR ER_TABLE_EXISTS_ERROR
97 CREATE
TABLE dup_table (c
char(4));
99 INSERT INTO t11 VALUES(
"MySQL");
101 # -----------------------------------------------------------------------
102 # Tests to show sub-statements for following statements are not
104 # - Prepared Statements
105 # - Stored Procedures/Functions.
107 # -----------------------------------------------------------------------
108 PREPARE stmt FROM
"SELECT * FROM t12";
111 DEALLOCATE PREPARE stmt;
114 CREATE PROCEDURE p1() BEGIN SELECT * FROM t12; END
121 CREATE FUNCTION `func`(a INT, b INT) RETURNS
int(11) RETURN a+b
127 CREATE TRIGGER trg BEFORE INSERT ON t12 FOR EACH ROW SET @a:=1;
128 INSERT INTO t12 VALUES ("abc");
129 INSERT INTO t12 VALUES ("def");