Merge branch 'pr-1238'

This commit is contained in:
Juan Martín Sotuyo Dodero
2018-07-15 17:39:03 -03:00
5 changed files with 56 additions and 1 deletions

View File

@ -31,6 +31,7 @@ This is a minor release.
* plsql
* [#980](https://github.com/pmd/pmd/issues/980): \[plsql] ParseException for CREATE TABLE
* [#981](https://github.com/pmd/pmd/issues/981): \[plsql] ParseException when parsing VIEW
* [#1047](https://github.com/pmd/pmd/issues/1047): \[plsql] ParseException when parsing EXECUTE IMMEDIATE
* ui
* [#1233](https://github.com/pmd/pmd/issues/1233): \[ui] XPath autocomplete arrows on first and last items

View File

@ -943,7 +943,7 @@ void Skip2NextTerminator(String initiator,String terminator) :
t = getToken(1);
if(t.image.equals(initiator)) count++;
if(t.image.equals(terminator)) count--;
if((null != t.specialToken && beginToken.kind != SELECT && beginToken.kind != INSERT && beginToken.kind != UPDATE && beginToken.kind != DELETE && beginToken.kind != MERGE) || t.kind == EOF)
if((null != t.specialToken && beginToken.kind != SELECT && beginToken.kind != INSERT && beginToken.kind != UPDATE && beginToken.kind != DELETE && beginToken.kind != MERGE && beginToken.kind != EXECUTE) || t.kind == EOF)
return;
if (t.specialToken != null && "/".equals(t.image))
return;

View File

@ -0,0 +1,28 @@
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.plsql.ast;
import org.apache.commons.io.IOUtils;
import org.junit.Assert;
import org.junit.Test;
import net.sourceforge.pmd.lang.plsql.AbstractPLSQLParserTst;
public class ExecuteImmediateTest extends AbstractPLSQLParserTst {
@Test
public void parseExecuteImmediate1047a() throws Exception {
String code = IOUtils.toString(this.getClass().getResourceAsStream("ExecuteImmediate1047a.pls"));
ASTInput input = parsePLSQL(code);
Assert.assertNotNull(input);
}
@Test
public void parseExecuteImmediate1047b() throws Exception {
String code = IOUtils.toString(this.getClass().getResourceAsStream("ExecuteImmediate1047b.pls"));
ASTInput input = parsePLSQL(code);
Assert.assertNotNull(input);
}
}

View File

@ -0,0 +1,14 @@
--
-- BSD-style license; for more info see http://pmd.sourceforge.net/license.html
--
CREATE OR REPLACE PROCEDURE test ( p_num_reg OUT number )
AS
v_query clob;
BEGIN
v_query:='select count(1) from test_tbl where id =:param';
-- Note: execute immediate statement on multiple lines!
execute immediate v_query into p_num_reg
USING 'P';
END test;

View File

@ -0,0 +1,12 @@
--
-- BSD-style license; for more info see http://pmd.sourceforge.net/license.html
--
CREATE OR REPLACE PROCEDURE test ( p_num_reg OUT number )
AS
v_query clob;
BEGIN
v_query:='select count(1) from test_tbl where id =:param';
execute immediate v_query into p_num_reg USING 'P';
END test;