Examples of AssignmentStatement


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

       
        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);
       
        String cursor = "mycursor"; //$NON-NLS-1$
View Full Code Here

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

       
        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);
       
        String cursor = "mycursor"; //$NON-NLS-1$
View Full Code Here

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

   
   
    @Test public void testWhileStatement() throws Exception {
        ElementSymbol x = new ElementSymbol("x", false); //$NON-NLS-1$
        Function f = new Function("+", new Expression[] { x, new Constant(new Integer(1)) }); //$NON-NLS-1$
        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);
View Full Code Here

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

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

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

        CreateUpdateProcedureCommand command = helpResolveUpdateProcedure(proc.toString(), userUpdateStr,
                                     FakeMetadataObject.Props.UPDATE_PROCEDURE);
       
        Block block = command.getBlock();
       
        AssignmentStatement assStmt = (AssignmentStatement)block.getStatements().get(1);
        assertEquals(ProcedureReservedWords.VARIABLES, assStmt.getVariable().getGroupSymbol().getCanonicalName());
        assertEquals(ProcedureReservedWords.VARIABLES, ((ElementSymbol)assStmt.getValue()).getGroupSymbol().getCanonicalName());
       
        Block inner = ((LoopStatement)block.getStatements().get(2)).getBlock();
       
        assStmt = (AssignmentStatement)inner.getStatements().get(0);
       
        ElementSymbol value = ElementCollectorVisitor.getElements(assStmt.getValue(), false).iterator().next();
       
        assertEquals("LOOPCURSOR", value.getGroupSymbol().getCanonicalName()); //$NON-NLS-1$
    }
View Full Code Here

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

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

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

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

 
  public static final AssignmentStatement sample2() {
      Query query = new Query();
      query.setSelect(new Select(Arrays.asList(new ElementSymbol("x")))); //$NON-NLS-1$
      query.setFrom(new From(Arrays.asList(new UnaryFromClause(new GroupSymbol("y"))))); //$NON-NLS-1$
      return new AssignmentStatement(new ElementSymbol("b"), query); //$NON-NLS-1$
  }
View Full Code Here

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

  }
 
  // ################################## ACTUAL TESTS ################################ 
 
  public void testGetVariable() {
    AssignmentStatement s1 = sample1();
    assertEquals("Didn't get the same parts ", s1.getVariable(), new ElementSymbol("a"));     //$NON-NLS-1$ //$NON-NLS-2$
  }
View Full Code Here

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

    AssignmentStatement s1 = sample1();
    assertEquals("Didn't get the same parts ", s1.getVariable(), new ElementSymbol("a"));     //$NON-NLS-1$ //$NON-NLS-2$
  }
 
  public void testGetExpression() {
    AssignmentStatement s1 = sample1();
    assertEquals("Didn't get the same parts ", s1.getExpression(), new Constant("1")); //$NON-NLS-1$ //$NON-NLS-2$
  }
View Full Code Here

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

    AssignmentStatement s1 = sample1();
    assertEquals("Didn't get the same parts ", s1.getExpression(), new Constant("1")); //$NON-NLS-1$ //$NON-NLS-2$
  }
 
  public void testGetCommand() throws Exception {
    AssignmentStatement s2 = sample2();
    Query query = (Query) QueryParser.getQueryParser().parseCommand("Select x from y"); //$NON-NLS-1$
    assertEquals("Didn't get the same parts ", ((ScalarSubquery)s2.getExpression()).getCommand(), query); //$NON-NLS-1$
  }
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.