Package org.teiid.query.sql.util

Examples of org.teiid.query.sql.util.VariableContext


        CommandContext context = createCommandContext();
        context.setMetadata(metadata);       
        ProcessorPlan plan = helpGetPlan(command, metadata, capFinder, context);
       
        // Collect reference, set value
        VariableContext vc = new VariableContext();
        Iterator<?> valIter = values.iterator();
        for (Reference ref : ReferenceCollectorVisitor.getReferences(command)) {
            vc.setGlobalValue(ref.getContextSymbol(),  valIter.next()); //$NON-NLS-1$
    }
        context.setVariableContext(vc);
        // Run query
        helpProcess(plan, context, dataManager, expected);
  }   
View Full Code Here


                       
                        projectNode.addChild(batchNode);
                        // Add a new RelationalPlan that represents the plan for this batch.
                        childPlans.add(new RelationalPlan(projectNode));
                        if (planContexts != null) {
                          planContexts.add(new VariableContext());
                      }
                        // Skip those commands that were added to this batch
                        commandIndex += batch.size() - 1;
                        commandWasBatched = true;
                    }
View Full Code Here

        if (this.params != null) {
            for (Map.Entry<ElementSymbol, Expression> entry : this.params.entrySet()) {
                ElementSymbol param = entry.getKey();
                Expression expr = entry.getValue();
               
                VariableContext context = getCurrentVariableContext();
                Object value = this.evaluateExpression(expr);
   
                //check constraint
                checkNotNull(param, value);
                setParameterValue(param, context, value);
            }
        }
        if (this.implicitParams != null) {
          for (Map.Entry<ElementSymbol, Reference> entry : this.implicitParams.entrySet()) {
                VariableContext context = getCurrentVariableContext();
                Object value = this.evaluateExpression(entry.getValue());
                context.setValue(entry.getKey(), value);
        }
        }
        tempTableStore = new TempTableStore(getContext().getConnectionID());
        getContext().setTempTableStore(tempTableStore);
      }
View Full Code Here

        while(! isBatchFull()) {
            // May throw BlockedException and exit here
            List tuple = this.finalTupleSource.nextTuple();
            if(tuple == null) {
              if (outParams != null) {
                VariableContext vc = getCurrentVariableContext();
                List<Object> paramTuple = Arrays.asList(new Object[this.getOutputElements().size()]);
                int i = this.getOutputElements().size() - this.outParams.size();
                for (ElementSymbol param : outParams) {
                  Object value = vc.getValue(param);
                  checkNotNull(param, value);
            paramTuple.set(i++, value);
          }
                addBatchRow(paramTuple, true);
              }
View Full Code Here

    public void setImplicitParams(Map<ElementSymbol, Reference> implicitParams) {
    this.implicitParams = implicitParams;
  }
       
  private void createVariableContext() {
    this.currentVarContext = new VariableContext(true);
        this.currentVarContext.setValue(ROWS_UPDATED, 0);
        this.currentVarContext.setValue(ROWCOUNT, 0);
  }
View Full Code Here

    }
   
    public void push(Program program) {
      program.resetProgramCounter();
        this.programs.push(program);
        VariableContext context = new VariableContext(true);
        context.setParentContext(this.currentVarContext);
        this.currentVarContext = context;
       
        Set<String> current = getTempContext();
       
        Set<String> tempTables = getLocalTempTables();
View Full Code Here

        int index = outputElements.indexOf(mappingClassSymbol);

        Object value = values.get(index);

        VariableContext varContext = context.getVariableContext();

        // move on to the next row and don't push the program
        if (value == null) {
            if (Boolean.TRUE.equals(getFirst(varContext))) {
                context.getNextRow(getResultSetName());               
View Full Code Here

        this.resultInfo = resultInfo;
        this.bufferMgr = bufferMgr;
       
        ProcessorPlan plan = resultInfo.getPlan();
        CommandContext subContext = context.clone();
        subContext.pushVariableContext(new VariableContext());
        this.internalProcessor = new QueryProcessor(plan, subContext, bufferMgr, dataMgr);
    }
View Full Code Here

     * @see org.teiid.query.processor.ProcessorPlan#initialize(org.teiid.query.util.CommandContext, org.teiid.query.processor.ProcessorDataManager, org.teiid.common.buffer.BufferManager)
     * @since 4.2
     */
    public void initialize(CommandContext context, ProcessorDataManager dataMgr, BufferManager bufferMgr) {
      context = context.clone();
      context.setVariableContext(new VariableContext()); //start a new root variable context
      this.setContext(context);
        // Initialize all the child plans
        for (int i = 0; i < getPlanCount(); i++) {
            updatePlans[i].initialize(context, dataMgr, bufferMgr);
        }
View Full Code Here

  private void openPlan() throws TeiidComponentException,
      TeiidProcessingException {
    if (this.contexts != null && !this.contexts.isEmpty()) {
      CommandContext context = updatePlans[planIndex].getContext();
      context.getVariableContext().clear();
      VariableContext currentValues = this.contexts.get(planIndex);
      context.getVariableContext().putAll(currentValues);
    }
    updatePlans[planIndex].reset();
    updatePlans[planIndex].open();
    planOpened[planIndex] = true;
View Full Code Here

TOP

Related Classes of org.teiid.query.sql.util.VariableContext

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.