Skip to content

Commit cb75245

Browse files
committed
Add more test cases for user IDENTIFIED WITH/VIA/BY
Ref: #436 (comment) Signed-off-by: William Desportes <williamdes@wdes.fr>
1 parent 55be476 commit cb75245

10 files changed

Lines changed: 932 additions & 1 deletion

tests/Parser/AlterStatementTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ public function alterProvider(): array
6060
['parser/parseAlterUser6'],
6161
['parser/parseAlterUser7'],
6262
['parser/parseAlterUser8'],
63+
['parser/parseAlterUser9'],
64+
['parser/parseAlterUser10'],
6365
['parser/parseAlterEvent'],
6466
['parser/parseAlterEvent2'],
6567
['parser/parseAlterEvent3'],

tests/Parser/CreateStatementTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ public function createProvider(): array
5959
['parser/parseCreateTableNotEnforcedCheck'],
6060
['parser/parseCreateTableWithInvisibleKey'],
6161
['parser/parseCreateTrigger'],
62-
['parser/parseCreateUser'],
62+
['parser/parseCreateUser1'],
63+
['parser/parseCreateUser2'],
6364
['parser/parseCreateView'],
6465
['parser/parseCreateView2'],
6566
['parser/parseCreateView3'],
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ALTER USER 'bob'@'localhost' IDENTIFIED WITH mysql_native_password USING PASSWORD('vp8LAf4#wu2V&Wi*iJWC#3KPotsHzx3u');
2+
Lines changed: 284 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,284 @@
1+
{
2+
"query": "ALTER USER 'bob'@'localhost' IDENTIFIED WITH mysql_native_password USING PASSWORD('vp8LAf4#wu2V&Wi*iJWC#3KPotsHzx3u');\n\n",
3+
"lexer": {
4+
"@type": "PhpMyAdmin\\SqlParser\\Lexer",
5+
"str": "ALTER USER 'bob'@'localhost' IDENTIFIED WITH mysql_native_password USING PASSWORD('vp8LAf4#wu2V&Wi*iJWC#3KPotsHzx3u');\n\n",
6+
"len": 120,
7+
"last": 120,
8+
"list": {
9+
"@type": "PhpMyAdmin\\SqlParser\\TokensList",
10+
"tokens": [
11+
{
12+
"@type": "PhpMyAdmin\\SqlParser\\Token",
13+
"token": "ALTER",
14+
"value": "ALTER",
15+
"keyword": "ALTER",
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": 5
28+
},
29+
{
30+
"@type": "PhpMyAdmin\\SqlParser\\Token",
31+
"token": "USER",
32+
"value": "USER",
33+
"keyword": "USER",
34+
"type": 1,
35+
"flags": 33,
36+
"position": 6
37+
},
38+
{
39+
"@type": "PhpMyAdmin\\SqlParser\\Token",
40+
"token": " ",
41+
"value": " ",
42+
"keyword": null,
43+
"type": 3,
44+
"flags": 0,
45+
"position": 10
46+
},
47+
{
48+
"@type": "PhpMyAdmin\\SqlParser\\Token",
49+
"token": "'bob'@'localhost'",
50+
"value": "bob@localhost",
51+
"keyword": null,
52+
"type": 8,
53+
"flags": 4,
54+
"position": 11
55+
},
56+
{
57+
"@type": "PhpMyAdmin\\SqlParser\\Token",
58+
"token": " ",
59+
"value": " ",
60+
"keyword": null,
61+
"type": 3,
62+
"flags": 0,
63+
"position": 28
64+
},
65+
{
66+
"@type": "PhpMyAdmin\\SqlParser\\Token",
67+
"token": "IDENTIFIED",
68+
"value": "IDENTIFIED",
69+
"keyword": "IDENTIFIED",
70+
"type": 1,
71+
"flags": 1,
72+
"position": 29
73+
},
74+
{
75+
"@type": "PhpMyAdmin\\SqlParser\\Token",
76+
"token": " ",
77+
"value": " ",
78+
"keyword": null,
79+
"type": 3,
80+
"flags": 0,
81+
"position": 39
82+
},
83+
{
84+
"@type": "PhpMyAdmin\\SqlParser\\Token",
85+
"token": "WITH",
86+
"value": "WITH",
87+
"keyword": "WITH",
88+
"type": 1,
89+
"flags": 3,
90+
"position": 40
91+
},
92+
{
93+
"@type": "PhpMyAdmin\\SqlParser\\Token",
94+
"token": " ",
95+
"value": " ",
96+
"keyword": null,
97+
"type": 3,
98+
"flags": 0,
99+
"position": 44
100+
},
101+
{
102+
"@type": "PhpMyAdmin\\SqlParser\\Token",
103+
"token": "mysql_native_password",
104+
"value": "mysql_native_password",
105+
"keyword": null,
106+
"type": 0,
107+
"flags": 0,
108+
"position": 45
109+
},
110+
{
111+
"@type": "PhpMyAdmin\\SqlParser\\Token",
112+
"token": " ",
113+
"value": " ",
114+
"keyword": null,
115+
"type": 3,
116+
"flags": 0,
117+
"position": 66
118+
},
119+
{
120+
"@type": "PhpMyAdmin\\SqlParser\\Token",
121+
"token": "USING",
122+
"value": "USING",
123+
"keyword": "USING",
124+
"type": 1,
125+
"flags": 3,
126+
"position": 67
127+
},
128+
{
129+
"@type": "PhpMyAdmin\\SqlParser\\Token",
130+
"token": " ",
131+
"value": " ",
132+
"keyword": null,
133+
"type": 3,
134+
"flags": 0,
135+
"position": 72
136+
},
137+
{
138+
"@type": "PhpMyAdmin\\SqlParser\\Token",
139+
"token": "PASSWORD",
140+
"value": "PASSWORD",
141+
"keyword": "PASSWORD",
142+
"type": 1,
143+
"flags": 33,
144+
"position": 73
145+
},
146+
{
147+
"@type": "PhpMyAdmin\\SqlParser\\Token",
148+
"token": "(",
149+
"value": "(",
150+
"keyword": null,
151+
"type": 2,
152+
"flags": 16,
153+
"position": 81
154+
},
155+
{
156+
"@type": "PhpMyAdmin\\SqlParser\\Token",
157+
"token": "'vp8LAf4#wu2V&Wi*iJWC#3KPotsHzx3u'",
158+
"value": "vp8LAf4#wu2V&Wi*iJWC#3KPotsHzx3u",
159+
"keyword": null,
160+
"type": 7,
161+
"flags": 1,
162+
"position": 82
163+
},
164+
{
165+
"@type": "PhpMyAdmin\\SqlParser\\Token",
166+
"token": ")",
167+
"value": ")",
168+
"keyword": null,
169+
"type": 2,
170+
"flags": 16,
171+
"position": 116
172+
},
173+
{
174+
"@type": "PhpMyAdmin\\SqlParser\\Token",
175+
"token": ";",
176+
"value": ";",
177+
"keyword": null,
178+
"type": 9,
179+
"flags": 0,
180+
"position": 117
181+
},
182+
{
183+
"@type": "PhpMyAdmin\\SqlParser\\Token",
184+
"token": "\n\n",
185+
"value": " ",
186+
"keyword": null,
187+
"type": 3,
188+
"flags": 0,
189+
"position": 118
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\\AlterStatement",
217+
"table": {
218+
"@type": "PhpMyAdmin\\SqlParser\\Components\\Expression",
219+
"database": null,
220+
"table": "bob@localhost",
221+
"column": null,
222+
"expr": "'bob'@'localhost'",
223+
"alias": null,
224+
"function": null,
225+
"subquery": null
226+
},
227+
"altered": [
228+
{
229+
"@type": "PhpMyAdmin\\SqlParser\\Components\\AlterOperation",
230+
"options": {
231+
"@type": "PhpMyAdmin\\SqlParser\\Components\\OptionsArray",
232+
"options": {
233+
"2": {
234+
"name": "WITH",
235+
"equals": false,
236+
"expr": "mysql_native_password",
237+
"value": "mysql_native_password"
238+
},
239+
"3": "IDENTIFIED"
240+
}
241+
},
242+
"field": null,
243+
"partitions": null,
244+
"unknown": [
245+
{
246+
"@type": "@14"
247+
},
248+
{
249+
"@type": "@15"
250+
},
251+
{
252+
"@type": "@16"
253+
},
254+
{
255+
"@type": "@17"
256+
},
257+
{
258+
"@type": "@18"
259+
},
260+
{
261+
"@type": "@19"
262+
}
263+
]
264+
}
265+
],
266+
"options": {
267+
"@type": "PhpMyAdmin\\SqlParser\\Components\\OptionsArray",
268+
"options": {
269+
"3": "USER"
270+
}
271+
},
272+
"first": 0,
273+
"last": 18
274+
}
275+
],
276+
"brackets": 0,
277+
"strict": false,
278+
"errors": []
279+
},
280+
"errors": {
281+
"lexer": [],
282+
"parser": []
283+
}
284+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTER USER 'bob'@'localhost' IDENTIFIED VIA mysql_native_password USING PASSWORD('vp8LAf4#wu2V&Wi*iJWC#3KPotsHzx3u');

0 commit comments

Comments
 (0)