Package org.teiid.query.sql.proc

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


    /**IF statement with has criteria no on */
    @Test public void testCreateUpdateProcedureCommand8(){
        //declare var1
        ElementSymbol var1 = new ElementSymbol("var1"); //$NON-NLS-1$
        String shortType = new String("short"); //$NON-NLS-1$
        Statement declStmt = new DeclareStatement(var1, shortType);
       
        //ifblock
        List symbols = new ArrayList();
        symbols.add(new ElementSymbol("a1"))//$NON-NLS-1$
        Select select = new Select(symbols);      
       
        From from = new From();
        from.addGroup(new GroupSymbol("g")); //$NON-NLS-1$
       
        Criteria criteria = new CompareCriteria(new ElementSymbol("a2"), CompareCriteria.EQ,  //$NON-NLS-1$
            new Constant(new Integer(5)));
       
        Query query = new Query();
        query.setSelect(select);
        query.setFrom(from);
        query.setCriteria(criteria);
       
        AssignmentStatement queryStmt = new AssignmentStatement(var1, query);
             
        Block ifBlock = new Block();     
        ifBlock.addStatement(queryStmt);
       
        //else block
        ElementSymbol var2 = new ElementSymbol("var2"); //$NON-NLS-1$
        Statement elseDeclStmt = new DeclareStatement(var2, shortType);    
       
        List elseSymbols = new ArrayList();
        elseSymbols.add(new ElementSymbol("b1"))//$NON-NLS-1$
        Select elseSelect = new Select(elseSymbols);
   
View Full Code Here


        query.setSelect(select);
        query.setFrom(from);
       
        ElementSymbol x = new ElementSymbol("x"); //$NON-NLS-1$
        String intType = new String("integer"); //$NON-NLS-1$
        Statement dStmt = new DeclareStatement(x, intType);
        c1 = new ElementSymbol("mycursor.c1", true); //$NON-NLS-1$
        Statement assignmentStmt = new AssignmentStatement(x, c1);
        Block block = new Block();
        block.addStatement(dStmt);
        block.addStatement(assignmentStmt);
View Full Code Here

        query.setFrom(from);
        query.setOrderBy(orderBy);
       
        ElementSymbol x = new ElementSymbol("x"); //$NON-NLS-1$
        String intType = new String("integer"); //$NON-NLS-1$
        Statement dStmt = new DeclareStatement(x, intType);
        c1 = new ElementSymbol("mycursor.c1", true); //$NON-NLS-1$
        Statement assignmentStmt = new AssignmentStatement(x, c1);
        Block block = new Block();
        block.addStatement(dStmt);
        block.addStatement(assignmentStmt);
View Full Code Here

    }
   
    @Test public void testVirtualProcedure(){       
        ElementSymbol x = new ElementSymbol("x"); //$NON-NLS-1$
        String intType = new String("integer"); //$NON-NLS-1$
        Statement dStmt = new DeclareStatement(x, intType);
       
        GroupSymbol g = new GroupSymbol("m.g"); //$NON-NLS-1$
        From from = new From();
        from.addGroup(g);
       
View Full Code Here

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

  public static final DeclareStatement sample1() {
    return new DeclareStatement(new ElementSymbol("a"), "String"); //$NON-NLS-1$ //$NON-NLS-2$
  }
View Full Code Here

  public static final DeclareStatement sample1() {
    return new DeclareStatement(new ElementSymbol("a"), "String"); //$NON-NLS-1$ //$NON-NLS-2$
  }
 
  public static final DeclareStatement sample2() {
    return new DeclareStatement(new ElementSymbol("b"), "Integer"); //$NON-NLS-1$ //$NON-NLS-2$
  }
View Full Code Here

  }
 
  // ################################## ACTUAL TESTS ################################ 
 
  public void testGetVariable() {
    DeclareStatement s1 = sample1();
    assertEquals("Incorrect variable ", s1.getVariable(), new ElementSymbol("a"));     //$NON-NLS-1$ //$NON-NLS-2$
  }
View Full Code Here

    DeclareStatement s1 = sample1();
    assertEquals("Incorrect variable ", s1.getVariable(), new ElementSymbol("a"));     //$NON-NLS-1$ //$NON-NLS-2$
  }
 
  public void testGetVariableType() {
    DeclareStatement s1 = sample1();
    assertEquals("Incorrect variable type ", s1.getVariableType(), "String"); //$NON-NLS-1$ //$NON-NLS-2$
  }
View Full Code Here

    DeclareStatement s1 = sample1();
    assertEquals("Incorrect variable type ", s1.getVariableType(), "String"); //$NON-NLS-1$ //$NON-NLS-2$
  }
 
  public void testSelfEquivalence(){
    DeclareStatement s1 = sample1();
    int equals = 0;
    UnitTestUtil.helpTestEquivalence(equals, s1, s1);
  }
View Full Code Here

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

  public void testEquivalence(){
    DeclareStatement s1 = sample1();
    DeclareStatement s1a = sample1();
    int equals = 0;
    UnitTestUtil.helpTestEquivalence(equals, s1, s1a);
  }
View Full Code Here

TOP

Related Classes of org.teiid.query.sql.proc.DeclareStatement

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.