Package org.teiid.query.processor.proc

Examples of org.teiid.query.processor.proc.Program


          }
        }

        Block block = cupc.getBlock();

    Program programBlock = planBlock(cupc, block, metadata, debug, idGenerator, capFinder, analysisRecord, context);

        if(debug) {
            analysisRecord.println("\n####################################################"); //$NON-NLS-1$
        }
               
View Full Code Here


        throws QueryPlannerException, QueryMetadataException, TeiidComponentException {

        // Generate program and add instructions
        // this program represents the block on the procedure
        // instruction in the program would correspond to statements in the block
        Program programBlock = new Program();

    // plan each statement in the block
        for (Statement statement : block.getStatements()) {
      Object instruction = planStatement(parentProcCommand, statement, metadata, debug, idGenerator, capFinder, analysisRecord, context);
            if(instruction instanceof ProgramInstruction){
                programBlock.addInstruction((ProgramInstruction)instruction);
            }else{
                //an array of ProgramInstruction
                ProgramInstruction[] insts = (ProgramInstruction[])instruction;
                for(int i=0; i<insts.length; i++){
              programBlock.addInstruction(insts[i]);
                }
            }
        }

        return programBlock;
View Full Code Here

        break;
            }
      case Statement.TYPE_IF:
            {
        IfStatement ifStmt = (IfStatement)statement;
        Program ifProgram = planBlock(parentProcCommand, ifStmt.getIfBlock(), metadata, debug, idGenerator, capFinder, analysisRecord, context);
        Program elseProgram = null;
        if(ifStmt.hasElseBlock()) {
          elseProgram = planBlock(parentProcCommand, ifStmt.getElseBlock(), metadata, debug, idGenerator, capFinder, analysisRecord, context);
        }
        instruction = new IfInstruction(ifStmt.getCondition(), ifProgram, elseProgram);
        if(debug) {
          analysisRecord.println("\tIF STATEMENT:\n" + statement); //$NON-NLS-1$
        }
        break;
            }
            case Statement.TYPE_BREAK:
            {
                if(debug) {
                  analysisRecord.println("\tBREAK STATEMENT:\n" + statement); //$NON-NLS-1$
                }
                instruction = new BreakInstruction();
                break;
            }
            case Statement.TYPE_CONTINUE:
            {
                if(debug) {
                  analysisRecord.println("\tCONTINUE STATEMENT:\n" + statement); //$NON-NLS-1$
                }
                instruction = new ContinueInstruction();
                break;
            }
            case Statement.TYPE_LOOP:
            {
                LoopStatement loopStmt = (LoopStatement)statement;
                if(debug) {
                  analysisRecord.println("\tLOOP STATEMENT:\n" + statement); //$NON-NLS-1$
                }
                String rsName = loopStmt.getCursorName();

                ProcessorPlan commandPlan = loopStmt.getCommand().getProcessorPlan();

                Program loopProgram = planBlock(parentProcCommand, loopStmt.getBlock(), metadata, debug, idGenerator, capFinder, analysisRecord, context);
                instruction = new LoopInstruction(loopProgram, rsName, commandPlan);
                break;
            }
            case Statement.TYPE_WHILE:
            {
                WhileStatement whileStmt = (WhileStatement)statement;
                Program whileProgram = planBlock(parentProcCommand, whileStmt.getBlock(), metadata, debug, idGenerator, capFinder, analysisRecord, context);
                if(debug) {
                  analysisRecord.println("\tWHILE STATEMENT:\n" + statement); //$NON-NLS-1$
                }
                instruction = new WhileInstruction(whileProgram, whileStmt.getCondition());
                break;
View Full Code Here

TOP

Related Classes of org.teiid.query.processor.proc.Program

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.