Skip to content

Commit cb91f5a

Browse files
committed
Test create table with uuid column type
Signed-off-by: Maximilian Krög <[email protected]>
1 parent 707e336 commit cb91f5a

File tree

3 files changed

+289
-0
lines changed

3 files changed

+289
-0
lines changed

tests/Parser/CreateStatementTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ public static function createProvider(): array
6868
['parser/parseCreateTableNotEnforcedCheck'],
6969
['parser/parseCreateTableWithInvisibleKey'],
7070
['parser/parseCreateTableWithParser'],
71+
['parser/parseCreateTableUuidColumn_mariadb_100700'],
7172
['parser/parseCreateTrigger'],
7273
['parser/parseCreateUser1'],
7374
['parser/parseCreateUser2'],
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
CREATE TABLE `users` (
2+
`id` UUID NOT NULL PRIMARY KEY
3+
);
Lines changed: 285 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,285 @@
1+
{
2+
"query": "CREATE TABLE `users` (\n `id` UUID NOT NULL PRIMARY KEY\n);\n",
3+
"lexer": {
4+
"@type": "PhpMyAdmin\\SqlParser\\Lexer",
5+
"str": "CREATE TABLE `users` (\n `id` UUID NOT NULL PRIMARY KEY\n);\n",
6+
"len": 59,
7+
"last": 59,
8+
"list": {
9+
"@type": "PhpMyAdmin\\SqlParser\\TokensList",
10+
"tokens": [
11+
{
12+
"@type": "PhpMyAdmin\\SqlParser\\Token",
13+
"token": "CREATE",
14+
"value": "CREATE",
15+
"keyword": "CREATE",
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": 6
28+
},
29+
{
30+
"@type": "PhpMyAdmin\\SqlParser\\Token",
31+
"token": "TABLE",
32+
"value": "TABLE",
33+
"keyword": "TABLE",
34+
"type": 1,
35+
"flags": 3,
36+
"position": 7
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": "`users`",
50+
"value": "users",
51+
"keyword": null,
52+
"type": 8,
53+
"flags": 2,
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": 20
64+
},
65+
{
66+
"@type": "PhpMyAdmin\\SqlParser\\Token",
67+
"token": "(",
68+
"value": "(",
69+
"keyword": null,
70+
"type": 2,
71+
"flags": 16,
72+
"position": 21
73+
},
74+
{
75+
"@type": "PhpMyAdmin\\SqlParser\\Token",
76+
"token": "\n ",
77+
"value": " ",
78+
"keyword": null,
79+
"type": 3,
80+
"flags": 0,
81+
"position": 22
82+
},
83+
{
84+
"@type": "PhpMyAdmin\\SqlParser\\Token",
85+
"token": "`id`",
86+
"value": "id",
87+
"keyword": null,
88+
"type": 8,
89+
"flags": 2,
90+
"position": 25
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": "UUID",
104+
"value": "UUID",
105+
"keyword": "UUID",
106+
"type": 1,
107+
"flags": 33,
108+
"position": 30
109+
},
110+
{
111+
"@type": "PhpMyAdmin\\SqlParser\\Token",
112+
"token": " ",
113+
"value": " ",
114+
"keyword": null,
115+
"type": 3,
116+
"flags": 0,
117+
"position": 34
118+
},
119+
{
120+
"@type": "PhpMyAdmin\\SqlParser\\Token",
121+
"token": "NOT NULL",
122+
"value": "NOT NULL",
123+
"keyword": "NOT NULL",
124+
"type": 1,
125+
"flags": 7,
126+
"position": 35
127+
},
128+
{
129+
"@type": "PhpMyAdmin\\SqlParser\\Token",
130+
"token": " ",
131+
"value": " ",
132+
"keyword": null,
133+
"type": 3,
134+
"flags": 0,
135+
"position": 43
136+
},
137+
{
138+
"@type": "PhpMyAdmin\\SqlParser\\Token",
139+
"token": "PRIMARY KEY",
140+
"value": "PRIMARY KEY",
141+
"keyword": "PRIMARY KEY",
142+
"type": 1,
143+
"flags": 23,
144+
"position": 44
145+
},
146+
{
147+
"@type": "PhpMyAdmin\\SqlParser\\Token",
148+
"token": "\n",
149+
"value": " ",
150+
"keyword": null,
151+
"type": 3,
152+
"flags": 0,
153+
"position": 55
154+
},
155+
{
156+
"@type": "PhpMyAdmin\\SqlParser\\Token",
157+
"token": ")",
158+
"value": ")",
159+
"keyword": null,
160+
"type": 2,
161+
"flags": 16,
162+
"position": 56
163+
},
164+
{
165+
"@type": "PhpMyAdmin\\SqlParser\\Token",
166+
"token": ";",
167+
"value": ";",
168+
"keyword": null,
169+
"type": 9,
170+
"flags": 0,
171+
"position": 57
172+
},
173+
{
174+
"@type": "PhpMyAdmin\\SqlParser\\Token",
175+
"token": "\n",
176+
"value": " ",
177+
"keyword": null,
178+
"type": 3,
179+
"flags": 0,
180+
"position": 58
181+
},
182+
{
183+
"@type": "PhpMyAdmin\\SqlParser\\Token",
184+
"token": null,
185+
"value": null,
186+
"keyword": null,
187+
"type": 9,
188+
"flags": 0,
189+
"position": null
190+
}
191+
],
192+
"count": 20,
193+
"idx": 20
194+
},
195+
"delimiter": ";",
196+
"delimiterLen": 1,
197+
"strict": false,
198+
"errors": []
199+
},
200+
"parser": {
201+
"@type": "PhpMyAdmin\\SqlParser\\Parser",
202+
"list": {
203+
"@type": "@1"
204+
},
205+
"statements": [
206+
{
207+
"@type": "PhpMyAdmin\\SqlParser\\Statements\\CreateStatement",
208+
"name": {
209+
"@type": "PhpMyAdmin\\SqlParser\\Components\\Expression",
210+
"database": null,
211+
"table": "users",
212+
"column": null,
213+
"expr": "`users`",
214+
"alias": null,
215+
"function": null,
216+
"subquery": null
217+
},
218+
"entityOptions": {
219+
"@type": "PhpMyAdmin\\SqlParser\\Components\\OptionsArray",
220+
"options": []
221+
},
222+
"fields": [
223+
{
224+
"@type": "PhpMyAdmin\\SqlParser\\Components\\CreateDefinition",
225+
"name": "id",
226+
"isConstraint": null,
227+
"type": {
228+
"@type": "PhpMyAdmin\\SqlParser\\Components\\DataType",
229+
"name": "UUID",
230+
"parameters": [],
231+
"options": {
232+
"@type": "PhpMyAdmin\\SqlParser\\Components\\OptionsArray",
233+
"options": []
234+
}
235+
},
236+
"key": null,
237+
"references": null,
238+
"options": {
239+
"@type": "PhpMyAdmin\\SqlParser\\Components\\OptionsArray",
240+
"options": {
241+
"1": "NOT NULL",
242+
"4": "PRIMARY KEY"
243+
}
244+
}
245+
}
246+
],
247+
"with": null,
248+
"select": null,
249+
"like": null,
250+
"partitionBy": null,
251+
"partitionsNum": null,
252+
"subpartitionBy": null,
253+
"subpartitionsNum": null,
254+
"partitions": null,
255+
"table": null,
256+
"return": null,
257+
"parameters": null,
258+
"body": [],
259+
"options": {
260+
"@type": "PhpMyAdmin\\SqlParser\\Components\\OptionsArray",
261+
"options": {
262+
"6": "TABLE"
263+
}
264+
},
265+
"first": 0,
266+
"last": 17
267+
}
268+
],
269+
"brackets": 0,
270+
"strict": false,
271+
"errors": []
272+
},
273+
"errors": {
274+
"lexer": [],
275+
"parser": [
276+
[
277+
"Unrecognized data type.",
278+
{
279+
"@type": "@12"
280+
},
281+
0
282+
]
283+
]
284+
}
285+
}

0 commit comments

Comments
 (0)