use of com.srotya.sidewinder.core.sql.calcite.SidewinderDatabaseSchema in project sidewinder by srotya.
the class SqlApi method checkAndAddSchema.
public boolean checkAndAddSchema(String dbName) throws Exception {
synchronized (connection) {
if (!engine.checkIfExists(dbName)) {
return false;
}
CalciteConnection calciteConnection = connection.unwrap(CalciteConnection.class);
String tdbName = dbName.toUpperCase();
if (calciteConnection.getRootSchema().getSubSchema(tdbName) == null) {
System.err.println("Adding DB to connection:" + dbName + "\t" + tdbName);
calciteConnection.getRootSchema().add(tdbName, new SidewinderDatabaseSchema(engine, dbName));
}
return true;
}
}
Aggregations