Skip to content

Commit

Permalink
Parse SRID in column definition
Browse files Browse the repository at this point in the history
  • Loading branch information
MoonE committed Nov 2, 2024
1 parent 8b08c70 commit 705d0b3
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 24 deletions.
4 changes: 4 additions & 0 deletions src/Components/CreateDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ class CreateDefinition extends Component
'ENFORCED' => 14,
'NOT' => 15,
'COMPRESSED' => 16,
'SRID' => [
17,
'var',
],
// Common entries.
//
// NOTE: Some of the common options are not in the same order which
Expand Down
78 changes: 54 additions & 24 deletions tests/data/parser/parseCreateTableSRID.out
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,58 @@
},
"key": null,
"references": null,
"options": {
"@type": "PhpMyAdmin\\SqlParser\\Components\\OptionsArray",
"options": {
"1": "NOT NULL",
"17": {
"name": "SRID",
"equals": false,
"expr": "4326",
"value": "4326"
}
}
}
},
{
"@type": "PhpMyAdmin\\SqlParser\\Components\\CreateDefinition",
"name": "properties",
"isConstraint": null,
"type": {
"@type": "PhpMyAdmin\\SqlParser\\Components\\DataType",
"name": "JSON",
"parameters": [],
"options": {
"@type": "PhpMyAdmin\\SqlParser\\Components\\OptionsArray",
"options": []
}
},
"key": null,
"references": null,
"options": {
"@type": "PhpMyAdmin\\SqlParser\\Components\\OptionsArray",
"options": {
"1": "NOT NULL"
}
}
},
{
"@type": "PhpMyAdmin\\SqlParser\\Components\\CreateDefinition",
"name": "title",
"isConstraint": null,
"type": {
"@type": "PhpMyAdmin\\SqlParser\\Components\\DataType",
"name": "VARCHAR",
"parameters": [
"100"
],
"options": {
"@type": "PhpMyAdmin\\SqlParser\\Components\\OptionsArray",
"options": []
}
},
"key": null,
"references": null,
"options": {
"@type": "PhpMyAdmin\\SqlParser\\Components\\OptionsArray",
"options": {
Expand Down Expand Up @@ -757,7 +809,7 @@
}
},
"first": 0,
"last": 60
"last": 67
}
],
"brackets": 0,
Expand All @@ -766,28 +818,6 @@
},
"errors": {
"lexer": [],
"parser": [
[
"A comma or a closing bracket was expected.",
{
"@type": "@47"
},
0
],
[
"Unexpected beginning of statement.",
{
"@type": "@63"
},
0
],
[
"Unrecognized statement type.",
{
"@type": "@66"
},
0
]
]
"parser": []
}
}

0 comments on commit 705d0b3

Please sign in to comment.