Merge branch 'pr-1974'

This commit is contained in:
Andreas Dangel
2019-09-08 11:47:49 +02:00
4 changed files with 79 additions and 3 deletions

View File

@ -61,7 +61,10 @@ about the usage and features of the rule designer.
* [#1966](https://github.com/pmd/pmd/issues/1966): \[java] CloseResource false positive if Stream is passed as method parameter
* [#1967](https://github.com/pmd/pmd/issues/1967): \[java] CloseResource false positive with late assignment of variable
* plsql
* [#1935](https://github.com/pmd/pmd/issues/1935): \[plsql] ParseException with SELECT INTO record defined as global variable
* [#1947](https://github.com/pmd/pmd/issues/1947): \[plsql] ParseError - SELECT with FOR UPDATE OF
* [#1948](https://github.com/pmd/pmd/issues/1948): \[plsql] ParseException with INSERT INTO using package global variables
* [#1950](https://github.com/pmd/pmd/issues/1950): \[plsql] ParseException with UPDATE and package record variable
### API Changes
@ -105,6 +108,7 @@ about the usage and features of the rule designer.
* [#1970](https://github.com/pmd/pmd/pull/1970): \[java] DoubleBraceInitialization: Fix example - [Tobias Weimer](https://github.com/tweimer)
* [#1971](https://github.com/pmd/pmd/pull/1971): \[java] 1862 - Message Digest should not be used as class field - [AnthonyKot](https://github.com/AnthonyKot)
* [#1972](https://github.com/pmd/pmd/pull/1972): \[plsql] ParseError - SELECT with FOR UPDATE OF - [Piotr Szymanski](https://github.com/szyman23)
* [#1974](https://github.com/pmd/pmd/pull/1974): \[plsql] Fixes for referencing record type variables - [Piotr Szymanski](https://github.com/szyman23)
* [#1994](https://github.com/pmd/pmd/pull/1994): \[core] Resolve pmd-report failure when java folder in filepath - [Amish Shah](https://github.com/shahamish150294)
{% endtocmaker %}

View File

@ -1911,6 +1911,7 @@ ASTVariableName VariableName() :
{
id = ID() { name.append(id.getImage()); }
[ "." id = ID() { name.append('.').append(id.getImage()); } ]
[ "." id = ID() { name.append('.').append(id.getImage()); } ]
{
jjtThis.setImage(name.toString());
return jjtThis;
@ -2351,7 +2352,7 @@ ASTValuesClause ValuesClause() :
(
"(" ( Expression() | <_DEFAULT> ) ( "," ( Expression() | <_DEFAULT> ) )* ")"
|
ID() // that's a record variable name
Name() // that's a record variable name
)
{ return jjtThis; }
}
@ -2435,7 +2436,7 @@ ASTUpdateSetClause UpdateSetClause() :
{
<SET>
(
LOOKAHEAD(1) <ROW> "=" ID()
LOOKAHEAD(1) <ROW> "=" Name()
|
"VALUE" "(" TableAlias() ")" "=" ( LOOKAHEAD(1) "(" Subquery() ")" | Expression() )
|
@ -2457,7 +2458,7 @@ ASTUpdateSetClause UpdateSetClause() :
ASTReturningClause ReturningClause() :
{}
{
( <RETURN> | <RETURNING> ) ( Expression() (",")? )+ <INTO> ( ID() (",")? )+
( <RETURN> | <RETURNING> ) ( Expression() (",")? )+ <INTO> ( Name() (",")? )+
{ return jjtThis; }
}

View File

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

View File

@ -0,0 +1,47 @@
create or replace package body solt9001 is
procedure upd is
begin
update solt90_web_service_log
set row = solt9001.rec
returning record_version into solt9001.rec.record_version;
end upd;
end;
/
create or replace package body solt9001 is
procedure upd is
begin
update solt90_web_service_log
set row = solt9001.rec
returning record_version into solt9001.rec.record_version;
end upd;
end;
/
create or replace function test return varchar2 is
begin
insert into sol_individual_commission_rate
values solt4601.rec
returning record_version, rowid into solt4601.rec.record_version, solt4601.current_rowid;
return null;
end test;
/
begin
select id_no into t4666.rec.agent_no from name where company_reg_no = '66666111';
end;
/