File tree Expand file tree Collapse file tree 2 files changed +23
-4
lines changed
main/jjtree/net/sf/jsqlparser/parser
test/java/net/sf/jsqlparser/test/select Expand file tree Collapse file tree 2 files changed +23
-4
lines changed Original file line number Diff line number Diff line change @@ -692,7 +692,22 @@ String RelObjectNameExt():
692692 String result=null;
693693}
694694{
695- ( result=RelObjectName() | tk=<K_LEFT> | tk=<K_RIGHT> | tk=<K_SET> )
695+ ( result=RelObjectName() | tk=<K_LEFT> | tk=<K_RIGHT> | tk=<K_SET>)
696+ {
697+ if (tk!=null) result=tk.image;
698+ return result;
699+ }
700+ }
701+
702+ /*
703+ Extended usage of object names - part 2.
704+ */
705+ String RelObjectNameExt2():
706+ { Token tk = null;
707+ String result=null;
708+ }
709+ {
710+ ( result=RelObjectNameExt() | tk=<K_TOP>)
696711 {
697712 if (tk!=null) result=tk.image;
698713 return result;
@@ -2093,13 +2108,13 @@ JdbcNamedParameter JdbcNamedParameter() : {
20932108
20942109UserVariable UserVariable() : {
20952110 UserVariable var = new UserVariable();
2096- Token token ;
2111+ String varName ;
20972112}
20982113{
20992114 ("@" | "@@" { var.setDoubleAdd(true);} )
2100- token=<S_IDENTIFIER>
2115+ varName=RelObjectNameExt2()
21012116 {
2102- var.setName(token.image );
2117+ var.setName(varName );
21032118 return var;
21042119 }
21052120}
Original file line number Diff line number Diff line change @@ -2195,4 +2195,8 @@ public void testTopExpressionIssue243() throws JSQLParserException {
21952195 public void testTopExpressionIssue243_2 () throws JSQLParserException {
21962196 assertSqlCanBeParsedAndDeparsed ("SELECT TOP (CAST(? AS INT)) * FROM MyTable" );
21972197 }
2198+
2199+ public void testKeywordTop () throws JSQLParserException {
2200+ assertSqlCanBeParsedAndDeparsed ("SELECT @top" );
2201+ }
21982202}
You can’t perform that action at this time.
0 commit comments