Skip to content

Commit 406a138

Browse files
committed
simple start for execute
1 parent 1532d15 commit 406a138

File tree

3 files changed

+84
-22
lines changed

3 files changed

+84
-22
lines changed

src/main/java/net/sf/jsqlparser/statement/execute/Execute.java

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,6 @@
1919
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
2020
* #L%
2121
*/
22-
/*
23-
* Copyright (C) 2014 JSQLParser.
24-
*
25-
* This library is free software; you can redistribute it and/or
26-
* modify it under the terms of the GNU Lesser General Public
27-
* License as published by the Free Software Foundation; either
28-
* version 2.1 of the License, or (at your option) any later version.
29-
*
30-
* This library is distributed in the hope that it will be useful,
31-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
32-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
33-
* Lesser General Public License for more details.
34-
*
35-
* You should have received a copy of the GNU Lesser General Public
36-
* License along with this library; if not, write to the Free Software
37-
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
38-
* MA 02110-1301 USA
39-
*/
40-
4122
package net.sf.jsqlparser.statement.execute;
4223

4324
import net.sf.jsqlparser.statement.Statement;

src/main/javacc/net/sf/jsqlparser/parser/JSqlParserCC.jj

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ import net.sf.jsqlparser.statement.delete.*;
6969
import net.sf.jsqlparser.statement.drop.*;
7070
import net.sf.jsqlparser.statement.insert.*;
7171
import net.sf.jsqlparser.statement.replace.*;
72+
import net.sf.jsqlparser.statement.execute.*;
7273
import net.sf.jsqlparser.statement.select.*;
7374
import net.sf.jsqlparser.statement.truncate.*;
7475
import net.sf.jsqlparser.statement.update.*;
@@ -198,7 +199,8 @@ TOKEN: /* SQL Keywords. prefixed with K_ to avoid name clashes */
198199
| <K_BINARY: "BINARY">
199200
| <K_REGEXP: "REGEXP">
200201
| <K_UNLOGGED: "UNLOGGED">
201-
| <K_CALL: "CALL">
202+
| <K_EXEC: "EXEC">
203+
| <K_EXECUTE: "EXECUTE">
202204
}
203205

204206
TOKEN : /* Numeric Constants */
@@ -274,8 +276,8 @@ Statement SingleStatement() :
274276
stm = Drop()
275277
|
276278
stm = Truncate()
277-
/* |
278-
stm = Execute() */
279+
|
280+
stm = Execute()
279281
)
280282
{ return stm; }
281283
}
@@ -1928,6 +1930,21 @@ WhenClause WhenThenValue():
19281930
}
19291931
}
19301932

1933+
Execute Execute(): {
1934+
String funcName = null;
1935+
ExpressionList expressionList = null;
1936+
Execute execute = new Execute();
1937+
}
1938+
{
1939+
(<K_EXEC> | <K_EXECUTE>)
1940+
1941+
funcName=RelObjectName()
1942+
1943+
[ expressionList=SimpleExpressionList() ]
1944+
1945+
{ return execute; }
1946+
}
1947+
19311948
Function Function():
19321949
{
19331950
Function retval = new Function();
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/*
2+
* Copyright (C) 2014 JSQLParser.
3+
*
4+
* This library is free software; you can redistribute it and/or
5+
* modify it under the terms of the GNU Lesser General Public
6+
* License as published by the Free Software Foundation; either
7+
* version 2.1 of the License, or (at your option) any later version.
8+
*
9+
* This library is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12+
* Lesser General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU Lesser General Public
15+
* License along with this library; if not, write to the Free Software
16+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17+
* MA 02110-1301 USA
18+
*/
19+
20+
package net.sf.jsqlparser.statement.execute;
21+
22+
import net.sf.jsqlparser.JSQLParserException;
23+
import net.sf.jsqlparser.statement.StatementVisitor;
24+
import org.junit.After;
25+
import org.junit.AfterClass;
26+
import org.junit.Before;
27+
import org.junit.BeforeClass;
28+
import org.junit.Test;
29+
import static org.junit.Assert.*;
30+
import static net.sf.jsqlparser.test.TestUtils.*;
31+
32+
/**
33+
*
34+
* @author toben
35+
*/
36+
public class ExecuteTest {
37+
38+
public ExecuteTest() {
39+
}
40+
41+
@BeforeClass
42+
public static void setUpClass() {
43+
}
44+
45+
@AfterClass
46+
public static void tearDownClass() {
47+
}
48+
49+
@Before
50+
public void setUp() {
51+
}
52+
53+
@After
54+
public void tearDown() {
55+
}
56+
57+
/**
58+
* Test of accept method, of class Execute.
59+
*/
60+
@Test
61+
public void testAccept() throws JSQLParserException {
62+
assertSqlCanBeParsedAndDeparsed("EXEC myproc 'a', 2, 'b'");
63+
}
64+
}

0 commit comments

Comments
 (0)