Skip to content

Commit 794c74c

Browse files
committed
Ref #445 - Add more test cases for DESCRIBE
Signed-off-by: William Desportes <[email protected]>
1 parent 6a8e2df commit 794c74c

9 files changed

Lines changed: 1090 additions & 0 deletions

tests/Parser/ExplainStatementTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ public function explainProvider(): array
3232
['parser/parseExplain7'],
3333
['parser/parseExplain8'],
3434
['parser/parseExplain9'],
35+
['parser/parseExplain10'],
36+
['parser/parseExplain11'],
37+
['parser/parseExplain12'],
38+
['parser/parseExplain13'],
3539
['parser/parseExplainErr'],
3640
['parser/parseExplainErr1'],
3741
['parser/parseExplainErr2'],
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
DESC REPLACE INTO test VALUES (1, 'Old', '2014-08-20 18:47:00');
Lines changed: 252 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,252 @@
1+
{
2+
"query": "DESC REPLACE INTO test VALUES (1, 'Old', '2014-08-20 18:47:00');",
3+
"lexer": {
4+
"@type": "PhpMyAdmin\\SqlParser\\Lexer",
5+
"str": "DESC REPLACE INTO test VALUES (1, 'Old', '2014-08-20 18:47:00');",
6+
"len": 64,
7+
"last": 64,
8+
"list": {
9+
"@type": "PhpMyAdmin\\SqlParser\\TokensList",
10+
"tokens": [
11+
{
12+
"@type": "PhpMyAdmin\\SqlParser\\Token",
13+
"token": "DESC",
14+
"value": "DESC",
15+
"keyword": "DESC",
16+
"type": 1,
17+
"flags": 3,
18+
"position": 0
19+
},
20+
{
21+
"@type": "PhpMyAdmin\\SqlParser\\Token",
22+
"token": " ",
23+
"value": " ",
24+
"keyword": null,
25+
"type": 3,
26+
"flags": 0,
27+
"position": 4
28+
},
29+
{
30+
"@type": "PhpMyAdmin\\SqlParser\\Token",
31+
"token": "REPLACE",
32+
"value": "REPLACE",
33+
"keyword": "REPLACE",
34+
"type": 1,
35+
"flags": 35,
36+
"position": 5
37+
},
38+
{
39+
"@type": "PhpMyAdmin\\SqlParser\\Token",
40+
"token": " ",
41+
"value": " ",
42+
"keyword": null,
43+
"type": 3,
44+
"flags": 0,
45+
"position": 12
46+
},
47+
{
48+
"@type": "PhpMyAdmin\\SqlParser\\Token",
49+
"token": "INTO",
50+
"value": "INTO",
51+
"keyword": "INTO",
52+
"type": 1,
53+
"flags": 3,
54+
"position": 13
55+
},
56+
{
57+
"@type": "PhpMyAdmin\\SqlParser\\Token",
58+
"token": " ",
59+
"value": " ",
60+
"keyword": null,
61+
"type": 3,
62+
"flags": 0,
63+
"position": 17
64+
},
65+
{
66+
"@type": "PhpMyAdmin\\SqlParser\\Token",
67+
"token": "test",
68+
"value": "test",
69+
"keyword": null,
70+
"type": 0,
71+
"flags": 0,
72+
"position": 18
73+
},
74+
{
75+
"@type": "PhpMyAdmin\\SqlParser\\Token",
76+
"token": " ",
77+
"value": " ",
78+
"keyword": null,
79+
"type": 3,
80+
"flags": 0,
81+
"position": 22
82+
},
83+
{
84+
"@type": "PhpMyAdmin\\SqlParser\\Token",
85+
"token": "VALUES",
86+
"value": "VALUES",
87+
"keyword": "VALUES",
88+
"type": 1,
89+
"flags": 35,
90+
"position": 23
91+
},
92+
{
93+
"@type": "PhpMyAdmin\\SqlParser\\Token",
94+
"token": " ",
95+
"value": " ",
96+
"keyword": null,
97+
"type": 3,
98+
"flags": 0,
99+
"position": 29
100+
},
101+
{
102+
"@type": "PhpMyAdmin\\SqlParser\\Token",
103+
"token": "(",
104+
"value": "(",
105+
"keyword": null,
106+
"type": 2,
107+
"flags": 16,
108+
"position": 30
109+
},
110+
{
111+
"@type": "PhpMyAdmin\\SqlParser\\Token",
112+
"token": "1",
113+
"value": 1,
114+
"keyword": null,
115+
"type": 6,
116+
"flags": 0,
117+
"position": 31
118+
},
119+
{
120+
"@type": "PhpMyAdmin\\SqlParser\\Token",
121+
"token": ",",
122+
"value": ",",
123+
"keyword": null,
124+
"type": 2,
125+
"flags": 16,
126+
"position": 32
127+
},
128+
{
129+
"@type": "PhpMyAdmin\\SqlParser\\Token",
130+
"token": " ",
131+
"value": " ",
132+
"keyword": null,
133+
"type": 3,
134+
"flags": 0,
135+
"position": 33
136+
},
137+
{
138+
"@type": "PhpMyAdmin\\SqlParser\\Token",
139+
"token": "'Old'",
140+
"value": "Old",
141+
"keyword": null,
142+
"type": 7,
143+
"flags": 1,
144+
"position": 34
145+
},
146+
{
147+
"@type": "PhpMyAdmin\\SqlParser\\Token",
148+
"token": ",",
149+
"value": ",",
150+
"keyword": null,
151+
"type": 2,
152+
"flags": 16,
153+
"position": 39
154+
},
155+
{
156+
"@type": "PhpMyAdmin\\SqlParser\\Token",
157+
"token": " ",
158+
"value": " ",
159+
"keyword": null,
160+
"type": 3,
161+
"flags": 0,
162+
"position": 40
163+
},
164+
{
165+
"@type": "PhpMyAdmin\\SqlParser\\Token",
166+
"token": "'2014-08-20 18:47:00'",
167+
"value": "2014-08-20 18:47:00",
168+
"keyword": null,
169+
"type": 7,
170+
"flags": 1,
171+
"position": 41
172+
},
173+
{
174+
"@type": "PhpMyAdmin\\SqlParser\\Token",
175+
"token": ")",
176+
"value": ")",
177+
"keyword": null,
178+
"type": 2,
179+
"flags": 16,
180+
"position": 62
181+
},
182+
{
183+
"@type": "PhpMyAdmin\\SqlParser\\Token",
184+
"token": ";",
185+
"value": ";",
186+
"keyword": null,
187+
"type": 9,
188+
"flags": 0,
189+
"position": 63
190+
},
191+
{
192+
"@type": "PhpMyAdmin\\SqlParser\\Token",
193+
"token": null,
194+
"value": null,
195+
"keyword": null,
196+
"type": 9,
197+
"flags": 0,
198+
"position": null
199+
}
200+
],
201+
"count": 21,
202+
"idx": 21
203+
},
204+
"delimiter": ";",
205+
"delimiterLen": 1,
206+
"strict": false,
207+
"errors": []
208+
},
209+
"parser": {
210+
"@type": "PhpMyAdmin\\SqlParser\\Parser",
211+
"list": {
212+
"@type": "@1"
213+
},
214+
"statements": [
215+
{
216+
"@type": "PhpMyAdmin\\SqlParser\\Statements\\ExplainStatement",
217+
"bodyParser": null,
218+
"statementAlias": "DESC",
219+
"connectionId": null,
220+
"explainedTable": null,
221+
"options": {
222+
"@type": "PhpMyAdmin\\SqlParser\\Components\\OptionsArray",
223+
"options": []
224+
},
225+
"first": 0,
226+
"last": 2
227+
}
228+
],
229+
"brackets": 0,
230+
"strict": false,
231+
"errors": []
232+
},
233+
"errors": {
234+
"lexer": [],
235+
"parser": [
236+
[
237+
"Unexpected token.",
238+
{
239+
"@type": "@4"
240+
},
241+
0
242+
],
243+
[
244+
"Unrecognized statement type.",
245+
{
246+
"@type": "@6"
247+
},
248+
0
249+
]
250+
]
251+
}
252+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ANALYSE REPLACE INTO test VALUES (1, 'Old', '2014-08-20 18:47:00');

0 commit comments

Comments
 (0)