Exemplo 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);
  }
Exemplo n.º 2
0
 // override Object
 public boolean equals(Object obj) {
   if (!(obj instanceof RelColumnOrigin)) {
     return false;
   }
   RelColumnOrigin other = (RelColumnOrigin) obj;
   return Arrays.equals(originTable.getQualifiedName(), other.originTable.getQualifiedName())
       && (iOriginColumn == other.iOriginColumn)
       && (isDerived == other.isDerived);
 }
Exemplo n.º 3
0
 // override Object
 public int hashCode() {
   return Arrays.hashCode(originTable.getQualifiedName()) + iOriginColumn + (isDerived ? 313 : 0);
 }
Exemplo n.º 4
0
 public boolean isKey(BitSet columns) {
   return parent.isKey(columns);
 }
Exemplo n.º 5
0
 public List<RelCollation> getCollationList() {
   return parent.getCollationList();
 }
Exemplo n.º 6
0
 public RelOptSchema getRelOptSchema() {
   return parent.getRelOptSchema();
 }
Exemplo n.º 7
0
 public RelDataType getRowType() {
   return parent.getRowType();
 }
Exemplo n.º 8
0
 public double getRowCount() {
   return parent.getRowCount();
 }
Exemplo n.º 9
0
 public List<String> getQualifiedName() {
   return parent.getQualifiedName();
 }
Exemplo n.º 10
0
 public Expression getExpression(Class clazz) {
   return parent.getExpression(clazz);
 }
Exemplo n.º 11
0
 public <T> T unwrap(Class<T> clazz) {
   if (clazz.isInstance(this)) {
     return clazz.cast(this);
   }
   return parent.unwrap(clazz);
 }