use of org.teiid.query.optimizer.FakeFunctionMetadataSource in project teiid by teiid.
the class RealMetadataFactory method example1Store.
public static MetadataStore example1Store() {
MetadataStore metadataStore = new MetadataStore();
// Create models
// $NON-NLS-1$
Schema pm1 = createPhysicalModel("pm1", metadataStore);
pm1.addFunction(new FakeFunctionMetadataSource().getFunctionMethods().iterator().next());
// $NON-NLS-1$
Schema pm2 = createPhysicalModel("pm2", metadataStore);
// allows push of SELECT DISTINCT //$NON-NLS-1$
Schema pm3 = createPhysicalModel("pm3", metadataStore);
// all groups w/ access pattern(s) //$NON-NLS-1$
Schema pm4 = createPhysicalModel("pm4", metadataStore);
// all groups w/ access pattern(s); model supports join //$NON-NLS-1$
Schema pm5 = createPhysicalModel("pm5", metadataStore);
// model does not support where all //$NON-NLS-1$
Schema pm6 = createPhysicalModel("pm6", metadataStore);
// $NON-NLS-1$
Schema vm1 = createVirtualModel("vm1", metadataStore);
// $NON-NLS-1$
Schema vm2 = createVirtualModel("vm2", metadataStore);
// $NON-NLS-1$
Schema xmltest = createVirtualModel("xmltest", metadataStore);
// Create physical groups
// $NON-NLS-1$
Table pm1g1 = createPhysicalGroup("g1", pm1);
// $NON-NLS-1$
Table pm1g2 = createPhysicalGroup("g2", pm1);
// $NON-NLS-1$
Table pm1g3 = createPhysicalGroup("g3", pm1);
// $NON-NLS-1$
Table pm1g4 = createPhysicalGroup("g4", pm1);
// $NON-NLS-1$
Table pm1g5 = createPhysicalGroup("g5", pm1);
// $NON-NLS-1$
Table pm1g6 = createPhysicalGroup("g6", pm1);
// $NON-NLS-1$
Table pm1table = createPhysicalGroup("table1", pm1);
// $NON-NLS-1$
Table pm2g1 = createPhysicalGroup("g1", pm2);
// $NON-NLS-1$
Table pm2g2 = createPhysicalGroup("g2", pm2);
// $NON-NLS-1$
Table pm2g3 = createPhysicalGroup("g3", pm2);
// $NON-NLS-1$
Table pm3g1 = createPhysicalGroup("g1", pm3);
// $NON-NLS-1$
Table pm3g2 = createPhysicalGroup("g2", pm3);
// $NON-NLS-1$
Table pm4g1 = createPhysicalGroup("g1", pm4);
// $NON-NLS-1$
Table pm4g2 = createPhysicalGroup("g2", pm4);
// $NON-NLS-1$
Table pm5g1 = createPhysicalGroup("g1", pm5);
// $NON-NLS-1$
Table pm5g2 = createPhysicalGroup("g2", pm5);
// $NON-NLS-1$
Table pm5g3 = createPhysicalGroup("g3", pm5);
// $NON-NLS-1$
Table pm6g1 = createPhysicalGroup("g1", pm6);
// Create physical elements
createElements(pm1g1, // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] { "e1", "e2", "e3", "e4" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
createElements(pm1g2, // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] { "e1", "e2", "e3", "e4" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
createElements(pm1g3, // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] { "e1", "e2", "e3", "e4" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
List<Column> pm1g4e = createElements(pm1g4, // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] { "e1", "e2", "e3", "e4" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
pm1g4e.get(1).setSelectable(false);
pm1g4e.get(3).setSelectable(false);
List<Column> pm1g5e = createElements(pm1g5, // $NON-NLS-1$
new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING });
pm1g5e.get(0).setSelectable(false);
createElements(pm1g6, // $NON-NLS-1$ //$NON-NLS-2$
new String[] { "in", "in3" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
createElements(pm1table, // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] { "e1", "e2", "e3", "e4" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
createElements(pm2g1, // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] { "e1", "e2", "e3", "e4" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
createElements(pm2g2, // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] { "e1", "e2", "e3", "e4" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
createElements(pm2g3, // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] { "e1", "e2", "e3", "e4" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
createElements(pm3g1, // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] { "e1", "e2", "e3", "e4" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.DATE, DataTypeManager.DefaultDataTypes.TIME, DataTypeManager.DefaultDataTypes.TIMESTAMP });
createElements(pm3g2, // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] { "e1", "e2", "e3", "e4" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.DATE, DataTypeManager.DefaultDataTypes.TIME, DataTypeManager.DefaultDataTypes.TIMESTAMP });
List<Column> pm4g1e = createElements(pm4g1, // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] { "e1", "e2", "e3", "e4" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
List<Column> pm4g2e = createElements(pm4g2, // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
new String[] { "e1", "e2", "e3", "e4", "e5", "e6" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
List<Column> pm5g1e = createElements(pm5g1, // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] { "e1", "e2", "e3", "e4" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
List<Column> pm5g2e = createElements(pm5g2, // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
new String[] { "e1", "e2", "e3", "e4", "e5", "e6" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
createElements(pm5g3, // $NON-NLS-1$ //$NON-NLS-2$
new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.SHORT });
createElements(pm6g1, // $NON-NLS-1$ //$NON-NLS-2$
new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
// Create access patterns - pm4
List<Column> elements = new ArrayList<Column>(1);
elements.add(pm4g1e.iterator().next());
// e1 //$NON-NLS-1$
createAccessPattern("pm4.g1.ap1", pm4g1, elements);
elements = new ArrayList<Column>(2);
Iterator<Column> iter = pm4g2e.iterator();
elements.add(iter.next());
elements.add(iter.next());
// e1,e2 //$NON-NLS-1$
createAccessPattern("pm4.g2.ap1", pm4g2, elements);
elements = new ArrayList<Column>(1);
// "e5"
elements.add(pm4g2e.get(4));
// e5 //$NON-NLS-1$
createAccessPattern("pm4.g2.ap2", pm4g2, elements);
// Create access patterns - pm5
elements = new ArrayList<Column>(1);
elements.add(pm5g1e.iterator().next());
// e1 //$NON-NLS-1$
createAccessPattern("pm5.g1.ap1", pm5g1, elements);
elements = new ArrayList<Column>(2);
iter = pm5g2e.iterator();
elements.add(iter.next());
elements.add(iter.next());
// e1,e2 //$NON-NLS-1$
createAccessPattern("pm5.g2.ap1", pm5g2, elements);
elements = new ArrayList<Column>(1);
// "e5"
elements.add(pm5g2e.get(4));
// e5 //$NON-NLS-1$
createAccessPattern("pm5.g2.ap2", pm5g2, elements);
// Create temp groups
// $NON-NLS-1$
Table tm1g1 = createXmlStagingTable("doc4.tm1.g1", xmltest, new QueryNode("select null, null, null, null, null"));
// Create temp elements - the element "node1" is purposely named to be ambiguous with a document node named "node1"
createElements(tm1g1, // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
new String[] { "e1", "e2", "e3", "e4", "node1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE, DataTypeManager.DefaultDataTypes.STRING });
// Create virtual groups
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vm1g1n1 = new QueryNode("SELECT * FROM pm1.g1");
// $NON-NLS-1$
Table vm1g1 = createUpdatableVirtualGroup("g1", vm1, vm1g1n1);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vm2g1n1 = new QueryNode("SELECT pm1.g1.* FROM pm1.g1, pm1.g2 where pm1.g1.e2 = pm1.g2.e2");
// $NON-NLS-1$
Table vm2g1 = createUpdatableVirtualGroup("g1", vm2, vm2g1n1);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vm1g1n1_defect10711 = new QueryNode("SELECT * FROM vm1.g1 as X");
// $NON-NLS-1$
Table vm1g1_defect10711 = createVirtualGroup("g1a", vm1, vm1g1n1_defect10711);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vm1g1n1_defect12081 = new QueryNode("SELECT e1, upper(e1) as e1Upper FROM pm1.g1");
// $NON-NLS-1$
Table vm1g1_defect12081 = createVirtualGroup("g1b", vm1, vm1g1n1_defect12081);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vm1g1n1c = new QueryNode("SELECT PARSETIMESTAMP(pm1.g1.e1, 'MMM dd yyyy hh:mm:ss') as e5, e2, e3, e4 FROM pm1.g1");
// $NON-NLS-1$
Table vm1g1c = createVirtualGroup("g1c", vm1, vm1g1n1c);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vm1g2an1 = new QueryNode("SELECT * FROM pm1.g2");
// $NON-NLS-1$
Table vm1g2a = createVirtualGroup("g2a", vm1, vm1g2an1);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vm1g2n1 = new QueryNode("SELECT pm1.g1.e1, pm1.g1.e2, pm1.g2.e3, pm1.g2.e4 FROM pm1.g1, pm1.g2 WHERE pm1.g1.e1=pm1.g2.e1");
// $NON-NLS-1$
Table vm1g2 = createVirtualGroup("g2", vm1, vm1g2n1);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vm1g4n1 = new QueryNode("SELECT e1 FROM pm1.g1 UNION ALL SELECT convert(e2, string) as x FROM pm1.g2 ORDER BY e1");
// $NON-NLS-1$
Table vm1g4 = createVirtualGroup("g4", vm1, vm1g4n1);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vm1g5n1 = new QueryNode("SELECT concat(e1, 'val'), e2 FROM pm1.g1");
// $NON-NLS-1$
Table vm1g5 = createVirtualGroup("g5", vm1, vm1g5n1);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vm1g6n1 = new QueryNode("SELECT concat(e1, 'val') AS e, e2 FROM pm1.g1");
// $NON-NLS-1$
Table vm1g6 = createVirtualGroup("g6", vm1, vm1g6n1);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vm1g7n1 = new QueryNode("SELECT concat(e1, e2) AS e, e2 FROM pm1.g1");
// $NON-NLS-1$
Table vm1g7 = createVirtualGroup("g7", vm1, vm1g7n1);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vm1g8n1 = new QueryNode("SELECT concat(e1, 'val') AS e, e2 FROM pm1.g1 ORDER BY e");
// $NON-NLS-1$
Table vm1g8 = createVirtualGroup("g8", vm1, vm1g8n1);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vm1g9n1 = new QueryNode("SELECT pm1.g1.e1, pm1.g1.e2 FROM pm1.g1, pm4.g1 WHERE pm1.g1.e1 = pm4.g1.e1");
// $NON-NLS-1$
Table vm1g9 = createVirtualGroup("g9", vm1, vm1g9n1);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vm1g10n1 = new QueryNode("SELECT pm1.g1.e1, pm1.g1.e2 FROM pm1.g1, pm4.g2 WHERE pm1.g1.e1 = pm4.g2.e1");
// $NON-NLS-1$
Table vm1g10 = createVirtualGroup("g10", vm1, vm1g10n1);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vm1g11n1 = new QueryNode("SELECT * FROM pm4.g2");
// $NON-NLS-1$
Table vm1g11 = createVirtualGroup("g11", vm1, vm1g11n1);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vm1g12n1 = new QueryNode("SELECT DISTINCT * FROM pm3.g1");
// $NON-NLS-1$
Table vm1g12 = createVirtualGroup("g12", vm1, vm1g12n1);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vm1g13n1 = new QueryNode("SELECT DISTINCT * FROM pm3.g1 ORDER BY e1");
// $NON-NLS-1$
Table vm1g13 = createVirtualGroup("g13", vm1, vm1g13n1);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vm1g14n1 = new QueryNode("SELECT * FROM pm3.g1 ORDER BY e1");
// $NON-NLS-1$
Table vm1g14 = createVirtualGroup("g14", vm1, vm1g14n1);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vm1g15n1 = new QueryNode("SELECT e1, concat(e1, convert(e2, string)) AS x FROM pm3.g1");
// $NON-NLS-1$
Table vm1g15 = createVirtualGroup("g15", vm1, vm1g15n1);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vm1g16n1 = new QueryNode("SELECT concat(e1, 'val') AS e, e2 FROM pm3.g1 ORDER BY e");
// $NON-NLS-1$
Table vm1g16 = createVirtualGroup("g16", vm1, vm1g16n1);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vm1g17n1 = new QueryNode("SELECT pm3.g1.e1, pm3.g1.e2 FROM pm3.g1 UNION ALL SELECT pm3.g2.e1, pm3.g2.e2 FROM pm3.g2 ORDER BY e2");
// $NON-NLS-1$
Table vm1g17 = createVirtualGroup("g17", vm1, vm1g17n1);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vm1g18n1 = new QueryNode("SELECT (e4 * cast(100.0 as double)) as x FROM pm1.g1");
// $NON-NLS-1$
Table vm1g18 = createVirtualGroup("g18", vm1, vm1g18n1);
// Transformations with subqueries and correlated subqueries
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vm1g19n1 = new QueryNode("Select * from vm1.g4 where not (e1 in (select e1 FROM vm1.g1 WHERE vm1.g4.e1 = e1))");
// $NON-NLS-1$
Table vm1g19 = createVirtualGroup("g19", vm1, vm1g19n1);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vm1g20n1 = new QueryNode("Select * from vm1.g1 where exists (select e1 FROM vm1.g2 WHERE vm1.g1.e1 = e1)");
// $NON-NLS-1$
Table vm1g20 = createVirtualGroup("g20", vm1, vm1g20n1);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vm1g21n1 = new QueryNode("Select * from pm1.g1 where exists (select e1 FROM pm2.g1 WHERE pm1.g1.e1 = e1)");
// $NON-NLS-1$
Table vm1g21 = createVirtualGroup("g21", vm1, vm1g21n1);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vm1g22n1 = new QueryNode("Select e1, e2, e3, e4, (select e4 FROM vm1.g21 WHERE vm1.g20.e4 = e4 and e4 = 7.0) as E5 from vm1.g20");
// $NON-NLS-1$
Table vm1g22 = createVirtualGroup("g22", vm1, vm1g22n1);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vm1g23n1 = new QueryNode("Select e1, e2, e3, e4, (select e4 FROM vm1.g21 WHERE vm1.g20.e4 = 7.0 and e4 = 7.0) as E5 from vm1.g20");
// $NON-NLS-1$
Table vm1g23 = createVirtualGroup("g23", vm1, vm1g23n1);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vm1g24n1 = new QueryNode("Select * from vm1.g20 where exists (select * FROM vm1.g21 WHERE vm1.g20.e4 = E4)");
// $NON-NLS-1$
Table vm1g24 = createVirtualGroup("g24", vm1, vm1g24n1);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vm1g25n1 = new QueryNode("Select e1, e2, e3, e4, (select e4 FROM pm1.g2 WHERE e1 = 'b') as E5 from pm1.g1");
// $NON-NLS-1$
Table vm1g25 = createVirtualGroup("g25", vm1, vm1g25n1);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vm1g26n1 = new QueryNode("Select e1, e2, e3, e4, (select e4 FROM pm1.g2 WHERE e4 = pm1.g1.e4 and e1 = 'b') as E5 from pm1.g1");
// $NON-NLS-1$
Table vm1g26 = createVirtualGroup("g26", vm1, vm1g26n1);
// defect 10976
// QueryNode vm1g27n1 = new QueryNode("vm1.g27", "SELECT DISTINCT x as a, lower(e1) as x FROM vm1.g28"); //$NON-NLS-1$ //$NON-NLS-2$
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vm1g27n1 = new QueryNode("SELECT upper(e1) as x, e1 FROM pm1.g1");
// $NON-NLS-1$
Table vm1g27 = createVirtualGroup("g27", vm1, vm1g27n1);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vm1g28n1 = new QueryNode("SELECT DISTINCT x as a, lower(e1) as x FROM vm1.g27");
// $NON-NLS-1$
Table vm1g28 = createVirtualGroup("g28", vm1, vm1g28n1);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vm1g29n1 = new QueryNode("SELECT DISTINCT x, lower(e1) FROM vm1.g27");
// $NON-NLS-1$
Table vm1g29 = createVirtualGroup("g29", vm1, vm1g29n1);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vm1g30n1 = new QueryNode("SELECT DISTINCT e1 as x, e1 as y FROM pm1.g1");
// $NON-NLS-1$
Table vm1g30 = createVirtualGroup("g30", vm1, vm1g30n1);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vm1g31n1 = new QueryNode("SELECT e1 as x, e1 as y FROM pm1.g1 ORDER BY x");
// $NON-NLS-1$
Table vm1g31 = createVirtualGroup("g31", vm1, vm1g31n1);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vm1g32n1 = new QueryNode("SELECT DISTINCT e1 as x, e1 as y FROM pm1.g1 ORDER BY x");
// $NON-NLS-1$
Table vm1g32 = createVirtualGroup("g32", vm1, vm1g32n1);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vm1g33n1 = new QueryNode("SELECT e2 FROM pm1.g1 WHERE 2 = e2");
// $NON-NLS-1$
Table vm1g33 = createVirtualGroup("g33", vm1, vm1g33n1);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vm1g34n1 = new QueryNode("SELECT e1 as e1_, e2 as e2_ FROM pm1.g1 UNION ALL SELECT e1 as e1_, e2 as e2_ FROM pm2.g1");
// $NON-NLS-1$
Table vm1g34 = createVirtualGroup("g34", vm1, vm1g34n1);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vm1g36n1 = new QueryNode("SELECT pm1.g1.e1 as ve1, pm1.g2.e1 as ve2 FROM pm1.g1 LEFT OUTER JOIN /* optional */ pm1.g2 on pm1.g1.e1 = pm1.g2.e1");
// $NON-NLS-1$
Table vm1g36 = createVirtualGroup("g36", vm1, vm1g36n1);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vm1g37n1 = new QueryNode("SELECT * from pm4.g1");
// $NON-NLS-1$
Table vm1g37 = createVirtualGroup("g37", vm1, vm1g37n1);
vm1g37.setSupportsUpdate(true);
vm1g37.setDeletePlan("for each row begin atomic end");
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vm1g38n1 = new QueryNode("SELECT a.e1, b.e2 from pm1.g1 as a, pm6.g1 as b where a.e1=b.e1");
// $NON-NLS-1$
Table vm1g38 = createVirtualGroup("g38", vm1, vm1g38n1);
// Create virtual groups
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vm1g39n1 = new QueryNode("SELECT * FROM pm1.g1");
// $NON-NLS-1$
Table vm1g39 = createUpdatableVirtualGroup("g39", vm1, vm1g39n1, null);
// Create virtual elements
createElements(vm1g39, // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] { "e1", "e2", "e3", "e4" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
createElements(vm1g1, // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] { "e1", "e2", "e3", "e4" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
createElements(vm2g1, // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] { "e1", "e2", "e3", "e4" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
createElements(vm1g1_defect10711, // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] { "e1", "e2", "e3", "e4" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
createElements(vm1g1_defect12081, // $NON-NLS-1$ //$NON-NLS-2$
new String[] { "e1", "e1Upper" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
createElements(vm1g1c, // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] { "e5", "e2", "e3", "e4" }, new String[] { DataTypeManager.DefaultDataTypes.TIMESTAMP, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
createElements(vm1g2a, // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] { "e1", "e2", "e3", "e4" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
createElements(vm1g2, // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] { "e1", "e2", "e3", "e4" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
createElements(vm1g4, // $NON-NLS-1$
new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING });
createElements(vm1g5, // $NON-NLS-1$ //$NON-NLS-2$
new String[] { "expr", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
createElements(vm1g6, // $NON-NLS-1$ //$NON-NLS-2$
new String[] { "e", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
createElements(vm1g7, // $NON-NLS-1$ //$NON-NLS-2$
new String[] { "e", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
createElements(vm1g8, // $NON-NLS-1$ //$NON-NLS-2$
new String[] { "e", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
createElements(vm1g9, // $NON-NLS-1$ //$NON-NLS-2$
new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
createElements(vm1g10, // $NON-NLS-1$ //$NON-NLS-2$
new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
createElements(vm1g11, // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
new String[] { "e1", "e2", "e3", "e4", "e5", "e6" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
createElements(vm1g12, // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] { "e1", "e2", "e3", "e4" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.DATE, DataTypeManager.DefaultDataTypes.TIME, DataTypeManager.DefaultDataTypes.TIMESTAMP });
createElements(vm1g13, // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] { "e1", "e2", "e3", "e4" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.DATE, DataTypeManager.DefaultDataTypes.TIME, DataTypeManager.DefaultDataTypes.TIMESTAMP });
createElements(vm1g14, // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] { "e1", "e2", "e3", "e4" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.DATE, DataTypeManager.DefaultDataTypes.TIME, DataTypeManager.DefaultDataTypes.TIMESTAMP });
createElements(vm1g15, // $NON-NLS-1$ //$NON-NLS-2$
new String[] { "e1", "x" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
createElements(vm1g16, // $NON-NLS-1$ //$NON-NLS-2$
new String[] { "e", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.DATE });
createElements(vm1g17, // $NON-NLS-1$ //$NON-NLS-2$
new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.DATE });
createElements(vm1g18, // $NON-NLS-1$
new String[] { "x" }, new String[] { DataTypeManager.DefaultDataTypes.DOUBLE });
createElements(vm1g19, // $NON-NLS-1$
new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING });
createElements(vm1g20, // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] { "e1", "e2", "e3", "e4" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
createElements(vm1g21, // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] { "e1", "e2", "e3", "e4" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
createElements(vm1g22, // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
new String[] { "e1", "e2", "e3", "e4", "e5" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE, DataTypeManager.DefaultDataTypes.DOUBLE });
createElements(vm1g23, // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
new String[] { "e1", "e2", "e3", "e4", "e5" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE, DataTypeManager.DefaultDataTypes.DOUBLE });
createElements(vm1g24, // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] { "e1", "e2", "e3", "e4" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
createElements(vm1g25, // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
new String[] { "e1", "e2", "e3", "e4", "e5" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE, DataTypeManager.DefaultDataTypes.DOUBLE });
createElements(vm1g26, // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
new String[] { "e1", "e2", "e3", "e4", "e5" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE, DataTypeManager.DefaultDataTypes.DOUBLE });
createElements(vm1g27, // $NON-NLS-1$ //$NON-NLS-2$
new String[] { "x", "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
createElements(vm1g28, // $NON-NLS-1$ //$NON-NLS-2$
new String[] { "a", "x" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
createElements(vm1g29, // $NON-NLS-1$ //$NON-NLS-2$
new String[] { "x", "expr" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
createElements(vm1g30, // $NON-NLS-1$ //$NON-NLS-2$
new String[] { "x", "y" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
createElements(vm1g31, // $NON-NLS-1$ //$NON-NLS-2$
new String[] { "x", "y" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
createElements(vm1g32, // $NON-NLS-1$ //$NON-NLS-2$
new String[] { "x", "y" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
createElements(vm1g33, // $NON-NLS-1$
new String[] { "e2" }, new String[] { DataTypeManager.DefaultDataTypes.INTEGER });
createElements(vm1g34, // $NON-NLS-1$ //$NON-NLS-2$
new String[] { "e1_", "e2_" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
createElements(vm1g36, // $NON-NLS-1$ //$NON-NLS-2$
new String[] { "ve1", "ve2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
List<Column> vm1g37e = createElements(vm1g37, // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
new String[] { "e1", "e2", "e3", "e4" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
createElements(vm1g38, // $NON-NLS-1$ //$NON-NLS-2$
new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
// Create access patterns on vm1.g37
elements = new ArrayList<Column>(1);
elements.add(vm1g37e.iterator().next());
// e1 //$NON-NLS-1$
createAccessPattern("vm1.g37.ap1", vm1g37, elements);
// Create mapping classes for xmltest.doc5
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode mc1n1 = new QueryNode("SELECT e1 FROM pm1.g1 UNION ALL SELECT e1 FROM pm1.g2");
// $NON-NLS-1$
Table vm1mc1 = createVirtualGroup("mc1", xmltest, mc1n1);
createElements(vm1mc1, // $NON-NLS-1$
new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING });
// XML STUFF =============================================
// Procedures and stored queries
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
ColumnSet<Procedure> rs1 = createResultSet("pm1.rs1", new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode sq1n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1, e2 FROM pm1.g1; END");
// $NON-NLS-1$
Procedure sq1 = createVirtualProcedure("sq1", pm1, null, sq1n1);
sq1.setResultSet(rs1);
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
ColumnSet<Procedure> rs2 = createResultSet("ret", new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
// $NON-NLS-1$
ProcedureParameter rs2p2 = createParameter("in", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode sq2n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1, e2 FROM pm1.g1 WHERE e1=pm1.sq2.in; END");
// $NON-NLS-1$
Procedure sq2 = createVirtualProcedure("sq2", pm1, Arrays.asList(rs2p2), sq2n1);
sq2.setResultSet(rs2);
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
ColumnSet<Procedure> rs5 = createResultSet("pm1.r5", new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
// $NON-NLS-1$
ProcedureParameter rs5p2 = createParameter("in", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING);
// $NON-NLS-1$
ProcedureParameter rs5p3 = createParameter("in2", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode sq3n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1, e2 FROM pm1.g1 WHERE e1=pm1.sq3.in UNION ALL SELECT e1, e2 FROM pm1.g1 WHERE e2=pm1.sq3.in2; END");
// $NON-NLS-1$
Procedure sq3 = createVirtualProcedure("sq3", pm1, Arrays.asList(rs5p2, rs5p3), sq3n1);
sq3.setResultSet(rs5);
// For defect 8211 - this stored query has two input params, no return param, and
// the input params are PURPOSELY numbered with indices "1" and "3" - see defect 8211
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
ColumnSet<Procedure> rs5a = createResultSet("pm1.r5a", new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
// $NON-NLS-1$
ProcedureParameter rs5p1a = createParameter("in", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING);
// $NON-NLS-1$
ProcedureParameter rs5p2a = createParameter("in2", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode sq3n1a = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1, e2 FROM pm1.g1 WHERE e1=pm1.sq3a.in UNION ALL SELECT e1, e2 FROM pm1.g1 WHERE e2=pm1.sq3a.in2; END");
// $NON-NLS-1$
Procedure sq3a = createVirtualProcedure("sq3a", pm1, Arrays.asList(rs5p1a, rs5p2a), sq3n1a);
sq3a.setResultSet(rs5a);
// Case 3281 - create procedures with optional parameter(s)
// make "in2" parameter optional, make "in3" required but with a default value
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
ColumnSet<Procedure> rs5b = createResultSet("pm1.r5b", new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
// $NON-NLS-1$
ProcedureParameter rs5p2b = createParameter("in", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING);
// $NON-NLS-1$
ProcedureParameter rs5p3b = createParameter("in2", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER);
// $NON-NLS-1$
ProcedureParameter rs5p4b = createParameter("in3", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING);
rs5p3b.setNullType(NullType.Nullable);
// $NON-NLS-1$
rs5p4b.setDefaultValue("YYZ");
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode sq3n1b = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1, e2 FROM pm1.g1 WHERE e1=pm1.sq3b.in UNION ALL SELECT e1, e2 FROM pm1.g1 WHERE e2=pm1.sq3b.in2; END");
// $NON-NLS-1$
Procedure sq3b = createVirtualProcedure("sq3b", pm1, Arrays.asList(rs5p2b, rs5p3b, rs5p4b), sq3n1b);
sq3b.setResultSet(rs5b);
// Make parameters of all different types, all with appropriate default values
// Make some parameters required, some optional
// Also, fully-qualify the param names
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
ColumnSet<Procedure> rsDefaults = createResultSet("pm1.rDefaults", new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
// $NON-NLS-1$
ProcedureParameter rsDefaultsParameterString = createParameter("inString", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING);
// rsDefaultsParameterString.setNullType(NullType.Nullable);
// $NON-NLS-1$
rsDefaultsParameterString.setDefaultValue(new String("x"));
// $NON-NLS-1$
ProcedureParameter rsParameterBigDecimal = createParameter("inBigDecimal", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.BIG_DECIMAL);
rsParameterBigDecimal.setNullType(NullType.Nullable);
// $NON-NLS-1$
rsParameterBigDecimal.setDefaultValue(new String("13.0"));
// $NON-NLS-1$
ProcedureParameter rsParameterBigInteger = createParameter("inBigInteger", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.BIG_INTEGER);
rsParameterBigInteger.setNullType(NullType.Nullable);
// $NON-NLS-1$
rsParameterBigInteger.setDefaultValue(new String("13"));
// $NON-NLS-1$
ProcedureParameter rsParameterBoolean = createParameter("inBoolean", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.BOOLEAN);
rsParameterBoolean.setNullType(NullType.Nullable);
// $NON-NLS-1$
rsParameterBoolean.setDefaultValue(new String("True"));
// $NON-NLS-1$
ProcedureParameter rsParameterByte = createParameter("inByte", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.BYTE);
rsParameterByte.setNullType(NullType.Nullable);
// $NON-NLS-1$
rsParameterByte.setDefaultValue(new String("1"));
// $NON-NLS-1$
ProcedureParameter rsParameterChar = createParameter("inChar", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.CHAR);
rsParameterChar.setNullType(NullType.Nullable);
// $NON-NLS-1$
rsParameterChar.setDefaultValue(new String("q"));
// $NON-NLS-1$
ProcedureParameter rsParameterDate = createParameter("inDate", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.DATE);
rsParameterDate.setNullType(NullType.Nullable);
// $NON-NLS-1$
rsParameterDate.setDefaultValue(new String("2003-03-20"));
// $NON-NLS-1$
ProcedureParameter rsParameterDouble = createParameter("inDouble", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.DOUBLE);
rsParameterDouble.setNullType(NullType.Nullable);
// $NON-NLS-1$
rsParameterDouble.setDefaultValue(new String("13.0"));
// $NON-NLS-1$
ProcedureParameter rsParameterFloat = createParameter("inFloat", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.FLOAT);
rsParameterFloat.setNullType(NullType.Nullable);
// $NON-NLS-1$
rsParameterFloat.setDefaultValue(new String("13"));
// $NON-NLS-1$
ProcedureParameter rsParameterInteger = createParameter("inInteger", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER);
rsParameterInteger.setNullType(NullType.Nullable);
// $NON-NLS-1$
rsParameterInteger.setDefaultValue(new String("13"));
// $NON-NLS-1$
ProcedureParameter rsParameterLong = createParameter("inLong", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.LONG);
rsParameterLong.setNullType(NullType.Nullable);
// $NON-NLS-1$
rsParameterLong.setDefaultValue(new String("13"));
// $NON-NLS-1$
ProcedureParameter rsParameterShort = createParameter("inShort", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.SHORT);
rsParameterShort.setNullType(NullType.Nullable);
// $NON-NLS-1$
rsParameterShort.setDefaultValue(new String("13"));
// $NON-NLS-1$
ProcedureParameter rsParameterTimestamp = createParameter("inTimestamp", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.TIMESTAMP);
rsParameterTimestamp.setNullType(NullType.Nullable);
// $NON-NLS-1$
rsParameterTimestamp.setDefaultValue(new String("2003-03-20 21:26:00.000000"));
// $NON-NLS-1$
ProcedureParameter rsParameterTime = createParameter("inTime", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.TIME);
rsParameterTime.setNullType(NullType.Nullable);
// $NON-NLS-1$
rsParameterTime.setDefaultValue(new String("21:26:00"));
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode sqDefaultsNode = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1, e2 FROM pm1.g1 WHERE e1=pm1.sqDefaults.inString UNION ALL SELECT e1, e2 FROM pm1.g1 WHERE e2=pm1.sqDefaults.inInteger; END");
Procedure sqDefaults = createVirtualProcedure(// $NON-NLS-1$
"sqDefaults", // $NON-NLS-1$
pm1, Arrays.asList(rsDefaultsParameterString, rsParameterBigDecimal, rsParameterBigInteger, rsParameterBoolean, rsParameterByte, rsParameterChar, rsParameterDate, rsParameterDouble, rsParameterFloat, rsParameterInteger, rsParameterLong, rsParameterShort, rsParameterTimestamp, rsParameterTime), sqDefaultsNode);
sqDefaults.setResultSet(rsDefaults);
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
createResultSet("pm1.rBadDefault", new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
// $NON-NLS-1$
ProcedureParameter paramBadDefaultIn = createParameter("in", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER);
paramBadDefaultIn.setNullType(NullType.Nullable);
// $NON-NLS-1$
paramBadDefaultIn.setDefaultValue("Clearly Not An Integer");
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode sqnBadDefault = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1, e2 FROM pm1.g1 WHERE e2=pm1.sqBadDefault.in; END");
// $NON-NLS-1$
createVirtualProcedure("sqBadDefault", pm1, Arrays.asList(paramBadDefaultIn), sqnBadDefault);
// end case 3281
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
ColumnSet<Procedure> nativeProcResults = createResultSet("pm1.nativers", new String[] { "tuple" }, new String[] { DataTypeManager.DefaultDataTypes.OBJECT });
// $NON-NLS-1$
ProcedureParameter nativeparam = createParameter("param", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING);
// $NON-NLS-1$
ProcedureParameter vardic = createParameter("varag", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.OBJECT);
vardic.setVarArg(true);
// $NON-NLS-1$ //$NON-NLS-2$
Procedure nativeProc = createStoredProcedure("native", pm1, Arrays.asList(nativeparam, vardic));
nativeProc.setResultSet(nativeProcResults);
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
ColumnSet<Procedure> rs3 = createResultSet("pm1.rs3", new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
// $NON-NLS-1$ //$NON-NLS-2$
Procedure sp1 = createStoredProcedure("sp1", pm1, null);
sp1.setResultSet(rs3);
// $NON-NLS-1$ //$NON-NLS-2$
ColumnSet<Procedure> rs4 = createResultSet("pm1.rs4", new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING });
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode sqsp1n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1 FROM (EXEC pm1.sp1()) as x; END");
// $NON-NLS-1$
Procedure sqsp1 = createVirtualProcedure("sqsp1", pm1, null, sqsp1n1);
sqsp1.setResultSet(rs4);
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
ColumnSet<Procedure> rs6 = createResultSet("pm1.rs6", new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode sq4n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN EXEC pm1.sq1(); END");
// $NON-NLS-1$
Procedure sq4 = createVirtualProcedure("sq4", pm1, null, sq4n1);
sq4.setResultSet(rs6);
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
ColumnSet<Procedure> rs7 = createResultSet("pm1.rs7", new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
// $NON-NLS-1$
ProcedureParameter rs7p2 = createParameter("in1", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode sq5n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN EXEC pm1.sq2(pm1.sq5.in1); END");
// $NON-NLS-1$
Procedure sq5 = createVirtualProcedure("sq5", pm1, Arrays.asList(rs7p2), sq5n1);
sq5.setResultSet(rs7);
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
ColumnSet<Procedure> rs8 = createResultSet("pm1.rs8", new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode sq6n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN EXEC pm1.sq2(\'1\'); END");
// $NON-NLS-1$
Procedure sq6 = createVirtualProcedure("sq6", pm1, null, sq6n1);
sq6.setResultSet(rs8);
// $NON-NLS-1$ //$NON-NLS-2$
ColumnSet<Procedure> rs9 = createResultSet("pm1.rs9", new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING });
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode sq7n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1 FROM (EXEC pm1.sq1()) as x; END");
// $NON-NLS-1$
Procedure sq7 = createVirtualProcedure("sq7", pm1, null, sq7n1);
sq7.setResultSet(rs9);
// $NON-NLS-1$ //$NON-NLS-2$
ColumnSet<Procedure> rs10 = createResultSet("pm1.rs10", new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING });
// $NON-NLS-1$
ProcedureParameter rs10p2 = createParameter("in", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode sq8n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1 FROM (EXEC pm1.sq1()) as x WHERE x.e1=pm1.sq8.in; END");
// $NON-NLS-1$
Procedure sq8 = createVirtualProcedure("sq8", pm1, Arrays.asList(rs10p2), sq8n1);
sq8.setResultSet(rs10);
// $NON-NLS-1$ //$NON-NLS-2$
ColumnSet<Procedure> rs11 = createResultSet("pm1.rs11", new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING });
// $NON-NLS-1$
ProcedureParameter rs11p2 = createParameter("in", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode sq9n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1 FROM (EXEC pm1.sq2(pm1.sq9.in)) as x; END");
// $NON-NLS-1$
Procedure sq9 = createVirtualProcedure("sq9", pm1, Arrays.asList(rs11p2), sq9n1);
sq9.setResultSet(rs11);
// $NON-NLS-1$ //$NON-NLS-2$
ColumnSet<Procedure> rs12 = createResultSet("pm1.rs12", new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING });
// $NON-NLS-1$
ProcedureParameter rs12p2 = createParameter("in", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING);
// $NON-NLS-1$
ProcedureParameter rs12p3 = createParameter("in2", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode sq10n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1 FROM (EXEC pm1.sq2(pm1.sq10.in)) as x where e2=pm1.sq10.in2; END");
// $NON-NLS-1$
Procedure sq10 = createVirtualProcedure("sq10", pm1, Arrays.asList(rs12p2, rs12p3), sq10n1);
sq10.setResultSet(rs12);
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
ColumnSet<Procedure> rs13 = createResultSet("pm1.rs13", new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
// $NON-NLS-1$
ProcedureParameter rs13p2 = createParameter("in", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER);
// $NON-NLS-1$ //$NON-NLS-2$
Procedure sp2 = createStoredProcedure("sp2", pm1, Arrays.asList(rs13p2));
sp2.setResultSet(rs13);
// $NON-NLS-1$ //$NON-NLS-2$
ColumnSet<Procedure> rs14 = createResultSet("pm1.rs14", new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING });
// $NON-NLS-1$
ProcedureParameter rs14p2 = createParameter("in", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING);
// $NON-NLS-1$
ProcedureParameter rs14p3 = createParameter("in2", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode sq11n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1 FROM (EXEC pm1.sp2(?)) as x where e2=pm1.sq11.in; END");
// $NON-NLS-1$
Procedure sq11 = createVirtualProcedure("sq11", pm1, Arrays.asList(rs14p2, rs14p3), sq11n1);
sq11.setResultSet(rs14);
// $NON-NLS-1$ //$NON-NLS-2$
ColumnSet<Procedure> rs15 = createResultSet("pm1.rs15", new String[] { "count" }, new String[] { DataTypeManager.DefaultDataTypes.INTEGER });
// $NON-NLS-1$
ProcedureParameter rs15p2 = createParameter("in", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING);
// $NON-NLS-1$
ProcedureParameter rs15p3 = createParameter("in2", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode sq12n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN INSERT INTO pm1.g1 ( e1, e2 ) VALUES( pm1.sq12.in, pm1.sq12.in2 ); END");
// $NON-NLS-1$
Procedure sq12 = createVirtualProcedure("sq12", pm1, Arrays.asList(rs15p2, rs15p3), sq12n1);
sq12.setResultSet(rs15);
// $NON-NLS-1$ //$NON-NLS-2$
ColumnSet<Procedure> rs16 = createResultSet("pm1.rs16", new String[] { "count" }, new String[] { DataTypeManager.DefaultDataTypes.INTEGER });
// $NON-NLS-1$
ProcedureParameter rs16p2 = createParameter("in", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode sq13n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN INSERT INTO pm1.g1 ( e1, e2 ) VALUES( pm1.sq13.in, 2 ); END");
// $NON-NLS-1$
Procedure sq13 = createVirtualProcedure("sq13", pm1, Arrays.asList(rs16p2), sq13n1);
sq13.setResultSet(rs16);
// $NON-NLS-1$ //$NON-NLS-2$
ColumnSet<Procedure> rs17 = createResultSet("pm1.rs17", new String[] { "count" }, new String[] { DataTypeManager.DefaultDataTypes.INTEGER });
// $NON-NLS-1$
ProcedureParameter rs17p2 = createParameter("in", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING);
// $NON-NLS-1$
ProcedureParameter rs17p3 = createParameter("in2", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode sq14n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN UPDATE pm1.g1 SET e1 = pm1.sq14.in WHERE e2 = pm1.sq14.in2; END");
// $NON-NLS-1$
Procedure sq14 = createVirtualProcedure("sq14", pm1, Arrays.asList(rs17p2, rs17p3), sq14n1);
sq14.setResultSet(rs17);
// $NON-NLS-1$ //$NON-NLS-2$
ColumnSet<Procedure> rs18 = createResultSet("pm1.rs17", new String[] { "count" }, new String[] { DataTypeManager.DefaultDataTypes.INTEGER });
// $NON-NLS-1$
ProcedureParameter rs18p2 = createParameter("in", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING);
// $NON-NLS-1$
ProcedureParameter rs18p3 = createParameter("in2", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode sq15n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DELETE FROM pm1.g1 WHERE e1 = pm1.sq15.in AND e2 = pm1.sq15.in2; END");
// $NON-NLS-1$
Procedure sq15 = createVirtualProcedure("sq15", pm1, Arrays.asList(rs18p2, rs18p3), sq15n1);
sq15.setResultSet(rs18);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode sq16n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN INSERT INTO pm1.g1 ( e1, e2 ) VALUES( 1, 2 ); END");
// $NON-NLS-1$
createVirtualProcedure("sq16", pm1, null, sq16n1);
// $NON-NLS-1$ //$NON-NLS-2$
ColumnSet<Procedure> rs19 = createResultSet("pm1.rs19", new String[] { "xml" }, new String[] { DataTypeManager.DefaultDataTypes.XML });
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode sq17n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT * FROM xmltest.doc1; END");
// $NON-NLS-1$
Procedure sq17 = createVirtualProcedure("sq17", pm1, null, sq17n1);
sq17.setResultSet(rs19);
// $NON-NLS-1$ //$NON-NLS-2$
createStoredProcedure("sp3", pm1, null);
// $NON-NLS-1$ //$NON-NLS-2$
ColumnSet<Procedure> rs20 = createResultSet("pm1.rs20", new String[] { "xml" }, new String[] { DataTypeManager.DefaultDataTypes.XML });
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode sq18n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT * FROM xmltest.doc1; END");
// $NON-NLS-1$
Procedure sq18 = createVirtualProcedure("sq18", pm1, null, sq18n1);
sq18.setResultSet(rs20);
// $NON-NLS-1$ //$NON-NLS-2$
ColumnSet<Procedure> rs21 = createResultSet("pm1.rs21", new String[] { "xml" }, new String[] { DataTypeManager.DefaultDataTypes.STRING });
// $NON-NLS-1$
ProcedureParameter sq19p2 = createParameter("param1", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode sq19n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT * FROM xmltest.doc4 WHERE root.node1 = param1; END");
// $NON-NLS-1$
Procedure sq19 = createVirtualProcedure("sq19", pm1, Arrays.asList(sq19p2), sq19n1);
sq19.setResultSet(rs21);
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
ColumnSet<Procedure> rs22 = createResultSet("pm1.rs13", new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
// $NON-NLS-1$
ProcedureParameter rs22p2 = createParameter("in", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.BIG_INTEGER);
// $NON-NLS-1$ //$NON-NLS-2$
Procedure sp4 = createStoredProcedure("sp4", pm1, Arrays.asList(rs22p2));
sp4.setResultSet(rs22);
// no params or result set at all
// $NON-NLS-1$ //$NON-NLS-2$
createStoredProcedure("sp5", pm1, new ArrayList<ProcedureParameter>());
// virtual stored procedures
// $NON-NLS-1$ //$NON-NLS-2$
ColumnSet<Procedure> vsprs1 = vsprs1();
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vspqn1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE integer x; LOOP ON (SELECT e2 FROM pm1.g1) AS mycursor BEGIN x=mycursor.e2; IF(x = 15) BEGIN BREAK; END END SELECT e1 FROM pm1.g1 where pm1.g1.e2 = x; END");
// $NON-NLS-1$\
Procedure vsp1 = createVirtualProcedure("vsp1", pm1, null, vspqn1);
vsp1.setResultSet(vsprs1);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vspqn2 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE integer x; LOOP ON (SELECT e2 FROM pm1.g1) AS mycursor BEGIN x=mycursor.e2; END SELECT e1 FROM pm1.g1; END");
// $NON-NLS-1$
Procedure vsp2 = createVirtualProcedure("vsp2", pm1, null, vspqn2);
vsp2.setResultSet(vsprs1());
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vspqn3 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE integer x; LOOP ON (SELECT e2 FROM pm1.g1) AS mycursor BEGIN x=mycursor.e2; END SELECT e1 FROM pm1.g1 WHERE x=e2; END");
// $NON-NLS-1$
Procedure vsp3 = createVirtualProcedure("vsp3", pm1, null, vspqn3);
vsp3.setResultSet(vsprs1());
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vspqn4 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE integer x; LOOP ON (SELECT e2 FROM pm1.g1) AS mycursor BEGIN IF(mycursor.e2 > 10) BEGIN BREAK; END x=mycursor.e2; END SELECT e1 FROM pm1.g1 WHERE x=e2; END");
// $NON-NLS-1$
Procedure vsp4 = createVirtualProcedure("vsp4", pm1, null, vspqn4);
vsp4.setResultSet(vsprs1());
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vspqn5 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE integer x; LOOP ON (SELECT e2 FROM pm1.g1) AS mycursor BEGIN IF(mycursor.e2 > 10) BEGIN CONTINUE; END x=mycursor.e2; END SELECT e1 FROM pm1.g1 WHERE x=e2; END");
// $NON-NLS-1$
Procedure vsp5 = createVirtualProcedure("vsp5", pm1, null, vspqn5);
vsp5.setResultSet(vsprs1());
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vspqn6 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE integer x; x=0; WHILE (x < 15) BEGIN x=x+1; END SELECT e1 FROM pm1.g1 WHERE x=e2; END");
// $NON-NLS-1$
Procedure vsp6 = createVirtualProcedure("vsp6", pm1, null, vspqn6);
vsp6.setResultSet(vsprs1());
// $NON-NLS-1$
ProcedureParameter vspp2 = createParameter("param1", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vspqn7 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE integer x; x=0; WHILE (x < 12) BEGIN x=x+pm1.vsp7.param1; END SELECT e1 FROM pm1.g1 WHERE x=e2; END");
// $NON-NLS-1$
Procedure vsp7 = createVirtualProcedure("vsp7", pm1, Arrays.asList(vspp2), vspqn7);
vsp7.setResultSet(vsprs1());
// $NON-NLS-1$
ProcedureParameter vspp8 = createParameter("param1", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vspqn8 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE integer x; x=0; WHILE (x < 12) BEGIN x=x+pm1.vsp8.param1; END SELECT e1 FROM pm1.g1 WHERE e2 >= param1; END");
// $NON-NLS-1$
Procedure vsp8 = createVirtualProcedure("vsp8", pm1, Arrays.asList(vspp8), vspqn8);
vsp8.setResultSet(vsprs1());
// $NON-NLS-1$
ProcedureParameter vspp9 = createParameter("param1", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vspqn9 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE integer x; x=0; WHILE (x < param1) BEGIN x=x+pm1.vsp9.param1; END SELECT e1 FROM pm1.g1 WHERE e2 >= param1; END");
// $NON-NLS-1$
Procedure vsp9 = createVirtualProcedure("vsp9", pm1, Arrays.asList(vspp9), vspqn9);
vsp9.setResultSet(vsprs1());
// $NON-NLS-1$
ProcedureParameter vspp3 = createParameter("param1", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vspqn10 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE integer x; LOOP ON (SELECT e2 FROM pm1.g1 WHERE e2=param1) AS mycursor BEGIN x=mycursor.e2; END END");
// $NON-NLS-1$
createVirtualProcedure("vsp10", pm1, Arrays.asList(vspp3), vspqn10);
// invalid
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vspqn11 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN LOOP ON (SELECT e2 FROM pm1.g1) AS mycursor BEGIN LOOP ON (SELECT e1 FROM pm1.g1) AS mycursor BEGIN END END SELECT e1 FROM pm1.g1; END");
// $NON-NLS-1$
Procedure vsp11 = createVirtualProcedure("vsp11", pm1, null, vspqn11);
vsp11.setResultSet(vsprs1());
// invalid
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vspqn12 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE integer x; LOOP ON (SELECT e2 FROM pm1.g1) AS mycursor BEGIN END x=mycursor.e2; SELECT e1 FROM pm1.g1; END");
// $NON-NLS-1$
Procedure vsp12 = createVirtualProcedure("vsp12", pm1, null, vspqn12);
vsp12.setResultSet(vsprs1());
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
ColumnSet<Procedure> vsprs2 = vspp4();
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vspqn13 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE string x; LOOP ON (SELECT e1 FROM pm1.g1) AS mycursor BEGIN x=mycursor.e1; END SELECT x, 5; END");
// $NON-NLS-1$
Procedure vsp13 = createVirtualProcedure("vsp13", pm1, null, vspqn13);
vsp13.setResultSet(vsprs2);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vspqn14 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1 INTO #temptable FROM pm1.g1; SELECT e1 FROM #temptable; END");
// $NON-NLS-1$
Procedure vsp14 = createVirtualProcedure("vsp14", pm1, null, vspqn14);
vsp14.setResultSet(vsprs1());
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vspqn15 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1, e2 INTO #temptable FROM pm1.g1; SELECT #temptable.e1 FROM #temptable, pm1.g2 WHERE #temptable.e2 = pm1.g2.e2; END");
// $NON-NLS-1$
Procedure vsp15 = createVirtualProcedure("vsp15", pm1, null, vspqn15);
vsp15.setResultSet(vsprs1());
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vspqn16 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1, e2 INTO #temptable FROM pm1.g1; SELECT a.e1 FROM (SELECT pm1.g2.e1 FROM #temptable, pm1.g2 WHERE #temptable.e2 = pm1.g2.e2) AS a; END");
// QueryNode vspqn16 = new QueryNode("vsp16", "CREATE VIRTUAL PROCEDURE BEGIN SELECT e1, e2 INTO #temptable FROM pm1.g1; SELECT e1 FROM #temptable where e1 in (SELECT pm1.g2.e1 FROM #temptable, pm1.g2 WHERE #temptable.e2 = pm1.g2.e2); END"); //$NON-NLS-1$ //$NON-NLS-2$
// $NON-NLS-1$
Procedure vsp16 = createVirtualProcedure("vsp16", pm1, null, vspqn16);
vsp16.setResultSet(vsprs1());
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vspqn17 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE integer x; SELECT e1, e2 INTO #temptable FROM pm1.g1; LOOP ON (SELECT e1, e2 FROM #temptable) AS mycursor BEGIN x=mycursor.e2; END SELECT e1 FROM pm1.g1 WHERE x=e2; END");
// $NON-NLS-1$
Procedure vsp17 = createVirtualProcedure("vsp17", pm1, null, vspqn17);
vsp17.setResultSet(vsprs1());
// invalid
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vspqn18 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1 INTO temptable FROM pm1.g1; END");
// $NON-NLS-1$
Procedure vsp18 = createVirtualProcedure("vsp18", pm1, null, vspqn18);
vsp18.setResultSet(vsprs1());
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vspqn19 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1 INTO #temptable FROM pm1.g1; SELECT e1 INTO #temptable FROM pm1.g1; SELECT e1 FROM #temptable; END");
// $NON-NLS-1$
Procedure vsp19 = createVirtualProcedure("vsp19", pm1, null, vspqn19);
vsp19.setResultSet(vsprs1());
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vspqn20 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1 INTO #temptable FROM pm1.g1; INSERT INTO #temptable(e1) VALUES( 'Fourth'); SELECT e1 FROM #temptable; END");
// $NON-NLS-1$
Procedure vsp20 = createVirtualProcedure("vsp20", pm1, null, vspqn20);
vsp20.setResultSet(vsprs1());
// $NON-NLS-1$
ProcedureParameter vspp21 = createParameter("param1", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vspqn21 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1, e2 INTO #temptable FROM pm1.g1; INSERT INTO #temptable(#temptable.e1, e2) VALUES( 'Fourth', param1); SELECT e1, e2 FROM #temptable; END");
// $NON-NLS-1$
Procedure vsp21 = createVirtualProcedure("vsp21", pm1, Arrays.asList(vspp21), vspqn21);
vsp21.setResultSet(vspp4());
// $NON-NLS-1$
ProcedureParameter vspp22 = createParameter("param1", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vspqn22 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1, e2 INTO #temptable FROM pm1.g1 where e2 > param1; SELECT e1, e2 FROM #temptable; END");
// $NON-NLS-1$
Procedure vsp22 = createVirtualProcedure("vsp22", pm1, Arrays.asList(vspp22), vspqn22);
vsp22.setResultSet(vspp4());
// $NON-NLS-1$
ProcedureParameter vspp23 = createParameter("param1", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vspqn23 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE string x; SELECT e1, e2 INTO #temptable FROM pm1.g1 where e2 > param1; x = SELECT e1 FROM #temptable WHERE e2=15; SELECT x, 15; END");
// $NON-NLS-1$
Procedure vsp23 = createVirtualProcedure("vsp23", pm1, Arrays.asList(vspp23), vspqn23);
vsp23.setResultSet(vspp4());
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vspqn24 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1, e2 INTO #temptable FROM pm1.g1; SELECT #temptable.e1 FROM #temptable WHERE #temptable.e2=15; END");
// $NON-NLS-1$
Procedure vsp24 = createVirtualProcedure("vsp24", pm1, null, vspqn24);
vsp24.setResultSet(vsprs1());
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vspqn25 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1 INTO #temptable FROM pm1.g1 WHERE e1 ='no match'; SELECT e1 FROM #temptable; END");
// $NON-NLS-1$
Procedure vsp25 = createVirtualProcedure("vsp25", pm1, null, vspqn25);
vsp25.setResultSet(vsprs1());
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vspqn27 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1 from (exec pm1.vsp25())as c; END");
// $NON-NLS-1$
Procedure vsp27 = createVirtualProcedure("vsp27", pm1, null, vspqn27);
vsp27.setResultSet(vsprs1());
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vspqn28 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT 0 AS e1 ORDER BY e1; END");
// $NON-NLS-1$
Procedure vsp28 = createVirtualProcedure("vsp28", pm1, null, vspqn28);
vsp28.setResultSet(vsprs1());
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vspqn29 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1 FROM pm1.g1 ORDER BY e1; END");
// $NON-NLS-1$
Procedure vsp29 = createVirtualProcedure("vsp29", pm1, null, vspqn29);
vsp29.setResultSet(vsprs1());
// $NON-NLS-1$ //$NON-NLS-2$
ColumnSet<Procedure> vsprs30 = createResultSet("pm1.vsprs30", new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING });
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vspqn30 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1 FROM pm1.g1; END");
// $NON-NLS-1$
Procedure vsp30 = createVirtualProcedure("vsp30", pm1, null, vspqn30);
vsp30.setResultSet(vsprs30);
// $NON-NLS-1$ //$NON-NLS-2$
ColumnSet<Procedure> vsprs31 = createResultSet("pm1.vsprs31", new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING });
// $NON-NLS-1$
ProcedureParameter vsp31p2 = createParameter("p1", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vspqn31 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1 FROM pm1.g1 WHERE e2 = pm1.vsp31.p1; END");
// $NON-NLS-1$
Procedure vsp31 = createVirtualProcedure("vsp31", pm1, Arrays.asList(createParameter("p1", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER)), vspqn31);
vsp31.setResultSet(vsprs31);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vspqn38 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE integer VARIABLES.y; VARIABLES.y=5; EXEC pm1.vsp7(VARIABLES.y); END");
// $NON-NLS-1$
Procedure vsp38 = createVirtualProcedure("vsp38", pm1, null, vspqn38);
vsp38.setResultSet(vsprs1());
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vspqn39 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE integer VARIABLES.x; VARIABLES.x=5; EXEC pm1.vsp7(VARIABLES.x); END");
// $NON-NLS-1$
Procedure vsp39 = createVirtualProcedure("vsp39", pm1, null, vspqn39);
vsp39.setResultSet(vsprs1());
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vspqn40 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN LOOP ON (SELECT e2 FROM pm1.g1) AS mycursor BEGIN EXEC pm1.vsp41(); END END");
// $NON-NLS-1$
Procedure vsp40 = createVirtualProcedure("vsp40", pm1, null, vspqn40);
vsp40.setResultSet(vsprs1());
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vspqn41 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1 FROM pm1.g1 where e2=15; END");
// $NON-NLS-1$
Procedure vsp41 = createVirtualProcedure("vsp41", pm1, null, vspqn41);
vsp41.setResultSet(vsprs1());
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vspqn37 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE integer x; VARIABLES.x=5; INSERT INTO vm1.g1(e2) values(VARIABLES.x); SELECT cast(ROWCOUNT as string); END");
// $NON-NLS-1$
Procedure vsp37 = createVirtualProcedure("vsp37", pm1, null, vspqn37);
vsp37.setResultSet(vsprs1());
QueryNode vspqn33 = new QueryNode(// $NON-NLS-1$//$NON-NLS-2$
new StringBuffer("CREATE VIRTUAL PROCEDURE").append(// $NON-NLS-1$
" BEGIN").append(// $NON-NLS-1$
" SELECT 3 AS temp1 INTO #myTempTable;").append(// $NON-NLS-1$
" SELECT 2 AS temp1 INTO #myTempTable;").append(// $NON-NLS-1$
" SELECT 1 AS temp1 INTO #myTempTable;").append(// $NON-NLS-1$
" SELECT temp1 AS e1 FROM #myTempTable ORDER BY e1;").append(" END").toString());
// $NON-NLS-1$
Procedure vsp33 = createVirtualProcedure("vsp33", pm1, null, vspqn33);
vsp33.setResultSet(vsprs1());
// $NON-NLS-1$ //$NON-NLS-2$
ColumnSet<Procedure> vsprs35 = createResultSet("pm1.vsprs31", new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING });
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vspqn35 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE integer VARIABLES.ID; VARIABLES.ID = pm1.vsp35.p1; SELECT e1 FROM pm1.g1 WHERE e2 = VARIABLES.ID; END");
// $NON-NLS-1$
Procedure vsp35 = createVirtualProcedure("vsp35", pm1, Arrays.asList(vsp31p2), vspqn35);
vsp35.setResultSet(vsprs35);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vspqn34 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1, 0 AS const FROM pm1.g1 ORDER BY const; END");
// $NON-NLS-1$
Procedure vsp34 = createVirtualProcedure("vsp34", pm1, null, vspqn34);
vsp34.setResultSet(vspp4());
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vspqn45 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1, e2 INTO #temptable FROM pm1.g1; SELECT #temptable.e1 FROM #temptable where #temptable.e1 in (SELECT pm1.g2.e1 FROM pm1.g2 ); END");
// $NON-NLS-1$
Procedure vsp45 = createVirtualProcedure("vsp45", pm1, null, vspqn45);
vsp45.setResultSet(vsprs1());
// Virtual group w/ procedure in transformation, optional params, named parameter syntax
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vspqn47 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN IF (pm1.vsp47.param1 IS NOT NULL) BEGIN SELECT 'FOO' as e1, pm1.vsp47.param1 as e2; END ELSE BEGIN SELECT pm1.vsp47.param2 as e1, 2112 as e2; END END");
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
ColumnSet<Procedure> vsprs47 = createResultSet("pm1.vsprs47", new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
// $NON-NLS-1$
ProcedureParameter vspp47_2 = createParameter("param1", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER);
vspp47_2.setNullType(NullType.Nullable);
// $NON-NLS-1$
ProcedureParameter vspp47_3 = createParameter("param2", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING);
vspp47_3.setNullType(NullType.Nullable);
// $NON-NLS-1$
Procedure vsp47 = createVirtualProcedure("vsp47", pm1, Arrays.asList(vspp47_2, vspp47_3), vspqn47);
vsp47.setResultSet(vsprs47);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vgvpn7 = new QueryNode("SELECT P.e2 as ve3, P.e1 as ve4 FROM (EXEC pm1.vsp47(param1=vm1.vgvp7.ve1, param2=vm1.vgvp7.ve2)) as P");
// QueryNode vgvpn7 = new QueryNode("vm1.vgvp7", "SELECT P.e2 as ve1, P.e1 as ve2 FROM (EXEC pm1.vsp47(vm1.vgvp7.ve1, vm1.vgvp7.ve2)) as P"); //$NON-NLS-1$ //$NON-NLS-2$
// $NON-NLS-1$
Table vgvp7 = createVirtualGroup("vgvp7", vm1, vgvpn7);
// $NON-NLS-1$
Column vgvp7e1 = createElement("ve1", vgvp7, DataTypeManager.DefaultDataTypes.INTEGER);
vgvp7e1.setSelectable(false);
// $NON-NLS-1$
Column vgvp7e2 = createElement("ve2", vgvp7, DataTypeManager.DefaultDataTypes.STRING);
vgvp7e2.setSelectable(false);
// $NON-NLS-1$
createElement("ve3", vgvp7, DataTypeManager.DefaultDataTypes.STRING);
// $NON-NLS-1$
createElement("ve4", vgvp7, DataTypeManager.DefaultDataTypes.STRING);
// invalid
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vspqn32 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE integer x; LOOP ON (SELECT e2 FROM pm1.g1) AS #mycursor BEGIN IF(#mycursor.e2 > 10) BEGIN CONTINUE; END x=#mycursor.e2; END SELECT e1 FROM pm1.g1 WHERE x=e2; END");
// $NON-NLS-1$
Procedure vsp32 = createVirtualProcedure("vsp32", pm1, null, vspqn32);
vsp32.setResultSet(vsprs1());
// virtual group with procedure in transformation
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vspqn26 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1, e2 FROM pm1.g1 WHERE e2 >= pm1.vsp26.param1 and e1 = pm1.vsp26.param2; END");
// $NON-NLS-1$
ProcedureParameter vspp26_1 = createParameter("param1", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER);
// $NON-NLS-1$
ProcedureParameter vspp26_2 = createParameter("param2", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING);
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
ColumnSet<Procedure> vsprs3 = createResultSet("pm1.vsprs3", new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
// $NON-NLS-1$
Procedure vsp26 = createVirtualProcedure("vsp26", pm1, Arrays.asList(vspp26_1, vspp26_2), vspqn26);
vsp26.setResultSet(vsprs3);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vgvpn1 = new QueryNode("SELECT P.e1 as ve3 FROM (EXEC pm1.vsp26(vm1.vgvp1.ve1, vm1.vgvp1.ve2)) as P");
// $NON-NLS-1$
Table vgvp1 = createVirtualGroup("vgvp1", vm1, vgvpn1);
// $NON-NLS-1$
Column vgvp1e1 = createElement("ve1", vgvp1, DataTypeManager.DefaultDataTypes.INTEGER);
vgvp1e1.setSelectable(false);
// $NON-NLS-1$
Column vgvp1e2 = createElement("ve2", vgvp1, DataTypeManager.DefaultDataTypes.STRING);
vgvp1e2.setSelectable(false);
// $NON-NLS-1$
createElement("ve3", vgvp1, DataTypeManager.DefaultDataTypes.STRING);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vgvpn2 = new QueryNode("SELECT P.e1 as ve3 FROM (EXEC pm1.vsp26(vm1.vgvp2.ve1, vm1.vgvp2.ve2)) as P where P.e1='a'");
// $NON-NLS-1$
Table vgvp2 = createVirtualGroup("vgvp2", vm1, vgvpn2);
// $NON-NLS-1$
Column vgvp2e1 = createElement("ve1", vgvp2, DataTypeManager.DefaultDataTypes.INTEGER);
vgvp2e1.setSelectable(false);
// $NON-NLS-1$
Column vgvp2e2 = createElement("ve2", vgvp2, DataTypeManager.DefaultDataTypes.STRING);
vgvp2e2.setSelectable(false);
// $NON-NLS-1$
createElement("ve3", vgvp2, DataTypeManager.DefaultDataTypes.STRING);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vgvpn3 = new QueryNode("SELECT P.e1 as ve3 FROM (EXEC pm1.vsp26(vm1.vgvp3.ve1, vm1.vgvp3.ve2)) as P, pm1.g2 where P.e1=g2.e1");
// $NON-NLS-1$
Table vgvp3 = createVirtualGroup("vgvp3", vm1, vgvpn3);
// $NON-NLS-1$
Column vgvp3e1 = createElement("ve1", vgvp3, DataTypeManager.DefaultDataTypes.INTEGER);
vgvp3e1.setSelectable(false);
// $NON-NLS-1$
Column vgvp3e2 = createElement("ve2", vgvp3, DataTypeManager.DefaultDataTypes.STRING);
vgvp3e2.setSelectable(false);
// $NON-NLS-1$
createElement("ve3", vgvp3, DataTypeManager.DefaultDataTypes.STRING);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vgvpn4 = new QueryNode("SELECT P.e1 as ve3 FROM (EXEC pm1.vsp26(vm1.vgvp4.ve1, vm1.vgvp4.ve2)) as P, vm1.g1 where P.e1=g1.e1");
// $NON-NLS-1$
Table vgvp4 = createVirtualGroup("vgvp4", vm1, vgvpn4);
// $NON-NLS-1$
Column vgvp4e1 = createElement("ve1", vgvp4, DataTypeManager.DefaultDataTypes.INTEGER);
vgvp4e1.setSelectable(false);
// $NON-NLS-1$
Column vgvp4e2 = createElement("ve2", vgvp4, DataTypeManager.DefaultDataTypes.STRING);
vgvp4e2.setSelectable(false);
// $NON-NLS-1$
createElement("ve3", vgvp4, DataTypeManager.DefaultDataTypes.STRING);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vgvpn5 = new QueryNode("SELECT * FROM vm1.vgvp4 where vm1.vgvp4.ve1=vm1.vgvp5.ve1 and vm1.vgvp4.ve2=vm1.vgvp5.ve2");
// $NON-NLS-1$
Table vgvp5 = createVirtualGroup("vgvp5", vm1, vgvpn5);
// $NON-NLS-1$
Column vgvp5e1 = createElement("ve1", vgvp5, DataTypeManager.DefaultDataTypes.INTEGER);
vgvp5e1.setSelectable(false);
// $NON-NLS-1$
Column vgvp5e2 = createElement("ve2", vgvp5, DataTypeManager.DefaultDataTypes.STRING);
vgvp5e2.setSelectable(false);
// $NON-NLS-1$
createElement("ve3", vgvp5, DataTypeManager.DefaultDataTypes.STRING);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vgvpn6 = new QueryNode("SELECT P.e1 as ve3, P.e2 as ve4 FROM (EXEC pm1.vsp26(vm1.vgvp6.ve1, vm1.vgvp6.ve2)) as P");
// $NON-NLS-1$
Table vgvp6 = createVirtualGroup("vgvp6", vm1, vgvpn6);
// $NON-NLS-1$
Column vgvp6e1 = createElement("ve1", vgvp6, DataTypeManager.DefaultDataTypes.INTEGER);
vgvp6e1.setSelectable(false);
// $NON-NLS-1$
Column vgvp6e2 = createElement("ve2", vgvp6, DataTypeManager.DefaultDataTypes.STRING);
vgvp6e2.setSelectable(false);
// $NON-NLS-1$
createElement("ve3", vgvp6, DataTypeManager.DefaultDataTypes.STRING);
// $NON-NLS-1$
createElement("ve4", vgvp6, DataTypeManager.DefaultDataTypes.INTEGER);
// virtual group with two elements. One selectable, one not.
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vm1g35n1 = new QueryNode("SELECT e1, e2 FROM pm1.g1");
// $NON-NLS-1$
Table vm1g35 = createVirtualGroup("g35", vm1, vm1g35n1);
// $NON-NLS-1$
Column vm1g35e1 = createElement("e1", vm1g35, DataTypeManager.DefaultDataTypes.STRING);
vm1g35e1.setSelectable(false);
// $NON-NLS-1$
createElement("e2", vm1g35, DataTypeManager.DefaultDataTypes.INTEGER);
// $NON-NLS-1$ //$NON-NLS-2$
ColumnSet<Procedure> vsprs36 = createResultSet("pm1.vsprs36", new String[] { "x" }, new String[] { DataTypeManager.DefaultDataTypes.INTEGER });
// $NON-NLS-1$
ProcedureParameter vsp36p2 = createParameter("param1", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vspqn36 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE integer x; x = pm1.vsp36.param1 * 2; SELECT x; END");
// $NON-NLS-1$
Procedure vsp36 = createVirtualProcedure("vsp36", pm1, Arrays.asList(vsp36p2), vspqn36);
vsp36.setResultSet(vsprs36);
// $NON-NLS-1$ //$NON-NLS-2$
ColumnSet<Procedure> vsprs42 = createResultSet("pm1.vsprs42", new String[] { "x" }, new String[] { DataTypeManager.DefaultDataTypes.INTEGER });
// $NON-NLS-1$
ProcedureParameter vsp42p2 = createParameter("param1", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vspqn42 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN IF (pm1.vsp42.param1 > 0) SELECT 1 AS x; ELSE SELECT 0 AS x; END");
// $NON-NLS-1$
Procedure vsp42 = createVirtualProcedure("vsp42", pm1, Arrays.asList(vsp42p2), vspqn42);
vsp42.setResultSet(vsprs42);
// $NON-NLS-1$
ProcedureParameter vspp44 = createParameter("param1", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vspqn44 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT pm1.vsp44.param1 INTO #temptable; SELECT e1 from pm1.g1; END");
// $NON-NLS-1$
Procedure vsp44 = createVirtualProcedure("vsp44", pm1, Arrays.asList(vspp44), vspqn44);
vsp44.setResultSet(vsprs1());
// $NON-NLS-1$
ProcedureParameter vspp43 = createParameter("param1", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vspqn43 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN exec pm1.vsp44(pm1.vsp43.param1); END");
// $NON-NLS-1$
Procedure vsp43 = createVirtualProcedure("vsp43", pm1, Arrays.asList(vspp43), vspqn43);
vsp43.setResultSet(vsprs1());
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vspqn46 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN create local temporary table #temptable (e1 string, e2 string); LOOP ON (SELECT e1 FROM pm1.g1) AS mycursor BEGIN select mycursor.e1, a.e1 as e2 into #temptable from (SELECT pm1.g1.e1 FROM pm1.g1 where pm1.g1.e1 = mycursor.e1) a; END SELECT e1 FROM #temptable; END");
// $NON-NLS-1$
Procedure vsp46 = createVirtualProcedure("vsp46", pm1, null, vspqn46);
vsp46.setResultSet(vsprs1());
// $NON-NLS-1$ //$NON-NLS-2$
ColumnSet<Procedure> vsp48rs = createResultSet("pm1vsp48.rs", new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING });
// $NON-NLS-1$
ProcedureParameter vsp48p2 = createParameter("in", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vspqn48 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE string x; SELECT e1 FROM (EXEC pm1.sq2(pm1.vsp48.in)) as e; END");
// $NON-NLS-1$
Procedure vsp48 = createVirtualProcedure("vsp48", pm1, Arrays.asList(vsp48p2), vspqn48);
vsp48.setResultSet(vsp48rs);
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
ColumnSet<Procedure> vsp49rs = createResultSet("pm1vsp49.rs", new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vspqn49 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE string x; x = 'b'; EXEC pm1.sq2(x); END");
// $NON-NLS-1$
Procedure vsp49 = createVirtualProcedure("vsp49", pm1, null, vspqn49);
vsp49.setResultSet(vsp49rs);
// $NON-NLS-1$ //$NON-NLS-2$
ColumnSet<Procedure> vsp50rs = createResultSet("pm1vsp50.rs", new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING });
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vspqn50 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE string x; x = 'b'; SELECT e1 FROM (EXEC pm1.sq2(x)) as e; END");
// $NON-NLS-1$
Procedure vsp50 = createVirtualProcedure("vsp50", pm1, null, vspqn50);
vsp50.setResultSet(vsp50rs);
// $NON-NLS-1$ //$NON-NLS-2$
ColumnSet<Procedure> vsp51rs = createResultSet("pm1vsp51.rs", new String[] { "result" }, new String[] { DataTypeManager.DefaultDataTypes.STRING });
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vspqn51 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE string x; x = 'b'; LOOP ON (SELECT e1 FROM (EXEC pm1.sq2(x)) as e) AS c BEGIN x = x || 'b'; END SELECT x AS result; END");
// $NON-NLS-1$
Procedure vsp51 = createVirtualProcedure("vsp51", pm1, null, vspqn51);
vsp51.setResultSet(vsp51rs);
// $NON-NLS-1$ //$NON-NLS-2$
ColumnSet<Procedure> vsp52rs = createResultSet("pm1vsp52.rs", new String[] { "result" }, new String[] { DataTypeManager.DefaultDataTypes.STRING });
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vspqn52 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE string x; x = 'c'; x = SELECT e1 FROM (EXEC pm1.sq2(x)) as e; SELECT x AS result; END");
// $NON-NLS-1$
Procedure vsp52 = createVirtualProcedure("vsp52", pm1, null, vspqn52);
vsp52.setResultSet(vsp52rs);
// $NON-NLS-1$ //$NON-NLS-2$
ColumnSet<Procedure> vsp53rs = createResultSet("pm1vsp53.rs", new String[] { "result" }, new String[] { DataTypeManager.DefaultDataTypes.STRING });
// $NON-NLS-1$
ProcedureParameter vsp53p2 = createParameter("in", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vspqn53 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE string x; x = 'b'; LOOP ON (SELECT e1 FROM (EXEC pm1.sq2(pm1.vsp53.in)) as e) AS c BEGIN x = x || 'b'; END SELECT x AS result; END");
// $NON-NLS-1$
Procedure vsp53 = createVirtualProcedure("vsp53", pm1, Arrays.asList(vsp53p2), vspqn53);
vsp53.setResultSet(vsp53rs);
// $NON-NLS-1$ //$NON-NLS-2$
ColumnSet<Procedure> vsp54rs = createResultSet("pm1vsp54.rs", new String[] { "result" }, new String[] { DataTypeManager.DefaultDataTypes.STRING });
// $NON-NLS-1$
ProcedureParameter vsp54p2 = createParameter("in", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vspqn54 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE string x; x = 'c'; x = SELECT e1 FROM (EXEC pm1.sq2(pm1.vsp54.in)) as e; SELECT x AS result; END");
// $NON-NLS-1$
Procedure vsp54 = createVirtualProcedure("vsp54", pm1, Arrays.asList(vsp54p2), vspqn54);
vsp54.setResultSet(vsp54rs);
// $NON-NLS-1$
ProcedureParameter vspp55 = createParameter("param1", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vspqn55 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN select e1, param1 as a from vm1.g1; END");
// $NON-NLS-1$
Procedure vsp55 = createVirtualProcedure("vsp55", pm1, Arrays.asList(vspp55), vspqn55);
vsp55.setResultSet(vspp4());
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vspqn56 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT * INTO #temptable FROM pm1.g1; SELECT #temptable.e1 FROM #temptable; END");
// $NON-NLS-1$
Procedure vsp56 = createVirtualProcedure("vsp56", pm1, null, vspqn56);
vsp56.setResultSet(vsprs1());
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vspqn57 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT * INTO #temptable FROM pm1.g1; SELECT #temptable.e1 FROM #temptable order by #temptable.e1; END");
// $NON-NLS-1$
Procedure vsp57 = createVirtualProcedure("vsp57", pm1, null, vspqn57);
vsp57.setResultSet(vsprs1());
// $NON-NLS-1$
ProcedureParameter vspp58 = createParameter("inp", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER);
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vspqn58 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT vsp58.inp; END");
// $NON-NLS-1$
Procedure vsp58 = createVirtualProcedure("vsp58", pm1, Arrays.asList(vspp58), vspqn58);
vsp58.setResultSet(vsprs1());
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vspqn59 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT * INTO #temp FROM pm5.g3;INSERT INTO #temp (e1, e2) VALUES('integer',1); END");
// $NON-NLS-1$
Procedure vsp59 = createVirtualProcedure("vsp59", pm6, null, vspqn59);
vsp59.setResultSet(vsprs1());
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vspqn60 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN create local temporary table temp_table (column1 string);insert into temp_table (column1) values ('First');insert into temp_table (column1) values ('Second');insert into temp_table (column1) values ('Third');select * from temp_table; END");
// $NON-NLS-1$
Procedure vsp60 = createVirtualProcedure("vsp60", pm1, null, vspqn60);
vsp60.setResultSet(vsprs1());
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vspqn61 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN create local temporary table temp_table (column1 string);insert into temp_table (column1) values ('First');drop table temp_table;create local temporary table temp_table (column1 string);insert into temp_table (column1) values ('First');insert into temp_table (column1) values ('Second');insert into temp_table (column1) values ('Third');select * from temp_table; END");
// $NON-NLS-1$
Procedure vsp61 = createVirtualProcedure("vsp61", pm1, null, vspqn61);
vsp61.setResultSet(vsprs1());
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vspqn62 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN create local temporary table temp_table (column1 string); select e1 as column1 into temp_table from pm1.g1;select * from temp_table; END");
// $NON-NLS-1$
Procedure vsp62 = createVirtualProcedure("vsp62", pm1, null, vspqn62);
vsp62.setResultSet(vsprs1());
// $NON-NLS-1$ //$NON-NLS-2$
QueryNode vspqn63 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN declare string o; if(1>0) begin declare string a; a='b'; o=a; end if(1>0) begin declare string a; a='c'; o=a; end select o; END");
// $NON-NLS-1$
Procedure vsp63 = createVirtualProcedure("vsp63", pm1, null, vspqn63);
vsp63.setResultSet(vsprs1());
return metadataStore;
}
use of org.teiid.query.optimizer.FakeFunctionMetadataSource in project teiid by teiid.
the class TestProcessor method testPreparedStatementDefect15348b.
/**
* defect 15348
* @throws Exception
*/
@Test
public void testPreparedStatementDefect15348b() throws Exception {
// $NON-NLS-1$
String sql = "SELECT e1 from pm4.g1 where myrtrim(concat(?, 'a '))=e1";
// Create expected results
List[] expected = new List[] { // $NON-NLS-1$
Arrays.asList(new Object[] { "aa" }) };
// Construct data manager with data
FakeDataManager dataManager = new FakeDataManager();
sampleData2a(dataManager);
// Plan query
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
// $NON-NLS-1$
caps.setFunctionSupport("myrtrim", true);
// $NON-NLS-1$
caps.setFunctionSupport("concat", true);
// $NON-NLS-1$
capFinder.addCapabilities("pm4", caps);
QueryMetadataInterface metadata = RealMetadataFactory.createTransformationMetadata(RealMetadataFactory.example1Cached().getMetadataStore(), "example1", new FunctionTree("foo", new FakeFunctionMetadataSource(), true));
processPreparedStatement(sql, expected, dataManager, capFinder, metadata, Arrays.asList("a"));
}
use of org.teiid.query.optimizer.FakeFunctionMetadataSource in project teiid by teiid.
the class TestProcessor method testPreparedStatementDefect15348.
/**
* defect 15348
* @throws Exception
*/
@Test
public void testPreparedStatementDefect15348() throws Exception {
// $NON-NLS-1$
String sql = "SELECT e1 from pm1.g1 where myrtrim(?)=e1";
// Create expected results
List[] expected = new List[] { // $NON-NLS-1$
Arrays.asList(new Object[] { "a" }) };
// Construct data manager with data
FakeDataManager dataManager = new FakeDataManager();
sampleData2a(dataManager);
// Plan query
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
// $NON-NLS-1$
caps.setFunctionSupport("myrtrim", true);
// $NON-NLS-1$
capFinder.addCapabilities("pm1", caps);
QueryMetadataInterface metadata = RealMetadataFactory.createTransformationMetadata(RealMetadataFactory.example1Cached().getMetadataStore(), "example1", new FunctionTree("foo", new FakeFunctionMetadataSource(), true));
processPreparedStatement(sql, expected, dataManager, capFinder, metadata, Arrays.asList("a "));
}
use of org.teiid.query.optimizer.FakeFunctionMetadataSource in project teiid by teiid.
the class TestResolver method testNamespacedFunction.
@Test
public void testNamespacedFunction() throws Exception {
// $NON-NLS-1$
String sql = "SELECT namespace.func('e1') FROM vm1.g1 ";
QueryMetadataInterface metadata = RealMetadataFactory.createTransformationMetadata(RealMetadataFactory.example1Cached().getMetadataStore(), "example1", new FunctionTree("foo", new FakeFunctionMetadataSource()));
Query command = (Query) helpParse(sql);
QueryResolver.resolveCommand(command, metadata);
command = (Query) helpParse("SELECT func('e1') FROM vm1.g1 ");
QueryResolver.resolveCommand(command, metadata);
}
use of org.teiid.query.optimizer.FakeFunctionMetadataSource in project teiid by teiid.
the class TestFunctionPushdown method testMustPushdownOverMultipleSourcesWithViewDupRemoval.
@Test
public void testMustPushdownOverMultipleSourcesWithViewDupRemoval() throws Exception {
QueryMetadataInterface metadata = RealMetadataFactory.createTransformationMetadata(RealMetadataFactory.example1Cached().getMetadataStore(), "example1", new FunctionTree("foo", new FakeFunctionMetadataSource()));
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
caps.setFunctionSupport("misc.namespace.func", true);
// $NON-NLS-1$
capFinder.addCapabilities("pm1", caps);
// $NON-NLS-1$
capFinder.addCapabilities("pm2", caps);
// $NON-NLS-1$
String sql = "select func(x.e1) from (select distinct x.* from pm1.g1 as x, pm2.g1 as y where x.e2 = y.e2 order by e1 limit 10) as x";
helpPlan(sql, metadata, null, capFinder, new String[] {}, // $NON-NLS-1$
ComparisonMode.FAILED_PLANNING);
}
Aggregations