File tree Expand file tree Collapse file tree 4 files changed +42
-2
lines changed
java/net/sf/jsqlparser/statement/execute
jjtree/net/sf/jsqlparser/parser
test/java/net/sf/jsqlparser/statement/execute Expand file tree Collapse file tree 4 files changed +42
-2
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,7 @@ Also I would like to know about needed examples or documentation stuff.
55
55
56
56
## Extensions in the latest SNAPSHOT version 2.0
57
57
58
+ * support of named parameters for execute: ** EXEC procedure @param = 'foo'**
58
59
* support multivalue set statement
59
60
* support of ** describe**
60
61
* support of ** explain**
Original file line number Diff line number Diff line change 2
2
* #%L
3
3
* JSQLParser library
4
4
* %%
5
- * Copyright (C) 2004 - 2014 JSQLParser
5
+ * Copyright (C) 2004 - 2019 JSQLParser
6
6
* %%
7
7
* This program is free software: you can redistribute it and/or modify
8
8
* it under the terms of the GNU Lesser General Public License as
Original file line number Diff line number Diff line change 2
2
* #%L
3
3
* JSQLParser library
4
4
* %%
5
- * Copyright (C) 2004 - 2014 JSQLParser
5
+ * Copyright (C) 2004 - 2019 JSQLParser
6
6
* %%
7
7
* This program is free software: you can redistribute it and/or modify
8
8
* it under the terms of the GNU Lesser General Public License as
@@ -3039,10 +3039,25 @@ RowConstructor RowConstructor(): {
3039
3039
}
3040
3040
}
3041
3041
3042
+ EqualsTo VariableExpression(): {
3043
+ Expression left;
3044
+ Expression right;
3045
+ } {
3046
+ left = UserVariable() "=" right = SimpleExpression()
3047
+ {
3048
+ EqualsTo equals = new EqualsTo();
3049
+ equals.setLeftExpression(left);
3050
+ equals.setRightExpression(right);
3051
+ return equals;
3052
+ }
3053
+ }
3054
+
3042
3055
Execute Execute(): {
3043
3056
List<String> funcName;
3044
3057
ExpressionList expressionList = null;
3045
3058
Execute execute = new Execute();
3059
+ List<Expression> namedExprList;
3060
+ Expression expr;
3046
3061
}
3047
3062
{
3048
3063
(<K_EXEC> { execute.setExecType(Execute.EXEC_TYPE.EXEC); }
@@ -3052,6 +3067,10 @@ Execute Execute(): {
3052
3067
funcName=RelObjectNameList() { execute.setName(funcName); }
3053
3068
3054
3069
(
3070
+ LOOKAHEAD(3) ( expr = VariableExpression() { namedExprList = new ArrayList<Expression>(); namedExprList.add( expr ); }
3071
+ ( "," expr = VariableExpression() { namedExprList.add(expr); })*
3072
+ { expressionList = new ExpressionList(namedExprList); } )
3073
+ |
3055
3074
LOOKAHEAD(3) expressionList=SimpleExpressionList()
3056
3075
|
3057
3076
("(" expressionList=SimpleExpressionList() ")" { execute.setParenthesis(true); })
Original file line number Diff line number Diff line change @@ -80,4 +80,24 @@ public void testCallWithMultiname() throws JSQLParserException {
80
80
public void testAcceptCallWithParenthesis () throws JSQLParserException {
81
81
assertSqlCanBeParsedAndDeparsed ("CALL myproc ('a', 2, 'b')" );
82
82
}
83
+
84
+ @ Test
85
+ public void testAcceptExecNamesParameters () throws JSQLParserException {
86
+ assertSqlCanBeParsedAndDeparsed ("EXEC procedure @param" );
87
+ }
88
+
89
+ @ Test
90
+ public void testAcceptExecNamesParameters2 () throws JSQLParserException {
91
+ assertSqlCanBeParsedAndDeparsed ("EXEC procedure @param = 1" );
92
+ }
93
+
94
+ @ Test
95
+ public void testAcceptExecNamesParameters3 () throws JSQLParserException {
96
+ assertSqlCanBeParsedAndDeparsed ("EXEC procedure @param = 'foo'" );
97
+ }
98
+
99
+ @ Test
100
+ public void testAcceptExecNamesParameters4 () throws JSQLParserException {
101
+ assertSqlCanBeParsedAndDeparsed ("EXEC procedure @param = 'foo', @param2 = 'foo2'" );
102
+ }
83
103
}
You can’t perform that action at this time.
0 commit comments