Example #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);
  }
Example #2
0
 public boolean isKey(BitSet columns) {
   return parent.isKey(columns);
 }
Example #3
0
 public List<RelCollation> getCollationList() {
   return parent.getCollationList();
 }
Example #4
0
 public RelOptSchema getRelOptSchema() {
   return parent.getRelOptSchema();
 }
Example #5
0
 public RelDataType getRowType() {
   return parent.getRowType();
 }
Example #6
0
 public double getRowCount() {
   return parent.getRowCount();
 }
Example #7
0
 public List<String> getQualifiedName() {
   return parent.getQualifiedName();
 }
Example #8
0
 public Expression getExpression(Class clazz) {
   return parent.getExpression(clazz);
 }
Example #9
0
 public <T> T unwrap(Class<T> clazz) {
   if (clazz.isInstance(this)) {
     return clazz.cast(this);
   }
   return parent.unwrap(clazz);
 }