use of org.jkiss.dbeaver.model.data.DBDComposite in project dbeaver by serge-rider.
the class PostgreStructValueHandler method bindParameter.
@Override
protected void bindParameter(JDBCSession session, JDBCPreparedStatement statement, DBSTypedObject paramType, int paramIndex, Object value) throws DBCException, SQLException {
if (value == null) {
statement.setNull(paramIndex, Types.STRUCT);
} else if (value instanceof DBDComposite) {
DBDComposite struct = (DBDComposite) value;
if (struct.isNull()) {
statement.setNull(paramIndex, Types.STRUCT);
} else if (struct instanceof JDBCComposite) {
final Object[] values = ((JDBCComposite) struct).getValues();
final String string = PostgreUtils.generateObjectString(values);
statement.setObject(paramIndex, string, Types.OTHER);
}
} else {
throw new DBCException("Struct parameter type '" + value.getClass().getName() + "' not supported");
}
}
Aggregations