Search in sources :

Example 21 with VariableContext

use of org.teiid.query.sql.util.VariableContext in project teiid by teiid.

the class DependentProcedureAccessNode method open.

@Override
public void open() throws TeiidComponentException, TeiidProcessingException {
    CommandContext context = getContext().clone();
    context.pushVariableContext(new VariableContext());
    this.setContext(context);
    DependentProcedureExecutionNode.shareVariableContext(this, context);
    super.open();
}
Also used : CommandContext(org.teiid.query.util.CommandContext) VariableContext(org.teiid.query.sql.util.VariableContext)

Example 22 with VariableContext

use of org.teiid.query.sql.util.VariableContext in project teiid by teiid.

the class AssignmentInstruction method process.

/**
 * <p> Updates the current variable context with a value for the Variable
 * defined using a DeclareInstruction, the variable value is obtained by either processing
 * a expression or a command(stored as a processplan). The Processing of the command is
 * expected to result in 1 column, 1 row tuple, if more than a row is returned an exception
 * is thrown. Also updates the program counter.</p>
 * @throws BlockedException
 * @throws TeiidComponentException if error processing command or expression on this instruction
 */
public void process(ProcedurePlan procEnv) throws BlockedException, TeiidComponentException, TeiidProcessingException {
    VariableContext varContext = procEnv.getCurrentVariableContext();
    Object value = null;
    if (this.expression != null) {
        value = procEnv.evaluateExpression(this.expression);
    }
    varContext.setValue(getVariable(), value);
    LogManager.logTrace(LogConstants.CTX_DQP, new Object[] { // $NON-NLS-1$
    this.toString() + " The variable " + getVariable() + " in the variablecontext is updated with the value :", // $NON-NLS-1$
    value });
}
Also used : VariableContext(org.teiid.query.sql.util.VariableContext)

Aggregations

VariableContext (org.teiid.query.sql.util.VariableContext)22 ElementSymbol (org.teiid.query.sql.symbol.ElementSymbol)6 Expression (org.teiid.query.sql.symbol.Expression)6 List (java.util.List)5 TransactionContext (org.teiid.dqp.service.TransactionContext)5 CommandContext (org.teiid.query.util.CommandContext)5 ArrayList (java.util.ArrayList)4 Map (java.util.Map)3 TeiidProcessingException (org.teiid.core.TeiidProcessingException)3 QueryProcessor (org.teiid.query.processor.QueryProcessor)3 Command (org.teiid.query.sql.lang.Command)3 Constant (org.teiid.query.sql.symbol.Constant)3 LinkedHashMap (java.util.LinkedHashMap)2 LinkedList (java.util.LinkedList)2 ExpressionEvaluationException (org.teiid.api.exception.query.ExpressionEvaluationException)2 QueryValidatorException (org.teiid.api.exception.query.QueryValidatorException)2 XATransactionException (org.teiid.client.xa.XATransactionException)2 BlockedException (org.teiid.common.buffer.BlockedException)2 TupleBatch (org.teiid.common.buffer.TupleBatch)2 TeiidComponentException (org.teiid.core.TeiidComponentException)2