@Override public String getCastTypeName(Configuration configuration) { return delegate.getCastTypeName(configuration); }
public String getCastTypeName(Configuration configuration) { return dataType.getCastTypeName(configuration); }
@Override public String getCastTypeName(Configuration configuration) { return delegate.getCastTypeName(configuration); }
public String getCastTypeName() { return dataType.getCastTypeName(); }
@Override public final String getCastTypeName(Configuration configuration) { String castTypeName = elementType.getCastTypeName(configuration); return getArrayType(configuration, castTypeName); }
@Override public final String getCastTypeName(Configuration configuration) { String castTypeName = elementType.getCastTypeName(configuration); return getArrayType(configuration, castTypeName); }
@Override public String getCastTypeName(Configuration configuration) { return getDataType(configuration).getCastTypeName(); }
@Override public String getCastTypeName(Configuration configuration) { return getDataType(configuration).getCastTypeName(); }
public ArrayDataType(DataType<T> elementType) { super(null, elementType.getArrayType(), elementType.getTypeName(), elementType.getCastTypeName()); this.elementType = elementType; }
public ArrayDataType(DataType<T> elementType) { super(null, elementType.getArrayType(), elementType.getTypeName(), elementType.getCastTypeName()); this.elementType = elementType; }
ConvertedDataType(DataType<T> delegate, Converter<? super T, U> converter) { super(null, converter.toType(), delegate.getTypeName(), delegate.getCastTypeName()); this.delegate = delegate; this.converter = converter; DataTypes.registerConverter(converter.toType(), converter); }
@Override final void sqlBind0(BindingSQLContext<U> ctx, Object[] value) throws SQLException { super.sqlBind0(ctx, value); // In Postgres, some additional casting must be done in some cases... switch (ctx.family()) { case POSTGRES: // Postgres needs explicit casting for enum (array) types if (EnumType.class.isAssignableFrom(type.getComponentType())) DefaultEnumTypeBinding.pgRenderEnumCast(ctx.render(), type); // ... and also for other array types else ctx.render().sql("::") .sql(DefaultDataType.getDataType(ctx.family(), type).getCastTypeName(ctx.render().configuration())); } }
@SuppressWarnings("unchecked") ConvertedDataType(DataType<T> delegate, Binding<? super T, U> binding) { super( null, binding.converter().toType(), binding, delegate.getTypeName(), delegate.getCastTypeName(), delegate.precision(), delegate.scale(), delegate.length(), delegate.nullability(), (Field<U>) delegate.defaultValue() ); this.delegate = delegate; }
private final void toSQLCast(RenderContext context, DataType<?> type, int length, int precision, int scale) { context.keyword("cast").sql("("); toSQL(context, value, getType()); context.sql(" ").keyword("as").sql(" ") .sql(type.length(length).precision(precision, scale).getCastTypeName(context.configuration())) .sql(")"); }
@Override final void sqlInline0(BindingSQLContext<U> ctx, Float value) { // [#5249] [#6912] [#8063] Special inlining of special floating point values if (value.isNaN()) if ( ctx.family() == POSTGRES) ctx.render().visit(inline("NaN")).sql("::float4"); else if (ctx.family() == HSQLDB) ctx.render().visit(sqrt(inline(-1))); else ctx.render().visit(K_CAST).sql('(').visit(inline("NaN")).sql(' ').visit(K_AS).sql(' ').visit(keyword(DOUBLE.getCastTypeName(ctx.configuration()))).sql(')'); else ctx.render().sql(value.toString()); }
@Override final void sqlInline0(BindingSQLContext<U> ctx, Double value) { // [#5249] [#6912] [#8063] Special inlining of special floating point values if (value.isNaN()) if ( ctx.family() == POSTGRES) ctx.render().visit(inline("NaN")).sql("::float8"); else if (ctx.family() == HSQLDB) ctx.render().visit(sqrt(inline(-1))); else ctx.render().visit(K_CAST).sql('(').visit(inline("NaN")).sql(' ').visit(K_AS).sql(' ').visit(keyword(DOUBLE.getCastTypeName(ctx.configuration()))).sql(')'); else ctx.render().sql(value.toString()); }
@Override protected String getCreateDocPartTableStatement(String schemaName, String tableName, Collection<InternalField<?>> fields) { SqlBuilder sb = new MySqlBuilder("CREATE TABLE "); sb.table(schemaName, tableName) .append(" ("); if (!fields.isEmpty()) { for (InternalField<?> field : fields) { sb.quote(field.getName()).append(' ') .append(field.getDataType().getCastTypeName()); if (!field.isNullable()) { sb.append(" NOT NULL"); } sb.append(','); } sb.setLastChar(')'); } else { sb.append(')'); } return sb.toString(); }
private final void sqlCast(BindingSQLContext<U> ctx, T converted, DataType<?> dataType, int length, int precision, int scale) throws SQLException { ctx.render().visit(K_CAST).sql('('); sql(ctx, converted); ctx.render().sql(' ').visit(K_AS).sql(' ') .sql(dataType.length(length).precision(precision, scale).getCastTypeName(ctx.configuration())) .sql(')'); }
context.sql(getBindVariable(context)); context.sql("::"); context.keyword(DefaultDataType.getDataType(family, type).getCastTypeName(context.configuration()));
String castTypeName = type.getCastTypeName(ctx.configuration());