Package net.sourceforge.squirrel_sql.plugins.dataimport.importer

Examples of net.sourceforge.squirrel_sql.plugins.dataimport.importer.UnsupportedFormatException


   */
  public Integer getInt(int column) throws IOException, UnsupportedFormatException {
    checkPointer();
    Cell cell = sheet.getCell(column, pointer);
    if (cell.getType() != CellType.NUMBER) {
      throw new UnsupportedFormatException();
    }
    return (new Double(((NumberCell) cell).getValue())).intValue();
  }
View Full Code Here


   */
  public Date getDate(int column) throws IOException, UnsupportedFormatException {
    checkPointer();
    Cell cell = sheet.getCell(column, pointer);
    if (cell.getType() != CellType.DATE) {
      throw new UnsupportedFormatException();
    }
    return ((DateCell) cell).getDate();
  }
View Full Code Here

   */
  public Long getLong(int column) throws IOException, UnsupportedFormatException {
    checkPointer();
    Cell cell = sheet.getCell(column, pointer);
    if (cell.getType() != CellType.NUMBER) {
      throw new UnsupportedFormatException();
    }
    return (new Double(((NumberCell) cell).getValue())).longValue();
  }
View Full Code Here

      long value = 0;
      try {
        value = Long.parseLong(getFixedValue(column));
        value += counter;
      } catch (NumberFormatException nfe) {
        throw new UnsupportedFormatException();
      }
      switch (column.getDataType()) {
      case Types.BIGINT:
         stmt.setLong(index, value);
        break;
      case Types.INTEGER:
      case Types.NUMERIC:
         stmt.setInt(index, (int)value);
        break;
      default:
        throw new UnsupportedFormatException();
      }
  }
View Full Code Here

      switch (column.getDataType()) {
      case Types.BIGINT:
        try {
          stmt.setLong(index, Long.parseLong(value));
        } catch (NumberFormatException nfe) {
          throw new UnsupportedFormatException();
        }
        break;
      case Types.INTEGER:
      case Types.NUMERIC:
        setIntOrUnsignedInt(stmt, index, column);
View Full Code Here

  private void setDateOrNull(PreparedStatement stmt, int index,
      String value) throws UnsupportedFormatException, SQLException {
    if (null != value) {
      Date d = DateUtils.parseSQLFormats(value);
      if (d == null)
        throw new UnsupportedFormatException();
      stmt.setDate(index, new java.sql.Date(d.getTime()));
    } else {
      stmt.setNull(index, Types.DATE);
    }
  }
View Full Code Here

  private void setTimeStampOrNull(PreparedStatement stmt, int index,
      String value) throws UnsupportedFormatException, SQLException {
    if (null != value) {
      Date d = DateUtils.parseSQLFormats(value);
      if (d == null)
        throw new UnsupportedFormatException();
      stmt.setTimestamp(index, new java.sql.Timestamp(d.getTime()));
    } else {
      stmt.setNull(index, Types.TIMESTAMP);
    }
  }
View Full Code Here

  private void setTimeOrNull(PreparedStatement stmt, int index, String value)
      throws UnsupportedFormatException, SQLException {
    if (null != value) {
      Date d = DateUtils.parseSQLFormats(value);
      if (d == null)
        throw new UnsupportedFormatException();
      stmt.setTime(index, new java.sql.Time(d.getTime()));
    } else {
      stmt.setNull(index, Types.TIME);
    }
  }
View Full Code Here

      if (null == longS || 0 == longS.trim().length()){
        return null;
      }       
      return Long.parseLong(longS);
    } catch (NumberFormatException nfe) {
      throw new UnsupportedFormatException();
    }
  }
View Full Code Here

      if (null == intS || 0 == intS.trim().length()){
        return null;
      }
      return Integer.parseInt(intS);
    } catch (NumberFormatException nfe) {
      throw new UnsupportedFormatException(nfe);
    }
  }
View Full Code Here

TOP

Related Classes of net.sourceforge.squirrel_sql.plugins.dataimport.importer.UnsupportedFormatException

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.