File tree Expand file tree Collapse file tree 4 files changed +32
-4
lines changed
jjtree/net/sf/jsqlparser/parser
test/java/net/sf/jsqlparser/statement/execute Expand file tree Collapse file tree 4 files changed +32
-4
lines changed Original file line number Diff line number Diff line change 32
32
*/
33
33
public class Execute implements Statement {
34
34
35
+ private EXEC_TYPE execType = EXEC_TYPE .EXECUTE ;
35
36
private String name ;
36
37
private ExpressionList exprList ;
37
38
@@ -51,15 +52,29 @@ public void setExprList(ExpressionList exprList) {
51
52
this .exprList = exprList ;
52
53
}
53
54
55
+ public EXEC_TYPE getExecType () {
56
+ return execType ;
57
+ }
58
+
59
+ public void setExecType (EXEC_TYPE execType ) {
60
+ this .execType = execType ;
61
+ }
62
+
54
63
@ Override
55
64
public void accept (StatementVisitor statementVisitor ) {
56
65
statementVisitor .visit (this );
57
66
}
58
67
59
68
@ Override
60
69
public String toString () {
61
- return "EXECUTE " + name + " " + PlainSelect .
70
+ return execType . name () + " " + name + " " + PlainSelect .
62
71
getStringList (exprList .getExpressions (), true , false );
63
72
}
73
+
74
+ public static enum EXEC_TYPE {
75
+ EXECUTE ,
76
+ EXEC ,
77
+ CALL
78
+ }
64
79
65
80
}
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ public void setBuffer(StringBuilder buffer) {
52
52
}
53
53
54
54
public void deParse (Execute execute ) {
55
- buffer .append ("EXECUTE " ).append (execute .getName ());
55
+ buffer .append (execute . getExecType (). name ()). append ( " " ).append (execute .getName ());
56
56
List <Expression > expressions = execute .getExprList ().getExpressions ();
57
57
for (int i = 0 ; i < expressions .size (); i ++) {
58
58
if (i > 0 ) {
Original file line number Diff line number Diff line change @@ -285,6 +285,7 @@ TOKEN: /* SQL Keywords. prefixed with K_ to avoid name clashes */
285
285
| <K_DISABLE : "DISABLE">
286
286
| <K_USE : "USE">
287
287
| <K_FORCE : "FORCE">
288
+ | <K_CALL : "CALL">
288
289
}
289
290
290
291
TOKEN : /* Stuff */
@@ -2704,7 +2705,9 @@ Execute Execute(): {
2704
2705
Execute execute = new Execute();
2705
2706
}
2706
2707
{
2707
- (<K_EXEC> | <K_EXECUTE>)
2708
+ (<K_EXEC> { execute.setExecType(Execute.EXEC_TYPE.EXEC); }
2709
+ | <K_EXECUTE> { execute.setExecType(Execute.EXEC_TYPE.EXECUTE); }
2710
+ | <K_CALL> { execute.setExecType(Execute.EXEC_TYPE.CALL); } )
2708
2711
2709
2712
funcName=RelObjectName() { execute.setName(funcName); }
2710
2713
Original file line number Diff line number Diff line change @@ -57,7 +57,17 @@ public void tearDown() {
57
57
* @throws net.sf.jsqlparser.JSQLParserException
58
58
*/
59
59
@ Test
60
- public void testAccept () throws JSQLParserException {
60
+ public void testAcceptExecute () throws JSQLParserException {
61
61
assertSqlCanBeParsedAndDeparsed ("EXECUTE myproc 'a', 2, 'b'" );
62
62
}
63
+
64
+ @ Test
65
+ public void testAcceptExec () throws JSQLParserException {
66
+ assertSqlCanBeParsedAndDeparsed ("EXEC myproc 'a', 2, 'b'" );
67
+ }
68
+
69
+ @ Test
70
+ public void testAcceptCall () throws JSQLParserException {
71
+ assertSqlCanBeParsedAndDeparsed ("CALL myproc 'a', 2, 'b'" );
72
+ }
63
73
}
You can’t perform that action at this time.
0 commit comments