/** * Returns the value as a java.sql.Blob. * This is only supported if the * result set was created using a Blob object. * * @param columnIndex (1,2,...) * @return the value */ @Override public Blob getBlob(int columnIndex) throws SQLException { return (Blob) get(columnIndex); }
/** * Returns the value as an java.sql.Time. * * @param columnIndex (1,2,...) * @return the value */ @Override public Time getTime(int columnIndex) throws SQLException { return (Time) get(columnIndex); }
/** * Returns the value as an java.sql.Timestamp. * * @param columnIndex (1,2,...) * @return the value */ @Override public Timestamp getTimestamp(int columnIndex) throws SQLException { return (Timestamp) get(columnIndex); }
/** * Returns the value as an java.sql.Date. * * @param columnIndex (1,2,...) * @return the value */ @Override public Date getDate(int columnIndex) throws SQLException { return (Date) get(columnIndex); }
/** * Returns the value as an Object. * * @param columnIndex (1,2,...) * @return the value */ @Override public Object getObject(int columnIndex) throws SQLException { return get(columnIndex); }
/** * Returns the value as a java.sql.Clob. * This is only supported if the * result set was created using a Clob object. * * @param columnIndex (1,2,...) * @return the value */ @Override public Clob getClob(int columnIndex) throws SQLException { Clob c = (Clob) get(columnIndex); return c == null ? null : c; }
/** * Returns the value as an double. * * @param columnIndex (1,2,...) * @return the value */ @Override public double getDouble(int columnIndex) throws SQLException { Object o = get(columnIndex); if (o != null && !(o instanceof Number)) { return Double.parseDouble(o.toString()); } return o == null ? 0 : ((Number) o).doubleValue(); }
/** * Returns the value as a java.math.BigDecimal. * * @param columnIndex (1,2,...) * @return the value */ @Override public BigDecimal getBigDecimal(int columnIndex) throws SQLException { Object o = get(columnIndex); if (o != null && !(o instanceof BigDecimal)) { o = new BigDecimal(o.toString()); } return (BigDecimal) o; }
/** * Returns the value as a float. * * @param columnIndex (1,2,...) * @return the value */ @Override public float getFloat(int columnIndex) throws SQLException { Object o = get(columnIndex); if (o != null && !(o instanceof Number)) { return Float.parseFloat(o.toString()); } return o == null ? 0 : ((Number) o).floatValue(); }
/** * Returns the value as a long. * * @param columnIndex (1,2,...) * @return the value */ @Override public long getLong(int columnIndex) throws SQLException { Object o = get(columnIndex); if (o != null && !(o instanceof Number)) { o = Long.decode(o.toString()); } return o == null ? 0 : ((Number) o).longValue(); }
/** * Returns the value as an int. * * @param columnIndex (1,2,...) * @return the value */ @Override public int getInt(int columnIndex) throws SQLException { Object o = get(columnIndex); if (o != null && !(o instanceof Number)) { o = Integer.decode(o.toString()); } return o == null ? 0 : ((Number) o).intValue(); }
/** * Returns the value as a java.sql.Array. * * @param columnIndex (1,2,...) * @return the value */ @Override public Array getArray(int columnIndex) throws SQLException { Object[] o = (Object[]) get(columnIndex); return o == null ? null : new SimpleArray(o); }
/** * Returns the value as a java.io.InputStream. * * @param columnIndex (1,2,...) * @return the value */ @Override public InputStream getBinaryStream(int columnIndex) throws SQLException { return asInputStream(get(columnIndex)); }
/** * Returns the value as a java.io.Reader. * This is only supported if the * result set was created using a Clob or Reader object. * * @param columnIndex (1,2,...) * @return the value */ @Override public Reader getCharacterStream(int columnIndex) throws SQLException { return asReader(get(columnIndex)); }
/** * Returns the value as a byte. * * @param columnIndex (1,2,...) * @return the value */ @Override public byte getByte(int columnIndex) throws SQLException { Object o = get(columnIndex); if (o != null && !(o instanceof Number)) { o = Byte.decode(o.toString()); } return o == null ? 0 : ((Number) o).byteValue(); }
/** * Returns the value as a short. * * @param columnIndex (1,2,...) * @return the value */ @Override public short getShort(int columnIndex) throws SQLException { Object o = get(columnIndex); if (o != null && !(o instanceof Number)) { o = Short.decode(o.toString()); } return o == null ? 0 : ((Number) o).shortValue(); }
/** * Returns the value as a String. * * @param columnIndex (1,2,...) * @return the value */ @Override public String getString(int columnIndex) throws SQLException { Object o = get(columnIndex); if (o == null) { return null; } switch (columns.get(columnIndex - 1).sqlType) { case Types.CLOB: Clob c = (Clob) o; return c.getSubString(1, MathUtils.convertLongToInt(c.length())); } return o.toString(); }
/** * Returns the value as a boolean. * * @param columnIndex (1,2,...) * @return the value */ @Override public boolean getBoolean(int columnIndex) throws SQLException { Object o = get(columnIndex); if (o == null) { return false; } if (o instanceof Boolean) { return (Boolean) o; } if (o instanceof Number) { Number n = (Number) o; if (n instanceof Double || n instanceof Float) { return n.doubleValue() != 0; } if (n instanceof BigDecimal) { return ((BigDecimal) n).signum() != 0; } if (n instanceof BigInteger) { return ((BigInteger) n).signum() != 0; } return n.longValue() != 0; } return Utils.parseBoolean(o.toString(), false, true); }
/** * Returns the value as a byte array. * * @param columnIndex (1,2,...) * @return the value */ @Override public byte[] getBytes(int columnIndex) throws SQLException { Object o = get(columnIndex); if (o == null || o instanceof byte[]) { return (byte[]) o; } if (o instanceof UUID) { return Bits.uuidToBytes((UUID) o); } return JdbcUtils.serialize(o, null); }
/** * Returns the value as a String. * * @return the value */ public String getString(int columnIndex) throws SQLException { Object o = get(columnIndex); return o == null ? null : o.toString(); }