Package de.fuberlin.wiwiss.d2rq

Examples of de.fuberlin.wiwiss.d2rq.D2RQException


  public DatabaseSchemaInspector(ConnectedDB db) {
    this.db = db;
    try {
      this.schema = db.connection().getMetaData();
    } catch (SQLException ex) {
      throw new D2RQException("Database exception", ex, D2RQException.D2RQ_SQLEXCEPTION);
    }
  }
View Full Code Here


    try {
      ResultSet rs = this.schema.getColumns(null, column.schemaName(),
          column.tableName(), column.attributeName());
      try {
        if (!rs.next()) {
          throw new D2RQException("Column " + column + " not found in database",
              D2RQException.SQL_COLUMN_NOT_FOUND);
        }
        int type = rs.getInt("DATA_TYPE");
        String name = rs.getString("TYPE_NAME").toUpperCase();
        int size = rs.getInt("COLUMN_SIZE");
        DataType result = db.vendor().getDataType(type, name, size);
        if (result == null) {
          log.warn("Unknown datatype '" + (size == 0 ? name : (name + "(" + size + ")")) + "' (" + type + ")");
        }
        return result;
      } finally {
        rs.close();
      }
    } catch (SQLException ex) {
      throw new D2RQException("Database exception", ex, D2RQException.D2RQ_SQLEXCEPTION);
    }
  }
View Full Code Here

  public boolean isNullable(Attribute column) {
    try {
      ResultSet rs = this.schema.getColumns(null, column.schemaName(),
          column.tableName(), column.attributeName());
      if (!rs.next()) {
        throw new D2RQException("Column " + column + " not found in database",
            D2RQException.SQL_COLUMN_NOT_FOUND);
      }
      boolean nullable = (rs.getInt("NULLABLE") == DatabaseMetaData.columnNullable);
      rs.close();
      return nullable;
    } catch (SQLException ex) {
      throw new D2RQException("Database exception", ex, D2RQException.D2RQ_SQLEXCEPTION);
    }
  }
View Full Code Here

      stmt.close();     

      if (foundColumn)
        return isZerofill; 
    } catch (SQLException ex) {
      throw new D2RQException("Database exception", ex, D2RQException.D2RQ_SQLEXCEPTION);
    }
    throw new D2RQException("Column not found in DESCRIBE result: " + column,
        D2RQException.SQL_COLUMN_NOT_FOUND);
  }
View Full Code Here

        }
      }
      rs.close();
      return result;
    } catch (SQLException ex) {
      throw new D2RQException("Database exception", ex);
    }
  }
View Full Code Here

        result.add(new Attribute(tableName, rs.getString("COLUMN_NAME")));
      }
      rs.close();
      return result;
    } catch (SQLException ex) {
      throw new D2RQException("Database exception", ex, D2RQException.D2RQ_SQLEXCEPTION);
    }
  }
View Full Code Here

        result.add(new Attribute(tableName, rs.getString("COLUMN_NAME")));
      }
      rs.close();
      return result;
    } catch (SQLException ex) {
      throw new D2RQException("Database exception", ex, D2RQException.D2RQ_SQLEXCEPTION);
    }
  }
View Full Code Here

        }
      }
      rs.close();
      return result;
    } catch (SQLException ex) {
      throw new D2RQException("Database exception (unable to determine unique columns)",
          ex, D2RQException.D2RQ_SQLEXCEPTION);
    }
  } 
View Full Code Here

        ForeignKey fk = (ForeignKey) it.next();
        results.add(fk.toJoin());
      }
      return results;
    } catch (SQLException ex) {
      throw new D2RQException("Database exception", ex, D2RQException.D2RQ_SQLEXCEPTION);
    }
  } 
View Full Code Here

      }
      BeanCounter.totalNumberOfReturnedRows++;
      BeanCounter.totalNumberOfReturnedFields+=this.numCols;
      prefetchedRow = ResultRowMap.fromResultSet(resultSet, columns, database);
    } catch (SQLException ex) {
      throw new D2RQException(ex);
    }
  }
View Full Code Here

TOP

Related Classes of de.fuberlin.wiwiss.d2rq.D2RQException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.