Merge branch 'pr-2327'

[plsql] Parsing of WHERE CURRENT OF added
This commit is contained in:
Andreas Dangel
2020-03-05 12:22:05 +01:00
4 changed files with 37 additions and 0 deletions

View File

@@ -92,6 +92,7 @@ should give more accurate results and especially fixes the problems with the usi
* java-performance
* [#2275](https://github.com/pmd/pmd/issues/2275): \[java] AppendCharacterWithChar flags literals in an expression
* plsql
* [#2327](https://github.com/pmd/pmd/pull/2327): \[plsql] Parsing of WHERE CURRENT OF
* [#2328](https://github.com/pmd/pmd/issues/2328): \[plsql] Support XMLROOT
### API Changes
@@ -184,6 +185,7 @@ methods on {% jdoc apex::lang.apex.ast.ApexParserVisitor %} and its implementati
* [#2317](https://github.com/pmd/pmd/pull/2317): \[apex] New Rule - Test Methods Must Be In Test Classes - [Brian Nørremark](https://github.com/noerremark)
* [#2321](https://github.com/pmd/pmd/pull/2321): \[apex] Support switch statements correctly in Cognitive Complexity - [Gwilym Kuiper](https://github.com/gwilymatgearset)
* [#2326](https://github.com/pmd/pmd/pull/2326): \[plsql] Added XML functions to parser: extract(xml), xml_root and fixed xml_forest - [Piotr Szymanski](https://github.com/szyman23)
* [#2327](https://github.com/pmd/pmd/pull/2327): \[plsql] Parsing of WHERE CURRENT OF added - [Piotr Szymanski](https://github.com/szyman23)
{% endtocmaker %}

View File

@@ -1358,7 +1358,11 @@ ASTGroupingExpressionList GroupingExpressionList() :
ASTWhereClause WhereClause() :
{}
{
(
LOOKAHEAD(3) <WHERE> <CURRENT> <OF> Expression()
|
<WHERE> Condition()
)
{ return jjtThis; }
}

View File

@@ -85,4 +85,9 @@ public class WhereClauseTest extends AbstractPLSQLParserTst {
public void testParentheses() {
plsql.parseResource("WhereClauseParens.pls");
}
@Test
public void testCurrentOf() {
plsql.parseResource("WhereCurrentOf.pls");
}
}

View File

@@ -0,0 +1,26 @@
declare
thisstudent student%rowtype;
cursor maths_student is
select *
from student
where sid in (select sid
from take
where cid = 'cs145')
for update;
begin
open maths_student;
loop
fetch maths_student
into thisstudent;
exit when(maths_student%notfound);
if (thisstudent.gpa < 4.0) then
update student
set gpa = 4.0
where current of maths_student;
end if;
end loop;
close maths_student;
end;