예제 #1
0
  public void push(Program program) throws XATransactionException {
    this.evaluator.close();
    program.reset(this.getContext().getConnectionId());
    program.setTrappingExceptions(
        program.getExceptionGroup() != null
            || (!this.programs.isEmpty() && this.programs.peek().isTrappingExceptions()));
    TempTableStore tts = getTempTableStore();
    getContext().setTempTableStore(program.getTempTableStore());
    program.getTempTableStore().setParentTempTableStore(tts);
    this.programs.push(program);
    VariableContext context = new VariableContext(true);
    context.setParentContext(this.currentVarContext);
    this.currentVarContext = context;
    VariableContext cc = new VariableContext(true);
    cc.setParentContext(this.cursorStates);
    this.cursorStates = cc;

    if (program.isAtomic() && this.blockContext == null) {
      TransactionContext tc = this.getContext().getTransactionContext();
      if (tc != null && tc.getTransactionType() == Scope.NONE) {
        // start a transaction
        this.getContext().getTransactionServer().begin(tc);
        this.blockContext = tc;
        program.setStartedTxn(true);
      }
    }
  }