fixes for referencing record type variables
This commit is contained in:
@@ -1885,6 +1885,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;
|
||||
@@ -2325,7 +2326,7 @@ ASTValuesClause ValuesClause() :
|
||||
(
|
||||
"(" ( Expression() | <_DEFAULT> ) ( "," ( Expression() | <_DEFAULT> ) )* ")"
|
||||
|
|
||||
ID() // that's a record variable name
|
||||
Name() // that's a record variable name
|
||||
)
|
||||
{ return jjtThis; }
|
||||
}
|
||||
@@ -2409,7 +2410,7 @@ ASTUpdateSetClause UpdateSetClause() :
|
||||
{
|
||||
<SET>
|
||||
(
|
||||
LOOKAHEAD(1) <ROW> "=" ID()
|
||||
LOOKAHEAD(1) <ROW> "=" Name()
|
||||
|
|
||||
"VALUE" "(" TableAlias() ")" "=" ( LOOKAHEAD(1) "(" Subquery() ")" | Expression() )
|
||||
|
|
||||
@@ -2431,7 +2432,7 @@ ASTUpdateSetClause UpdateSetClause() :
|
||||
ASTReturningClause ReturningClause() :
|
||||
{}
|
||||
{
|
||||
( <RETURN> | <RETURNING> ) ( Expression() (",")? )+ <INTO> ( ID() (",")? )+
|
||||
( <RETURN> | <RETURNING> ) ( Expression() (",")? )+ <INTO> ( Name() (",")? )+
|
||||
{ return jjtThis; }
|
||||
}
|
||||
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
@@ -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;
|
||||
/
|
Reference in New Issue
Block a user