1#
2# Testing of comments
3#
4
5select 1+2/*hello*/+3;
6select 1 /* long
7multi line comment */;
8--error 1065
9 ;
10select 1 /*!32301 +1 */;
11select 1 /*!952301 +1 */;
12select 1--1;
13# Note that the following returns 4 while it should return 2
14# This is because the mysqld server doesn't parse -- comments
15select 1 --2
16+1;
17select 1 # The rest of the row will be ignored
18;
19/* line with only comment */;
20
21# End of 4.1 tests
22
23#
24# Testing of MariaDB executable comments
25#
26
27select 1 /*M! +1 */;
28select 1 /*M!50000 +1 */;
29select 1 /*M!50300 +1 */;
30select 2 /*M!99999 +1 */;
31select 2 /*M!100000 +1 */;
32select 2 /*M!999999 +1 */;
33--error ER_PARSE_ERROR
34select 2 /*M!0000 +1 */;
35
36--echo #
37--echo # Testing that MySQL versions >= 5.7.x and < 10.0.0 are ignored (MDEV-5009)
38--echo #
39SELECT 1 /*!50699 +1*/;
40SELECT 1 /*!50700 +1*/;
41SELECT 1 /*!50999 +1*/;
42SELECT 1 /*!99999 +1*/;
43SELECT 1 /*!100000 +1*/;
44SELECT 1 /*!110000 +1*/;
45
46--echo #
47--echo # Tesing that versions >= 5.7.x and < 10.0.0 are not ignored
48--echo # when used with the MariaDB executable comment syntax.
49--echo #
50SELECT 1 /*M!50699 +1*/;
51SELECT 1 /*M!50700 +1*/;
52SELECT 1 /*M!50999 +1*/;
53SELECT 1 /*M!99999 +1*/;
54SELECT 1 /*M!100000 +1*/;
55SELECT 1 /*M!110000 +1*/;
56
57#
58# Bug#25411 (trigger code truncated)
59#
60
61--error ER_PARSE_ERROR
62select 1/*!2*/;
63
64--error ER_PARSE_ERROR
65select 1/*!0000002*/;
66
67select 1/*!999992*/;
68
69select 1 + /*!00000 2 */ + 3 /*!999999 noise*/ + 4;
70
71#
72# Bug#28779 (mysql_query() allows execution of statements with unbalanced
73# comments)
74#
75
76--disable_warnings
77drop table if exists table_28779;
78--enable_warnings
79
80create table table_28779 (a int);
81
82--error 1064
83prepare bar from "DELETE FROM table_28779 WHERE a = 7 OR 1=1/*' AND b = 'bar';";
84
85--error 1064
86prepare bar from "DELETE FROM table_28779 WHERE a = 7 OR 1=1/*' AND b = 'bar';*";
87
88--error 1064
89prepare bar from "DELETE FROM table_28779 WHERE a = 7 OR 1=1/*! AND 2=2;";
90
91--error 1064
92prepare bar from "DELETE FROM table_28779 WHERE a = 7 OR 1=1/*! AND 2=2;*";
93
94--error 1064
95prepare bar from "DELETE FROM table_28779 WHERE a = 7 OR 1=1/*!998765' AND b = 'bar';";
96
97--error 1064
98prepare bar from "DELETE FROM table_28779 WHERE a = 7 OR 1=1/*!998765' AND b = 'bar';*";
99
100drop table table_28779;
101
102