@Override public final void writeSQL(SQLOutput stream) throws SQLException { for (Field<?> field : getUDT().fields()) { setValue(stream, field); } }
@Override public String toString() { StringBuilder result = new StringBuilder(); String separator = ""; result.append(create().render(getUDT())); result.append("("); Object[] array = intoArray(); // [#3046] array can be null if custom RecordMapperProviders (illegally) return null if (array != null) { for (Object o : array) { result.append(separator); result.append(o); separator = ", "; } } result.append(")"); return result.toString(); } }
@Override public final String getSQLTypeName() throws SQLException { StringBuilder sb = new StringBuilder(); // [#1693] This needs to return the fully qualified SQL type name, in // case the connected user is not the owner of the UDT Configuration configuration = localConfiguration(); if (configuration != null) { Schema schema = Utils.getMappedSchema(configuration, getUDT().getSchema()); if (schema != null) { sb.append(schema.getName()); sb.append("."); } } sb.append(getUDT().getName()); return sb.toString(); }
@Override public final void readSQL(SQLInput stream, String typeName) throws SQLException { Configuration configuration = localConfiguration(); for (Field<?> field : getUDT().fields()) { setValue(configuration, stream, field); } }
@SuppressWarnings({ "rawtypes", "unchecked" }) @Override public final void writeSQL(SQLOutput stream) throws SQLException { Configuration configuration = localConfiguration(); Map<Object, Object> data = localData(); Field<?>[] f = getUDT().fields(); for (int i = 0; i < f.length; i++) { Field field = f[i]; field.getBinding().set(new DefaultBindingSetSQLOutputContext(configuration, data, stream, get(i))); } }
@SuppressWarnings({ "rawtypes", "unchecked" }) @Override public final void readSQL(SQLInput stream, String typeName) throws SQLException { Configuration configuration = localConfiguration(); Map<Object, Object> data = localData(); Field<?>[] f = getUDT().fields(); for (int i = 0; i < f.length; i++) { Field field = f[i]; DefaultBindingGetSQLInputContext out = new DefaultBindingGetSQLInputContext(configuration, data, stream); field.getBinding().get(out); set(i, field, out.value()); } }