public static SchemaPlus addSchema(SchemaPlus rootSchema, SchemaSpec schema) {
switch (schema) {
case REFLECTIVE_FOODMART:
return rootSchema.add("foodmart",
new ReflectiveSchema(new JdbcTest.FoodmartSchema()));
case JDBC_FOODMART:
final DataSource dataSource =
JdbcSchema.dataSource(
CONNECTION_SPEC.url,
CONNECTION_SPEC.driver,
CONNECTION_SPEC.username,
CONNECTION_SPEC.password);
return rootSchema.add("foodmart",
JdbcSchema.create(rootSchema, "foodmart", dataSource, null,
"foodmart"));
case CLONE_FOODMART:
SchemaPlus foodmart = rootSchema.getSubSchema("foodmart");
if (foodmart == null) {
foodmart = OptiqAssert.addSchema(rootSchema, SchemaSpec.JDBC_FOODMART);
}
return rootSchema.add("foodmart2", new CloneSchema(foodmart));
case HR:
return rootSchema.add("hr",
new ReflectiveSchema(new JdbcTest.HrSchema()));
case LINGUAL:
return rootSchema.add("SALES",
new ReflectiveSchema(new JdbcTest.LingualSchema()));
case POST:
final SchemaPlus post = rootSchema.add("POST", new AbstractSchema());
post.add("EMP",
ViewTable.viewMacro(post,
"select * from (values\n"