Search in sources :

Example 11 with AssignmentStatement

use of org.teiid.query.sql.proc.AssignmentStatement in project teiid by teiid.

the class TestAssignmentStatement method sample2.

public static final AssignmentStatement sample2() {
    Query query = new Query();
    // $NON-NLS-1$
    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);
}
Also used : ElementSymbol(org.teiid.query.sql.symbol.ElementSymbol) Query(org.teiid.query.sql.lang.Query) UnaryFromClause(org.teiid.query.sql.lang.UnaryFromClause) AssignmentStatement(org.teiid.query.sql.proc.AssignmentStatement) Select(org.teiid.query.sql.lang.Select) GroupSymbol(org.teiid.query.sql.symbol.GroupSymbol) From(org.teiid.query.sql.lang.From)

Example 12 with AssignmentStatement

use of org.teiid.query.sql.proc.AssignmentStatement in project teiid by teiid.

the class TestAssignmentStatement method testSelfEquivalence.

public void testSelfEquivalence() {
    AssignmentStatement s1 = sample1();
    int equals = 0;
    UnitTestUtil.helpTestEquivalence(equals, s1, s1);
}
Also used : AssignmentStatement(org.teiid.query.sql.proc.AssignmentStatement)

Example 13 with AssignmentStatement

use of org.teiid.query.sql.proc.AssignmentStatement in project teiid by teiid.

the class TestAssignmentStatement method testGetVariable.

// ################################## ACTUAL TESTS ################################
public void testGetVariable() {
    AssignmentStatement s1 = sample1();
    // $NON-NLS-1$ //$NON-NLS-2$
    assertEquals("Didn't get the same parts ", s1.getVariable(), new ElementSymbol("a"));
}
Also used : ElementSymbol(org.teiid.query.sql.symbol.ElementSymbol) AssignmentStatement(org.teiid.query.sql.proc.AssignmentStatement)

Example 14 with AssignmentStatement

use of org.teiid.query.sql.proc.AssignmentStatement in project teiid by teiid.

the class TestAssignmentStatement method testGetCommand.

public void testGetCommand() throws Exception {
    AssignmentStatement s2 = sample2();
    // $NON-NLS-1$
    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);
}
Also used : Query(org.teiid.query.sql.lang.Query) AssignmentStatement(org.teiid.query.sql.proc.AssignmentStatement)

Aggregations

AssignmentStatement (org.teiid.query.sql.proc.AssignmentStatement)14 Test (org.junit.Test)7 Block (org.teiid.query.sql.proc.Block)5 CommandStatement (org.teiid.query.sql.proc.CommandStatement)4 RaiseStatement (org.teiid.query.sql.proc.RaiseStatement)4 CreateProcedureCommand (org.teiid.query.sql.proc.CreateProcedureCommand)3 ElementSymbol (org.teiid.query.sql.symbol.ElementSymbol)3 Query (org.teiid.query.sql.lang.Query)2 From (org.teiid.query.sql.lang.From)1 Select (org.teiid.query.sql.lang.Select)1 UnaryFromClause (org.teiid.query.sql.lang.UnaryFromClause)1 LoopStatement (org.teiid.query.sql.proc.LoopStatement)1 TriggerAction (org.teiid.query.sql.proc.TriggerAction)1 Constant (org.teiid.query.sql.symbol.Constant)1 GroupSymbol (org.teiid.query.sql.symbol.GroupSymbol)1