protected void setObject(PreparedStatement statement, int i, Object value) throws SQLException { try { if (value instanceof InParameter) { InParameter p = (InParameter) value; if (p.getType() == Types.BLOB && p.getValue() instanceof InputStream) { statement.setBlob(i, (InputStream) p.getValue()); return; } if (p.getType() == Types.CLOB && p.getValue() instanceof Reader) { statement.setClob(i, (Reader) p.getValue()); return; } if (p.getType() == Types.DATE && p.getValue() instanceof java.util.Date && !(p.getValue() instanceof java.sql.Date)) { statement.setDate(i, new java.sql.Date(((java.util.Date) p.getValue()).getTime())); return; } if (p.getType() == Types.TIMESTAMP && p.getValue() instanceof java.util.Date && !(p.getValue() instanceof java.sql.Timestamp)) { statement.setTimestamp(i, new java.sql.Timestamp(((java.util.Date) p.getValue()).getTime())); return; } } if (value instanceof GString) { value = value.toString(); } super.setObject(statement, i, value); } catch (Exception e) { throw new SQLException("Can't set a parameter #" + i + " to value type " + (value == null ? "null" : value.getClass().getName()) + ": " + e.getMessage(), e); } } }
public Object getValue() { return in.getValue(); } };
public int getType() { return in.getType(); }
if (value instanceof InParameter) { InParameter in = (InParameter) value; Object val = in.getValue(); if (null == val) { statement.setNull(i, in.getType());
public int getType() { return in.getType(); }
public Object getValue() { return in.getValue(); } };
public int getType() { return in.getType(); }
public Object getValue() { return in.getValue(); } };
public int getType() { return in.getType(); }
/** * Strategy method allowing derived classes to handle types differently * such as for CLOBs etc. * * @throws SQLException if a database access error occurs */ protected void setObject(PreparedStatement statement, int i, Object value) throws SQLException { if (value instanceof InParameter || value instanceof OutParameter) { if (value instanceof InParameter) { InParameter in = (InParameter) value; Object val = in.getValue(); if (null == val) { statement.setNull(i, in.getType()); } else { statement.setObject(i, val, in.getType()); } } if (value instanceof OutParameter) { try { OutParameter out = (OutParameter) value; ((CallableStatement) statement).registerOutParameter(i, out.getType()); } catch (ClassCastException e) { throw new SQLException("Cannot register out parameter."); } } } else { statement.setObject(i, value); } }
public Object getValue() { return in.getValue(); } };
public int getType() { return in.getType(); }
public Object getValue() { return in.getValue(); } };
public int getType() { return in.getType(); }
public Object getValue() { return in.getValue(); } };