Search in sources :

Example 6 with RaiseStatement

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

the class TestSQLStringVisitor method testRaiseErrorStatement.

@Test
public void testRaiseErrorStatement() {
    // $NON-NLS-1$
    RaiseStatement errStmt = new RaiseStatement(new Constant("My Error"));
    // $NON-NLS-1$
    helpTest(errStmt, "RAISE 'My Error';");
}
Also used : RaiseStatement(org.teiid.query.sql.proc.RaiseStatement) Test(org.junit.Test)

Example 7 with RaiseStatement

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

the class TestSQLStringVisitor method testCreateUpdateProcedure2.

@Test
public void testCreateUpdateProcedure2() {
    Delete d1 = new Delete();
    // $NON-NLS-1$
    d1.setGroup(new GroupSymbol("g"));
    CommandStatement cmdStmt = new CommandStatement(d1);
    // $NON-NLS-1$
    AssignmentStatement assigStmt = new AssignmentStatement(new ElementSymbol("a"), new Constant(new Integer(1)));
    // $NON-NLS-1$
    RaiseStatement errStmt = new RaiseStatement(new Constant("My Error"));
    Block b = new Block();
    b.addStatement(cmdStmt);
    b.addStatement(assigStmt);
    b.addStatement(errStmt);
    CreateProcedureCommand cup = new CreateProcedureCommand(b);
    // $NON-NLS-1$
    helpTest(cup, "BEGIN\nDELETE FROM g;\na = 1;\nRAISE 'My Error';\nEND");
}
Also used : CommandStatement(org.teiid.query.sql.proc.CommandStatement) CreateProcedureCommand(org.teiid.query.sql.proc.CreateProcedureCommand) AssignmentStatement(org.teiid.query.sql.proc.AssignmentStatement) Block(org.teiid.query.sql.proc.Block) RaiseStatement(org.teiid.query.sql.proc.RaiseStatement) Test(org.junit.Test)

Example 8 with RaiseStatement

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

the class TestRaiseErrorStatement method testEquivalence.

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

Example 9 with RaiseStatement

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

the class TestRaiseErrorStatement method testNonEquivalence.

public void testNonEquivalence() {
    RaiseStatement s1 = sample1();
    RaiseStatement s2 = sample2();
    int equals = -1;
    UnitTestUtil.helpTestEquivalence(equals, s1, s2);
}
Also used : RaiseStatement(org.teiid.query.sql.proc.RaiseStatement)

Aggregations

RaiseStatement (org.teiid.query.sql.proc.RaiseStatement)9 Test (org.junit.Test)6 AssignmentStatement (org.teiid.query.sql.proc.AssignmentStatement)4 Block (org.teiid.query.sql.proc.Block)4 CommandStatement (org.teiid.query.sql.proc.CommandStatement)4 CreateProcedureCommand (org.teiid.query.sql.proc.CreateProcedureCommand)3