private Value convertToUnknownValue(Object x) { checkClosed(); return DataType.convertToValue(x, Value.UNKNOWN); }
Value[] values = new Value[len]; for (int i = 0; i < len; i++) { values[i] = DataType.convertToValue(list[i], Value.NULL);
/** * Sets the value of a parameter. * Objects of unknown classes are serialized (on the client side). * * @param parameterIndex the parameter index (1, 2, ...) * @param x the value * @throws SQLException if this object is closed */ @Override public void setObject(int parameterIndex, Object x) throws SQLException { try { if (isDebugEnabled()) { debugCode("setObject(" + parameterIndex + ", x);"); } if (x == null) { // throw Errors.getInvalidValueException("null", "x"); setParameter(parameterIndex, ValueNull.INSTANCE); } else { setParameter(parameterIndex, DataType.convertToValue(x, Value.UNKNOWN)); } } catch (Exception e) { throw logAndConvert(e); } }
Value[] v = new Value[len]; for (int i = 0; i < len; i++) { v[i] = convertToValue(o[i], type);
/** * Sets the value of a parameter. The object is converted, if required, to * the specified data type before sending to the database. * Objects of unknown classes are serialized (on the client side). * * @param parameterIndex the parameter index (1, 2, ...) * @param x the value, null is allowed * @param targetSqlType the type as defined in java.sql.Types * @throws SQLException if this object is closed */ @Override public void setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException { try { if (isDebugEnabled()) { debugCode("setObject(" + parameterIndex + ", x, " + targetSqlType + ");"); } int type = DataType.convertSQLTypeToValueType(targetSqlType); if (x == null) { setParameter(parameterIndex, ValueNull.INSTANCE); } else { Value v = DataType.convertToValue(x, type); setParameter(parameterIndex, v.convertTo(type)); } } catch (Exception e) { throw logAndConvert(e); } }