Skip to content

Commit

Permalink
fixes #573
Browse files Browse the repository at this point in the history
  • Loading branch information
wumpz committed Jul 6, 2018
1 parent b76e639 commit 3a5a625
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
20 changes: 16 additions & 4 deletions src/main/jjtree/net/sf/jsqlparser/parser/JSqlParserCC.jjt
Original file line number Diff line number Diff line change
Expand Up @@ -3377,16 +3377,28 @@ String AList():
}
}

String ColumnsNamesListItem():
{
Token tk = null;
String item = null;
}
{
(tk=<S_IDENTIFIER> | tk=<S_QUOTED_IDENTIFIER>) { item = tk.image; }
[ "(" tk = <S_LONG> ")" { item = item + "(" + tk.image + ")"; } ]
{
return item;
}
}

List<String> ColumnsNamesList():
{
List<String> retval = new ArrayList<String>();
Token tk = null;
String img = null;
}
{
"("

(tk=<S_IDENTIFIER> | tk=<S_QUOTED_IDENTIFIER>) { retval.add(tk.image); }
( "," (tk=<S_IDENTIFIER> | tk=<S_QUOTED_IDENTIFIER>) { retval.add(tk.image); } )*
img=ColumnsNamesListItem() { retval.add(img); }
( "," img=ColumnsNamesListItem() { retval.add(img); } )*

")"
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,10 @@ public void testQuotedPKColumnsIssue491() throws JSQLParserException {
public void testQuotedPKColumnsIssue491_2() throws JSQLParserException {
assertSqlCanBeParsedAndDeparsed("CREATE TABLE `FOO` (`ID` INT64, `NAME` STRING (100), PRIMARY KEY (`ID`))");
}

public void testKeySyntaxWithLengthColumnParameter() throws JSQLParserException {
assertSqlCanBeParsedAndDeparsed("CREATE TABLE basic (BASIC_TITLE varchar (255) NOT NULL, KEY BASIC_TITLE (BASIC_TITLE(255)))");
}

public void testRUBiSCreateList() throws Exception {
BufferedReader in = new BufferedReader(new InputStreamReader(CreateTableTest.class.
Expand Down

0 comments on commit 3a5a625

Please sign in to comment.