Examples of WhileStatement


Examples of org.teiid.query.sql.proc.WhileStatement

                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;
            }
      default:
            throw new QueryPlannerException(QueryPlugin.Util.getString("ProcedurePlanner.bad_stmt", stmtType)); //$NON-NLS-1$
    }
View Full Code Here

Examples of org.teiid.query.sql.proc.WhileStatement

              String varTypeName = DataTypeManager.getDataTypeName(varType);
              exprStmt.setExpression(ResolverUtil.convertExpression(exprStmt.getExpression(), varTypeName, metadata));         
                }
                break;
            case Statement.TYPE_WHILE:
                WhileStatement whileStmt = (WhileStatement) statement;
                Criteria whileCrit = whileStmt.getCondition();
                for (SubqueryContainer container : ValueIteratorProviderCollectorVisitor.getValueIteratorProviders(whileCrit)) {
                  resolveEmbeddedCommand(metadata, externalGroups, container.getCommand());
                }
                ResolverVisitor.resolveLanguageObject(whileCrit, null, externalGroups, metadata);
                resolveBlock(command, whileStmt.getBlock(), externalGroups, metadata);
                break;
            case Statement.TYPE_LOOP:
                LoopStatement loopStmt = (LoopStatement) statement;
                String groupName = loopStmt.getCursorName();
View Full Code Here

Examples of org.teiid.query.sql.proc.WhileStatement

                    return null;
                }
               
                return loop;
            case Statement.TYPE_WHILE:
                WhileStatement whileStatement = (WhileStatement) statement;
                Criteria crit = whileStatement.getCondition();
                crit = rewriteCriteria(crit);
               
                whileStatement.setCondition(crit);
                if(crit.equals(TRUE_CRITERIA)) {
                    throw new QueryValidatorException(QueryPlugin.Util.getString("QueryRewriter.infinite_while")); //$NON-NLS-1$
                } else if(crit.equals(FALSE_CRITERIA) || crit.equals(UNKNOWN_CRITERIA)) {
                    return null;
                }
                whileStatement.setBlock(rewriteBlock(whileStatement.getBlock()));
               
                if (whileStatement.getBlock().getStatements().isEmpty()) {
                    return null;
                }
               
                return whileStatement;
      default:
View Full Code Here

Examples of org.teiid.query.sql.proc.WhileStatement

        Statement assignmentStmt = new AssignmentStatement(x, f);
        Block block = new Block();
        block.addStatement(assignmentStmt);
        Criteria crit = new CompareCriteria(x, CompareCriteria.LT,
                    new Constant(new Integer(100)));
        WhileStatement whileStmt = new WhileStatement(crit, block);
        helpStmtTest("WHILE (x < 100) BEGIN x=x+1; END", //$NON-NLS-1$
                     "WHILE(x < 100)"+"\n"+ "BEGIN"+"\n"+"x = (x + 1);" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
                     +"\n"+"END", whileStmt); //$NON-NLS-1$ //$NON-NLS-2$
    }
View Full Code Here

Examples of org.teiid.query.sql.proc.WhileStatement

    // ################################## TEST HELPERS ################################

    public static final WhileStatement sample1() {
        Block block = TestBlock.sample1();
        Criteria criteria = TestHasCriteria.sample1();
        return new WhileStatement(criteria, block);
    }
View Full Code Here

Examples of org.teiid.query.sql.proc.WhileStatement

    }

    public static final WhileStatement sample2() {
        Block block = TestBlock.sample2();
        Criteria criteria = TestHasCriteria.sample2();
        return new WhileStatement(criteria, block);
    }
View Full Code Here

Examples of org.teiid.query.sql.proc.WhileStatement

   
    // ################################## ACTUAL TESTS ################################


    public void testGetIfBlock() {
        WhileStatement b1 = sample1();
        assertTrue("Incorrect Block on statement", b1.getBlock().equals(TestBlock.sample1())); //$NON-NLS-1$
    }
View Full Code Here

Examples of org.teiid.query.sql.proc.WhileStatement

        WhileStatement b1 = sample1();
        assertTrue("Incorrect Block on statement", b1.getBlock().equals(TestBlock.sample1())); //$NON-NLS-1$
    }
   
    public void testGetCondition() {
        WhileStatement b1 = sample1();
        assertTrue("Incorrect Block on statement", b1.getCondition().equals(TestHasCriteria.sample1())); //$NON-NLS-1$
    }
View Full Code Here

Examples of org.teiid.query.sql.proc.WhileStatement

        WhileStatement b1 = sample1();
        assertTrue("Incorrect Block on statement", b1.getCondition().equals(TestHasCriteria.sample1())); //$NON-NLS-1$
    }
   
    public void testSelfEquivalence(){
        WhileStatement s1 = sample1();
        int equals = 0;
        UnitTestUtil.helpTestEquivalence(equals, s1, s1);
    }
View Full Code Here

Examples of org.teiid.query.sql.proc.WhileStatement

        int equals = 0;
        UnitTestUtil.helpTestEquivalence(equals, s1, s1);
    }

    public void testEquivalence(){
        WhileStatement s1 = sample1();
        WhileStatement s1a = sample1();
        int equals = 0;
        UnitTestUtil.helpTestEquivalence(equals, s1, s1a);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.