Esempio n. 1
0
  protected RelNode optimizeLoopbackLink(
      RelOptCluster cluster, RelOptConnection connection, String[] actualName) throws SQLException {
    if (directory == null) {
      return null;
    }
    if (directory.server == null) {
      return null;
    }
    if ((directory.server.schemaName != null)
        && !directory.server.useSchemaNameAsForeignQualifier) {
      // Schema name should never be specified for a connection to
      // Farrago; if it is, bail.
      return null;
    }

    Connection loopbackConnection = directory.server.getConnection();
    if (!(loopbackConnection instanceof FarragoJdbcEngineConnection)) {
      Connection conn = loopbackConnection;
      while ((conn != null) && (conn instanceof DelegatingConnection)) {
        conn = ((DelegatingConnection) conn).getDelegate();
      }
      if (!(conn instanceof FarragoJdbcEngineConnection)) {
        return null;
      }
    }

    String catalogName = directory.server.catalogName;
    if (catalogName == null) {
      // No catalog name specified, so try to query the connection for
      // it.
      catalogName = loopbackConnection.getCatalog();
      if (catalogName == null) {
        return null;
      }
    }

    if (actualName[0] == null) {
      actualName[0] = catalogName;
    }

    // REVIEW jvs 14-Aug-2006:  Security security security.
    RelOptTable realTable = getPreparingStmt().getTableForMember(actualName);
    if (realTable == null) {
      return null;
    }
    return realTable.toRel(cluster, connection);
  }
Esempio n. 2
0
 public boolean isKey(BitSet columns) {
   return parent.isKey(columns);
 }
Esempio n. 3
0
 public List<RelCollation> getCollationList() {
   return parent.getCollationList();
 }
Esempio n. 4
0
 public RelOptSchema getRelOptSchema() {
   return parent.getRelOptSchema();
 }
Esempio n. 5
0
 public RelDataType getRowType() {
   return parent.getRowType();
 }
Esempio n. 6
0
 public double getRowCount() {
   return parent.getRowCount();
 }
Esempio n. 7
0
 public List<String> getQualifiedName() {
   return parent.getQualifiedName();
 }
Esempio n. 8
0
 public Expression getExpression(Class clazz) {
   return parent.getExpression(clazz);
 }
Esempio n. 9
0
 public <T> T unwrap(Class<T> clazz) {
   if (clazz.isInstance(this)) {
     return clazz.cast(this);
   }
   return parent.unwrap(clazz);
 }