in src/main/user-impl/java/com/mysql/cj/jdbc/result/UpdatableResultSet.java [446:518]
private void setParamValue(ClientPreparedStatement ps, int psIdx, Row row, int rsIdx, Field field) throws SQLException {
byte[] val = row.getBytes(rsIdx);
if (val == null) {
ps.setNull(psIdx, MysqlType.NULL);
return;
}
switch (field.getMysqlType()) {
case NULL:
ps.setNull(psIdx, MysqlType.NULL);
break;
case TINYINT:
case TINYINT_UNSIGNED:
case SMALLINT:
case SMALLINT_UNSIGNED:
case MEDIUMINT:
case MEDIUMINT_UNSIGNED:
case INT:
case YEAR:
ps.setInt(psIdx, getInt(rsIdx + 1));
break;
case INT_UNSIGNED:
case BIGINT:
ps.setLong(psIdx, getLong(rsIdx + 1));
break;
case BIGINT_UNSIGNED:
ps.setBigInteger(psIdx, getBigInteger(rsIdx + 1));
break;
case CHAR:
case ENUM:
case SET:
case VARCHAR:
case JSON:
case TINYTEXT:
case TEXT:
case MEDIUMTEXT:
case LONGTEXT:
case DECIMAL:
case DECIMAL_UNSIGNED:
ps.setString(psIdx, getString(rsIdx + 1));
break;
case DATE:
ps.setDate(psIdx, getDate(rsIdx + 1));
break;
case TIMESTAMP:
ps.setObject(psIdx, getObject(rsIdx + 1, Timestamp.class), MysqlType.TIMESTAMP, field.getDecimals());
ps.getQueryBindings().getBinding(psIdx - 1, false).setKeepOrigNanos(true);
break;
case DATETIME:
ps.setObject(psIdx, getObject(rsIdx + 1, LocalDateTime.class), MysqlType.DATETIME, field.getDecimals());
ps.getQueryBindings().getBinding(psIdx - 1, false).setKeepOrigNanos(true);
break;
case TIME:
ps.setTime(psIdx, getTime(rsIdx + 1));
ps.getQueryBindings().getBinding(psIdx - 1, false).setKeepOrigNanos(true);
break;
case DOUBLE:
case DOUBLE_UNSIGNED:
case FLOAT:
case FLOAT_UNSIGNED:
case BOOLEAN:
case BIT:
ps.setBytes(psIdx, val, false);
break;
/*
* default, but also explicitly for following types:
* case Types.BINARY:
* case Types.BLOB:
*/
default:
ps.setBytes(psIdx, val);
break;
}
}