Skip to content

Commit a3e700c

Browse files
committed
Add test case about using SET statement with ":=" operator.
1 parent 417ef40 commit a3e700c

File tree

3 files changed

+129
-0
lines changed

3 files changed

+129
-0
lines changed

tests/Parser/SetStatementTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public function setProvider(): array
3232
['parser/parseSetError1'],
3333
['parser/parseInsertIntoSet'],
3434
['parser/parseSetVariable'],
35+
['parser/parseSetVariable2'],
3536
['parser/parseSetGlobalVariable'],
3637
];
3738
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
SET @foo := 1
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
{
2+
"query": "SET @foo := 1\n",
3+
"lexer": {
4+
"@type": "PhpMyAdmin\\SqlParser\\Lexer",
5+
"str": "SET @foo := 1\n",
6+
"len": 14,
7+
"last": 14,
8+
"list": {
9+
"@type": "PhpMyAdmin\\SqlParser\\TokensList",
10+
"tokens": [
11+
{
12+
"@type": "PhpMyAdmin\\SqlParser\\Token",
13+
"token": "SET",
14+
"value": "SET",
15+
"keyword": "SET",
16+
"type": 1,
17+
"flags": 11,
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": 3
28+
},
29+
{
30+
"@type": "PhpMyAdmin\\SqlParser\\Token",
31+
"token": "@foo",
32+
"value": "foo",
33+
"keyword": null,
34+
"type": 8,
35+
"flags": 1,
36+
"position": 4
37+
},
38+
{
39+
"@type": "PhpMyAdmin\\SqlParser\\Token",
40+
"token": " ",
41+
"value": " ",
42+
"keyword": null,
43+
"type": 3,
44+
"flags": 0,
45+
"position": 8
46+
},
47+
{
48+
"@type": "PhpMyAdmin\\SqlParser\\Token",
49+
"token": ":=",
50+
"value": ":=",
51+
"keyword": null,
52+
"type": 2,
53+
"flags": 8,
54+
"position": 9
55+
},
56+
{
57+
"@type": "PhpMyAdmin\\SqlParser\\Token",
58+
"token": " ",
59+
"value": " ",
60+
"keyword": null,
61+
"type": 3,
62+
"flags": 0,
63+
"position": 11
64+
},
65+
{
66+
"@type": "PhpMyAdmin\\SqlParser\\Token",
67+
"token": "1",
68+
"value": 1,
69+
"keyword": null,
70+
"type": 6,
71+
"flags": 0,
72+
"position": 12
73+
},
74+
{
75+
"@type": "PhpMyAdmin\\SqlParser\\Token",
76+
"token": "\n",
77+
"value": " ",
78+
"keyword": null,
79+
"type": 3,
80+
"flags": 0,
81+
"position": 13
82+
},
83+
{
84+
"@type": "PhpMyAdmin\\SqlParser\\Token",
85+
"token": null,
86+
"value": null,
87+
"keyword": null,
88+
"type": 9,
89+
"flags": 0,
90+
"position": null
91+
}
92+
],
93+
"count": 9,
94+
"idx": 9
95+
},
96+
"delimiter": ";",
97+
"delimiterLen": 1,
98+
"strict": false,
99+
"errors": []
100+
},
101+
"parser": {
102+
"@type": "PhpMyAdmin\\SqlParser\\Parser",
103+
"list": {
104+
"@type": "@1"
105+
},
106+
"statements": [
107+
{
108+
"@type": "PhpMyAdmin\\SqlParser\\Statements\\SetStatement",
109+
"options": {
110+
"@type": "PhpMyAdmin\\SqlParser\\Components\\OptionsArray",
111+
"options": []
112+
},
113+
"end_options": null,
114+
"set": [],
115+
"first": 0,
116+
"last": 7
117+
}
118+
],
119+
"brackets": 0,
120+
"strict": false,
121+
"errors": []
122+
},
123+
"errors": {
124+
"lexer": [],
125+
"parser": []
126+
}
127+
}

0 commit comments

Comments
 (0)