File tree Expand file tree Collapse file tree 2 files changed +20
-4
lines changed
main/jjtree/net/sf/jsqlparser/parser
test/java/net/sf/jsqlparser/statement/create Expand file tree Collapse file tree 2 files changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -3377,16 +3377,28 @@ String AList():
3377
3377
}
3378
3378
}
3379
3379
3380
+ String ColumnsNamesListItem():
3381
+ {
3382
+ Token tk = null;
3383
+ String item = null;
3384
+ }
3385
+ {
3386
+ (tk=<S_IDENTIFIER> | tk=<S_QUOTED_IDENTIFIER>) { item = tk.image; }
3387
+ [ "(" tk = <S_LONG> ")" { item = item + "(" + tk.image + ")"; } ]
3388
+ {
3389
+ return item;
3390
+ }
3391
+ }
3392
+
3380
3393
List<String> ColumnsNamesList():
3381
3394
{
3382
3395
List<String> retval = new ArrayList<String>();
3383
- Token tk = null;
3396
+ String img = null;
3384
3397
}
3385
3398
{
3386
3399
"("
3387
-
3388
- (tk=<S_IDENTIFIER> | tk=<S_QUOTED_IDENTIFIER>) { retval.add(tk.image); }
3389
- ( "," (tk=<S_IDENTIFIER> | tk=<S_QUOTED_IDENTIFIER>) { retval.add(tk.image); } )*
3400
+ img=ColumnsNamesListItem() { retval.add(img); }
3401
+ ( "," img=ColumnsNamesListItem() { retval.add(img); } )*
3390
3402
3391
3403
")"
3392
3404
{
Original file line number Diff line number Diff line change @@ -276,6 +276,10 @@ public void testQuotedPKColumnsIssue491() throws JSQLParserException {
276
276
public void testQuotedPKColumnsIssue491_2 () throws JSQLParserException {
277
277
assertSqlCanBeParsedAndDeparsed ("CREATE TABLE `FOO` (`ID` INT64, `NAME` STRING (100), PRIMARY KEY (`ID`))" );
278
278
}
279
+
280
+ public void testKeySyntaxWithLengthColumnParameter () throws JSQLParserException {
281
+ assertSqlCanBeParsedAndDeparsed ("CREATE TABLE basic (BASIC_TITLE varchar (255) NOT NULL, KEY BASIC_TITLE (BASIC_TITLE(255)))" );
282
+ }
279
283
280
284
public void testRUBiSCreateList () throws Exception {
281
285
BufferedReader in = new BufferedReader (new InputStreamReader (CreateTableTest .class .
You can’t perform that action at this time.
0 commit comments