use of org.teiid.query.processor.HardcodedDataManager in project teiid by teiid.
the class TestCallableStatement method testInputExpression.
@Test
public void testInputExpression() throws Exception {
// $NON-NLS-1$
String sql = "{call pm2.spTest8(1, ?)}";
List[] expected = new List[1];
expected[0] = Arrays.asList(null, null, 0);
HardcodedDataManager dataManager = new HardcodedDataManager();
dataManager.addData("EXEC pm2.spTest8(1)", expected);
helpProcess(sql, null, expected, dataManager);
}
use of org.teiid.query.processor.HardcodedDataManager in project teiid by teiid.
the class TestCallableStatement method testMissingInput.
@Test
public void testMissingInput() throws Exception {
// $NON-NLS-1$
String sql = "{? = call pm4.spTest9()}";
try {
TestPreparedStatement.helpTestProcessing(sql, Collections.EMPTY_LIST, null, new HardcodedDataManager(), RealMetadataFactory.exampleBQTCached(), true, RealMetadataFactory.exampleBQTVDB());
fail();
} catch (QueryResolverException e) {
// $NON-NLS-1$
assertEquals("TEIID30089 Required parameter 'pm4.spTest9.inkey' has no value was set or is an invalid parameter.", e.getMessage());
}
}
use of org.teiid.query.processor.HardcodedDataManager in project teiid by teiid.
the class TestCallableStatement method testOutParameter.
@Test
public void testOutParameter() throws Exception {
// $NON-NLS-1$
String sql = "{call pm2.spTest8(?, ?)}";
List values = new ArrayList();
values.add(2);
List[] expected = new List[1];
expected[0] = Arrays.asList(null, null, 1);
HardcodedDataManager dataManager = new HardcodedDataManager();
dataManager.addData("EXEC pm2.spTest8(2)", expected);
helpProcess(sql, values, expected, dataManager);
}
use of org.teiid.query.processor.HardcodedDataManager in project teiid by teiid.
the class TestCallableStatement method testReturnParameter.
@Test
public void testReturnParameter() throws Exception {
// $NON-NLS-1$
String sql = "{? = call pm4.spTest9(inkey=>?)}";
List values = new ArrayList();
values.add(1);
List[] expected = new List[1];
expected[0] = Arrays.asList(1);
HardcodedDataManager dataManager = new HardcodedDataManager();
dataManager.addData("? = EXEC pm4.spTest9(1)", expected);
helpProcess(sql, values, expected, dataManager);
}
use of org.teiid.query.processor.HardcodedDataManager in project teiid by teiid.
the class TestOptimizer method testScalarSubQueryInSelect.
/**
* Try substituting "is not null" for "exists" criteria
*/
@Test
public void testScalarSubQueryInSelect() throws TeiidComponentException, TeiidProcessingException {
// $NON-NLS-1$
String sql = "select intkey, case when (select stringkey from bqt1.smallb) is not null then 'nuge' end as a from vqt.smalla";
ProcessorPlan plan = helpPlan(sql, RealMetadataFactory.exampleBQTCached(), new String[] { "SELECT g_0.IntKey, CASE WHEN (SELECT g_0.StringKey FROM BQT1.SmallB AS g_0) IS NOT NULL THEN 'nuge' END FROM BQT1.SmallA AS g_0" }, // $NON-NLS-1$
ComparisonMode.EXACT_COMMAND_STRING);
checkNodeTypes(plan, new int[] { // Access
1, // DependentAccess
0, // DependentSelect
0, // DependentProject
0, // DupRemove
0, // Grouping
0, // Join
0, // MergeJoin
0, // Null
0, // PlanExecution
0, // Project
0, // Select
0, // Sort
0, // UnionAll
0 });
HardcodedDataManager hdm = new HardcodedDataManager();
hdm.addData("SELECT g_0.StringKey FROM BQT1.SmallB AS g_0", Arrays.asList("a"));
hdm.addData("SELECT g_0.IntKey FROM BQT1.SmallA AS g_0", Arrays.asList(1));
TestProcessor.helpProcess(plan, hdm, new List[] { Arrays.asList(1, "nuge") });
}
Aggregations