public void visit(ElementSymbol obj) { if (this.otherElements != null && !obj.isExternalReference()) { this.otherElements.add(obj); } }
public void visit(ElementSymbol obj) { if (this.otherElements != null && !obj.isExternalReference()) { this.otherElements.add(obj); } }
public void visit(ElementSymbol obj) { if (this.otherElements != null && !obj.isExternalReference()) { this.otherElements.add(obj); } }
static List<ElementSymbol> getBindingsReferences(LanguageObject object, Collection<ElementSymbol> allBindings) { List<ElementSymbol> elements = new LinkedList<ElementSymbol>(); ElementCollectorVisitor visitor = new ElementCollectorVisitor(elements); DeepPreOrderNavigator.doVisit(object, visitor); for (Iterator<ElementSymbol> i = elements.iterator(); i.hasNext();) { ElementSymbol elementSymbol = i.next(); if (!elementSymbol.isExternalReference() || !allBindings.contains(elementSymbol)) { i.remove(); } } return elements; }
public void visit(ElementSymbol obj) { if (obj.isExternalReference() && correlationGroups.contains(obj.getGroupSymbol()) && (groupingSymbols == null || !groupingSymbols.contains(obj))) { super.visit(obj); } } };
public void visit(ElementSymbol obj) { if (obj.isExternalReference() && correlationGroups.contains(obj.getGroupSymbol()) && (groupingSymbols == null || !groupingSymbols.contains(obj))) { super.visit(obj); } } };
public void visit(ElementSymbol obj) { if (obj.isExternalReference() && correlationGroups.contains(obj.getGroupSymbol()) && (groupingSymbols == null || !groupingSymbols.contains(obj))) { super.visit(obj); } } };
/** * Visit a language object and collect symbols. This method should <b>NOT</b> be * called directly. * @param obj Language object */ public void visit(Reference obj) { ElementSymbol e = obj.getExpression(); if (e == null|| !e.isExternalReference()) { return; } GroupSymbol g = e.getGroupSymbol(); for (int i = this.outerGroups.size() - (queryRoot?2:1); i >= 0; i--) { GroupSymbol outer = this.outerGroups.get(i).get(g); if (outer == null) { continue; } try { if (ResolverUtil.resolveElementsInGroup(outer, metadata).contains(e)) { //add if correlated to the root groups if (i == 0) { this.references.add(obj); } return; } } catch (TeiidComponentException e1) { throw new TeiidRuntimeException(e1); } } }
/** * Visit a language object and collect symbols. This method should <b>NOT</b> be * called directly. * @param obj Language object */ public void visit(Reference obj) { ElementSymbol e = obj.getExpression(); if (e == null|| !e.isExternalReference()) { return; } GroupSymbol g = e.getGroupSymbol(); for (int i = this.outerGroups.size() - (queryRoot?2:1); i >= 0; i--) { GroupSymbol outer = this.outerGroups.get(i).get(g); if (outer == null) { continue; } try { if (ResolverUtil.resolveElementsInGroup(outer, metadata).contains(e)) { //add if correlated to the root groups if (i == 0) { this.references.add(obj); } return; } } catch (TeiidComponentException e1) { throw new TeiidRuntimeException(e1); } } }
public static Collection<ElementSymbol> getVariables(LanguageObject languageObject) { Collection<ElementSymbol> variables = ElementCollectorVisitor.getElements(languageObject, false, true); for (Iterator<ElementSymbol> iterator = variables.iterator(); iterator.hasNext();) { ElementSymbol elementSymbol = iterator.next(); if (!elementSymbol.isExternalReference()) { iterator.remove(); } } return variables; }
private void validateNoSubqueriesOrOuterReferences(Expression expr) { if (!ValueIteratorProviderCollectorVisitor.getValueIteratorProviders(expr).isEmpty()) { handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.filter_subquery", expr), expr); //$NON-NLS-1$ } for (ElementSymbol es : ElementCollectorVisitor.getElements(expr, false)) { if (es.isExternalReference()) { handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.filter_subquery", es), es); //$NON-NLS-1$ } } }
private void validateNoSubqueriesOrOuterReferences(Expression expr) { if (!ValueIteratorProviderCollectorVisitor.getValueIteratorProviders(expr).isEmpty()) { handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.filter_subquery", expr), expr); //$NON-NLS-1$ } for (ElementSymbol es : ElementCollectorVisitor.getElements(expr, false)) { if (es.isExternalReference()) { handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.filter_subquery", es), es); //$NON-NLS-1$ } } }
private void validateNoSubqueriesOrOuterReferences(Expression expr) { if (!ValueIteratorProviderCollectorVisitor.getValueIteratorProviders(expr).isEmpty()) { handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.filter_subquery", expr), expr); //$NON-NLS-1$ } for (ElementSymbol es : ElementCollectorVisitor.getElements(expr, false)) { if (es.isExternalReference()) { handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.filter_subquery", es), es); //$NON-NLS-1$ } } }
@Override public void visit(OrderByItem obj) { validateSortable(obj.getSymbol()); if (obj.getExpressionPosition() < 0) { for (SubqueryContainer subquery : ValueIteratorProviderCollectorVisitor.getValueIteratorProviders(obj)) { for (ElementSymbol es : ElementCollectorVisitor.getElements(obj, true, true)) { if (es.isExternalReference()) { handleValidationError(QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31156, subquery), obj); } } } } }
@Override public void visit(OrderByItem obj) { validateSortable(obj.getSymbol()); if (obj.getExpressionPosition() < 0) { for (SubqueryContainer subquery : ValueIteratorProviderCollectorVisitor.getValueIteratorProviders(obj)) { for (ElementSymbol es : ElementCollectorVisitor.getElements(obj, true, true)) { if (es.isExternalReference()) { handleValidationError(QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31156, subquery), obj); } } } } }
@Override public void visit(OrderByItem obj) { validateSortable(obj.getSymbol()); if (obj.getExpressionPosition() < 0) { for (SubqueryContainer subquery : ValueIteratorProviderCollectorVisitor.getValueIteratorProviders(obj)) { for (ElementSymbol es : ElementCollectorVisitor.getElements(obj, true, true)) { if (es.isExternalReference()) { handleValidationError(QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31156, subquery), obj); } } } } }
/** * Return a deep copy of this object. * @return Deep copy of this object */ public ElementSymbol clone() { ElementSymbol copy = new ElementSymbol(getShortName(), null); if(getGroupSymbol() != null) { copy.setGroupSymbol(getGroupSymbol().clone()); } copy.setMetadataID(getMetadataID()); copy.setType(getType()); copy.setIsExternalReference(isExternalReference()); copy.outputName = this.outputName; copy.setDisplayMode(this.getDisplayMode()); copy.isAggregate = isAggregate; return copy; }
/** * Return a deep copy of this object. * @return Deep copy of this object */ public ElementSymbol clone() { ElementSymbol copy = new ElementSymbol(getShortName(), null); if(getGroupSymbol() != null) { copy.setGroupSymbol(getGroupSymbol().clone()); } copy.setMetadataID(getMetadataID()); copy.setType(getType()); copy.setIsExternalReference(isExternalReference()); copy.outputName = this.outputName; copy.setDisplayMode(this.getDisplayMode()); copy.isAggregate = isAggregate; return copy; }
/** * Return a deep copy of this object. * @return Deep copy of this object */ public ElementSymbol clone() { ElementSymbol copy = new ElementSymbol(getShortName(), null); if(getGroupSymbol() != null) { copy.setGroupSymbol(getGroupSymbol().clone()); } copy.setMetadataID(getMetadataID()); copy.setType(getType()); copy.setIsExternalReference(isExternalReference()); copy.outputName = this.outputName; copy.setDisplayMode(this.getDisplayMode()); copy.isAggregate = isAggregate; return copy; }
@Test public void testAlterProcedure() { AlterProcedure alterProc = (AlterProcedure) helpResolve("alter procedure MMSP5 as begin select param1; end", RealMetadataFactory.exampleBQTCached()); assertNotNull(alterProc.getTarget().getMetadataID()); Query q = (Query)((CommandStatement)alterProc.getDefinition().getBlock().getStatements().get(0)).getCommand(); assertTrue(((ElementSymbol)q.getSelect().getSymbol(0)).isExternalReference()); }