use of org.teiid.query.sql.proc.Block in project teiid by teiid.
the class TestSQLStringVisitor method testBlock1.
@Test
public void testBlock1() {
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);
// $NON-NLS-1$
helpTest(b, "BEGIN\nDELETE FROM g;\na = 1;\nRAISE 'My Error';\nEND");
}
use of org.teiid.query.sql.proc.Block in project teiid by teiid.
the class TestSQLStringVisitor method testCreateUpdateProcedure1.
@Test
public void testCreateUpdateProcedure1() {
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");
}
use of org.teiid.query.sql.proc.Block in project teiid by teiid.
the class TestSQLStringVisitor method testCreateUpdateProcedure3.
@Test
public void testCreateUpdateProcedure3() {
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");
}
use of org.teiid.query.sql.proc.Block in project teiid by teiid.
the class TestIfStatement method sample2.
public static final IfStatement sample2() {
Block ifBlock = TestBlock.sample2();
Block elseBlock = TestBlock.sample1();
Criteria criteria = TestSetCriteria.sample2();
return new IfStatement(criteria, ifBlock, elseBlock);
}
use of org.teiid.query.sql.proc.Block in project teiid by teiid.
the class TestIfStatement method sample1.
// ################################## TEST HELPERS ################################
public static final IfStatement sample1() {
Block ifBlock = TestBlock.sample1();
Block elseBlock = TestBlock.sample2();
Criteria criteria = TestSetCriteria.sample1();
return new IfStatement(criteria, ifBlock, elseBlock);
}
Aggregations