Package org.teiid.query.sql.symbol

Examples of org.teiid.query.sql.symbol.Reference


 
  @Test public void testEvaluatedSetCriteria() throws Exception {
    DependentAccessNode dan = new DependentAccessNode(0);
    CommandContext cc = new CommandContext();
    dan.setContext(cc);
    List<Reference> references = Arrays.asList(new Reference(1), new Reference(2));
    for (Reference reference : references) {
      cc.getVariableContext().setGlobalValue(reference.getContextSymbol(), 1);
    }
    SetCriteria sc = new SetCriteria(new ElementSymbol("e1"), references); //$NON-NLS-1$
    DependentCriteriaProcessor dcp = new DependentCriteriaProcessor(1, -1, dan, sc);
View Full Code Here


        insert.setGroup(new GroupSymbol("m.g")); //$NON-NLS-1$
        List vars = new ArrayList();
        vars.add(new ElementSymbol("a"));         //$NON-NLS-1$
        insert.setVariables(vars);
        List values = new ArrayList();
        values.add(new Reference(0));
        insert.setValues(values);
        Option option = new Option();
        option.setNoCache(true);      
        insert.setOption(option);
        TestParser.helpTest("INSERT INTO m.g (a) VALUES (?) OPTION NOCACHE"//$NON-NLS-1$
View Full Code Here

    }
   
    @Test public void testUpdateWithOption() {
        Update update = new Update();    
        update.setGroup(new GroupSymbol("m.g")); //$NON-NLS-1$
        update.addChange(new ElementSymbol("a"), new Reference(0));
        Option option = new Option();
        option.setNoCache(true);
        Criteria crit = new CompareCriteria(new ElementSymbol("b"), CompareCriteria.EQ, new Reference(1)); //$NON-NLS-1$
        update.setCriteria(crit);
        TestParser.helpTest("UPDATE m.g SET a = ? WHERE b = ? OPTION NOCACHE"//$NON-NLS-1$
                 "UPDATE m.g SET a = ? WHERE b = ? OPTION NOCACHE"//$NON-NLS-1$
                 update);                    
    }
View Full Code Here

            findInputNodes(inputSymbols, critNode, conjuncts, coveredParams);
           
            List defaults = new LinkedList();
           
            for (Iterator params = inputReferences.iterator(); params.hasNext();) {
                Reference ref = (Reference)params.next();
                ElementSymbol symbol = ref.getExpression();
               
                Expression defaultValue = null;
               
                /*try {
                    defaultValue = ResolverUtil.getDefault(symbol, metadata);
View Full Code Here

                boolean checkForInput(Expression expr) {
                    if (!(expr instanceof Reference)) {
                        return false;
                    }
                    //if the expr is a function containing a reference should give a warning
                    Reference ref = (Reference)expr;
                    return inputs.contains(ref.getExpression());
                }
               
        boolean checkForAnyInput(LanguageObject expr) {
                  for (Reference ref : ReferenceCollectorVisitor.getReferences(expr)) {
                        if (checkForInput(ref)) {
View Full Code Here

      PreparedPlan pPlan = cache.get(new CacheID(token2, pi, EXAMPLE_QUERY + 12));
      assertNotNull("Unable to get prepared plan from cache", pPlan); //$NON-NLS-1$
      assertEquals("Error getting plan from cache", new RelationalPlan(new ProjectNode(12)).toString(), pPlan.getPlan().toString()); //$NON-NLS-1$
      assertEquals("Error getting command from cache", EXAMPLE_QUERY + 12, pPlan.getCommand().toString()); //$NON-NLS-1$
      assertNotNull("Error getting plan description from cache", pPlan.getAnalysisRecord()); //$NON-NLS-1$
      assertEquals("Error gettting reference from cache", new Reference(1), pPlan.getReferences().get(0)); //$NON-NLS-1$
    }
View Full Code Here

        pPlan.setCommand(dummy);
        pPlan.setPlan(new RelationalPlan(new ProjectNode(i)), new CommandContext());
            AnalysisRecord analysisRecord = new AnalysisRecord(true, false);
        pPlan.setAnalysisRecord(analysisRecord);
        ArrayList<Reference> refs = new ArrayList<Reference>();
        refs.add(new Reference(1));
        pPlan.setReferences(refs);
      }
    }
View Full Code Here

      this.refs = refs;
    }
   
    public Expression replaceExpression(Expression element) {
      if (element instanceof Reference) {
        Reference r = (Reference)element;
        Expression ex = refs.getMappedExpression(r.getExpression());
        if (ex != null) {
          if (ex instanceof ElementSymbol) {
            ElementSymbol es = (ElementSymbol) ex.clone();
            es.setIsExternalReference(false);
            ex = es;
View Full Code Here

        }
       
        if (insert.getQueryExpression() != null && metadata.isVirtualGroup(insert.getGroup().getMetadataID())) {
          List<Reference> references = new ArrayList<Reference>(insert.getVariables().size());
          for (int i = 0; i < insert.getVariables().size(); i++) {
            Reference ref = new Reference(i);
            ref.setType(((ElementSymbol)insert.getVariables().get(i)).getType());
        references.add(ref);
      }
          insert.setValues(references);
        }
    }
View Full Code Here

           
            QueryNode modifiedNode = new QueryNode(null);
            modifiedNode.setCommand(contextQuery);
           
            for (Iterator<Reference> i = bindings.iterator(); i.hasNext();) {
                Reference ref = i.next();
                modifiedNode.addBinding(ref.getExpression().toString());
            }
           
            GroupSymbol groupSymbol = QueryUtil.createResolvedGroup(rsInfo.getResultSetName(), planEnv.getGlobalMetadata());
            planEnv.addQueryNodeToMetadata(groupSymbol.getMetadataID(), modifiedNode);
        }
View Full Code Here

TOP

Related Classes of org.teiid.query.sql.symbol.Reference

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.