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():
33773377 }
33783378}
33793379
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+
33803393List<String> ColumnsNamesList():
33813394{
33823395 List<String> retval = new ArrayList<String>();
3383- Token tk = null;
3396+ String img = null;
33843397}
33853398{
33863399 "("
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); } )*
33903402
33913403 ")"
33923404 {
Original file line number Diff line number Diff line change @@ -276,6 +276,10 @@ public void testQuotedPKColumnsIssue491() throws JSQLParserException {
276276 public void testQuotedPKColumnsIssue491_2 () throws JSQLParserException {
277277 assertSqlCanBeParsedAndDeparsed ("CREATE TABLE `FOO` (`ID` INT64, `NAME` STRING (100), PRIMARY KEY (`ID`))" );
278278 }
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+ }
279283
280284 public void testRUBiSCreateList () throws Exception {
281285 BufferedReader in = new BufferedReader (new InputStreamReader (CreateTableTest .class .
You can’t perform that action at this time.
0 commit comments