コード例 #1
0
  @Override
  protected void configureColumnType(Column column, ResultSet rs) throws SQLException {
    if (integerList.contains(column.getTable().getName() + "." + column.getName())) {
      column.setDataType(Types.INTEGER);
    } else {
      column.setDataType(rs.getInt("DATA_TYPE"));
    }
    column.setColumnSize(rs.getInt("COLUMN_SIZE"));
    column.setDecimalDigits(rs.getInt("DECIMAL_DIGITS"));

    // Set true, if precision should be initialize
    column.setInitPrecision(
        !((column.getDataType() == Types.DECIMAL
                || column.getDataType() == Types.NUMERIC
                || column.getDataType() == Types.REAL)
            && rs.getString("DECIMAL_DIGITS") == null));
  }
コード例 #2
0
  /** Oracle specific implementation */
  @Override
  protected void getColumnTypeAndDefValue(Column columnInfo, ResultSet rs, Database database)
      throws SQLException, DatabaseException {
    super.getColumnTypeAndDefValue(columnInfo, rs, database);

    // Exclusive setting for oracle INTEGER type
    // Details:
    // INTEGER means NUMBER type with 'data_precision IS NULL and scale = 0'
    if (columnInfo.getDataType() == Types.INTEGER) {
      columnInfo.setTypeName("INTEGER");
    }

    String columnTypeName = rs.getString("TYPE_NAME");
    if ("VARCHAR2".equals(columnTypeName)) {
      int charOctetLength = rs.getInt("CHAR_OCTET_LENGTH");
      int columnSize = rs.getInt("COLUMN_SIZE");
      if (columnSize == charOctetLength) {
        columnInfo.setLengthSemantics(Column.LengthSemantics.BYTE);
      } else {
        columnInfo.setLengthSemantics(Column.LengthSemantics.CHAR);
      }
    }
  }