Skip to content

Commit 705d0b3

Browse files
committed
Parse SRID in column definition
1 parent 8b08c70 commit 705d0b3

File tree

2 files changed

+58
-24
lines changed

2 files changed

+58
-24
lines changed

src/Components/CreateDefinition.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ class CreateDefinition extends Component
9393
'ENFORCED' => 14,
9494
'NOT' => 15,
9595
'COMPRESSED' => 16,
96+
'SRID' => [
97+
17,
98+
'var',
99+
],
96100
// Common entries.
97101
//
98102
// NOTE: Some of the common options are not in the same order which

tests/data/parser/parseCreateTableSRID.out

Lines changed: 54 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -729,6 +729,58 @@
729729
},
730730
"key": null,
731731
"references": null,
732+
"options": {
733+
"@type": "PhpMyAdmin\\SqlParser\\Components\\OptionsArray",
734+
"options": {
735+
"1": "NOT NULL",
736+
"17": {
737+
"name": "SRID",
738+
"equals": false,
739+
"expr": "4326",
740+
"value": "4326"
741+
}
742+
}
743+
}
744+
},
745+
{
746+
"@type": "PhpMyAdmin\\SqlParser\\Components\\CreateDefinition",
747+
"name": "properties",
748+
"isConstraint": null,
749+
"type": {
750+
"@type": "PhpMyAdmin\\SqlParser\\Components\\DataType",
751+
"name": "JSON",
752+
"parameters": [],
753+
"options": {
754+
"@type": "PhpMyAdmin\\SqlParser\\Components\\OptionsArray",
755+
"options": []
756+
}
757+
},
758+
"key": null,
759+
"references": null,
760+
"options": {
761+
"@type": "PhpMyAdmin\\SqlParser\\Components\\OptionsArray",
762+
"options": {
763+
"1": "NOT NULL"
764+
}
765+
}
766+
},
767+
{
768+
"@type": "PhpMyAdmin\\SqlParser\\Components\\CreateDefinition",
769+
"name": "title",
770+
"isConstraint": null,
771+
"type": {
772+
"@type": "PhpMyAdmin\\SqlParser\\Components\\DataType",
773+
"name": "VARCHAR",
774+
"parameters": [
775+
"100"
776+
],
777+
"options": {
778+
"@type": "PhpMyAdmin\\SqlParser\\Components\\OptionsArray",
779+
"options": []
780+
}
781+
},
782+
"key": null,
783+
"references": null,
732784
"options": {
733785
"@type": "PhpMyAdmin\\SqlParser\\Components\\OptionsArray",
734786
"options": {
@@ -757,7 +809,7 @@
757809
}
758810
},
759811
"first": 0,
760-
"last": 60
812+
"last": 67
761813
}
762814
],
763815
"brackets": 0,
@@ -766,28 +818,6 @@
766818
},
767819
"errors": {
768820
"lexer": [],
769-
"parser": [
770-
[
771-
"A comma or a closing bracket was expected.",
772-
{
773-
"@type": "@47"
774-
},
775-
0
776-
],
777-
[
778-
"Unexpected beginning of statement.",
779-
{
780-
"@type": "@63"
781-
},
782-
0
783-
],
784-
[
785-
"Unrecognized statement type.",
786-
{
787-
"@type": "@66"
788-
},
789-
0
790-
]
791-
]
821+
"parser": []
792822
}
793823
}

0 commit comments

Comments
 (0)