in pulsar-io/jdbc/core/src/main/java/org/apache/pulsar/io/jdbc/BaseJdbcAutoSchemaSink.java [89:110]
private static void setColumnValue(PreparedStatement statement, int index, Object value) throws Exception {
log.debug("Setting column value, statement: {}, index: {}, value: {}", statement.toString(), index, value.toString());
if (value instanceof Integer) {
statement.setInt(index, (Integer) value);
} else if (value instanceof Long) {
statement.setLong(index, (Long) value);
} else if (value instanceof Double) {
statement.setDouble(index, (Double) value);
} else if (value instanceof Float) {
statement.setFloat(index, (Float) value);
} else if (value instanceof Boolean) {
statement.setBoolean(index, (Boolean) value);
} else if (value instanceof String) {
statement.setString(index, (String)value);
} else if (value instanceof Short) {
statement.setShort(index, (Short) value);
} else {
throw new Exception("Not support value type, need to add it. " + value.getClass());
}
}