/** * Converts the given {@link Declaration} from being set as a range variable declaration to * a path expression declaration. * <p> * In this query "<code>UPDATE Employee SET firstName = 'MODIFIED' WHERE (SELECT COUNT(m) FROM * managedEmployees m) > 0</code>" <em>managedEmployees</em> is an unqualified collection-valued * path expression (<code>employee.managedEmployees</code>). * * @param declaration The {@link Declaration} that was parsed to range over an abstract schema * name but is actually ranging over a path expression * @param outerVariableName The identification variable coming from the parent identification * variable declaration */ void convertUnqualifiedDeclaration(RangeDeclaration declaration, String outerVariableName) { QualifyRangeDeclarationVisitor visitor = new QualifyRangeDeclarationVisitor(); // Convert the declaration expression into a derived declaration visitor.declaration = declaration; visitor.outerVariableName = outerVariableName; visitor.queryContext = queryContext.getCurrentContext(); declaration.declarationExpression.accept(visitor); // Now replace the old declaration with the new one int index = declarations.indexOf(declaration); declarations.set(index, visitor.declaration); // Update the base declaration if (baseDeclaration == declaration) { baseDeclaration = visitor.declaration; } }
/** * Converts the given {@link Declaration} from being set as a range variable declaration to * a path expression declaration. * <p> * In this query "<code>UPDATE Employee SET firstName = 'MODIFIED' WHERE (SELECT COUNT(m) FROM * managedEmployees m) > 0</code>" <em>managedEmployees</em> is an unqualified collection-valued * path expression (<code>employee.managedEmployees</code>). * * @param declaration The {@link Declaration} that was parsed to range over an abstract schema * name but is actually ranging over a path expression * @param outerVariableName The identification variable coming from the parent identification * variable declaration */ void convertUnqualifiedDeclaration(RangeDeclaration declaration, String outerVariableName) { QualifyRangeDeclarationVisitor visitor = new QualifyRangeDeclarationVisitor(); // Convert the declaration expression into a derived declaration visitor.declaration = declaration; visitor.outerVariableName = outerVariableName; visitor.queryContext = queryContext.getCurrentContext(); declaration.declarationExpression.accept(visitor); // Now replace the old declaration with the new one int index = declarations.indexOf(declaration); declarations.set(index, visitor.declaration); // Update the base declaration if (baseDeclaration == declaration) { baseDeclaration = visitor.declaration; } }