/** * The {@link Types#NUMERIC} type. */ public static final DataType<BigDecimal> NUMERIC(int precision, int scale) { return NUMERIC.precision(precision, scale); }
/** * The {@link Types#NUMERIC} type. */ public static final DataType<BigDecimal> NUMERIC(int precision) { return NUMERIC.precision(precision); }
/** * The {@link Types#TIME} type. */ public static final DataType<Time> TIME(int precision) { return TIME.precision(precision); }
/** * The {@link Types#DECIMAL} type. */ public static final DataType<BigDecimal> DECIMAL(int precision) { return DECIMAL.precision(precision); }
/** * The {@link Types#TIMESTAMP} type. */ public static final DataType<Timestamp> TIMESTAMP(int precision) { return TIMESTAMP.precision(precision); }
/** * The {@link Types#DECIMAL} type. */ public static final DataType<BigDecimal> DECIMAL(int precision, int scale) { return DECIMAL.precision(precision, scale); }
/** * The {@link Types#TIME_WITH_TIMEZONE} type. * <p> * An alias for {@link #OFFSETTIME} */ public static final DataType<OffsetTime> TIMEWITHTIMEZONE(int precision) { return TIMEWITHTIMEZONE.precision(precision); }
/** * The {@link Types#TIMESTAMP_WITH_TIMEZONE} type. * <p> * An alias for {@link #OFFSETDATETIME} */ public static final DataType<OffsetDateTime> TIMESTAMPWITHTIMEZONE(int precision) { return TIMESTAMPWITHTIMEZONE.precision(precision); }
public DataType<T> precision(int precision) { return dataType.precision(precision); }
public int precision() { return dataType.precision(); }
public DataType<T> precision(int precision, int scale) { return dataType.precision(precision, scale); }
private static final DataType<?> parseDataTypePrecisionScale(ParserContext ctx, DataType<?> result) { if (parseIf(ctx, '(')) { int precision = (int) (long) parseUnsignedInteger(ctx); if (parseIf(ctx, ',')) result = result.precision(precision, (int) (long) parseUnsignedInteger(ctx)); else result = result.precision(precision); parse(ctx, ')'); } return result; }
private static final DataType<?> parseDataTypePrecision(ParserContext ctx, DataType<?> result) { if (parseIf(ctx, '(')) { int precision = (int) (long) parseUnsignedInteger(ctx); result = result.precision(precision); parse(ctx, ')'); } return result; }
private final DataType<?> type(String typeName, int length, int precision, int scale, boolean nullable) { DataType<?> type = null; try { type = DefaultDataType.getDataType(configuration.family(), typeName); type = type.nullable(nullable); if (length != 0) type = type.length(length); else if (precision != 0 || scale != 0) type = type.precision(precision, scale); } catch (SQLDialectNotSupportedException e) { type = SQLDataType.OTHER; } return type; }
public DefaultDataType(SQLDialect dialect, DataType<T> sqlDataType, String typeName) { this(dialect, sqlDataType, sqlDataType.getType(), typeName, typeName, sqlDataType.precision(), sqlDataType.scale(), sqlDataType.length(), sqlDataType.nullability(), sqlDataType.defaultValue()); }
public DefaultDataType(SQLDialect dialect, DataType<T> sqlDataType, String typeName, String castTypeName) { this(dialect, sqlDataType, sqlDataType.getType(), typeName, castTypeName, sqlDataType.precision(), sqlDataType.scale(), sqlDataType.length(), sqlDataType.nullability(), sqlDataType.defaultValue()); }
@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(")"); }
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(')'); }
private static final void exportSequences0(Configuration configuration, InformationSchema result, Sequence<?> q) { org.jooq.util.xml.jaxb.Sequence iq = new org.jooq.util.xml.jaxb.Sequence(); if (!StringUtils.isBlank(q.getCatalog().getName())) iq.setSequenceCatalog(q.getCatalog().getName()); if (!StringUtils.isBlank(q.getSchema().getName())) iq.setSequenceSchema(q.getSchema().getName()); iq.setSequenceName(q.getName()); iq.setDataType(q.getDataType().getTypeName(configuration)); if (q.getDataType().hasLength()) iq.setCharacterMaximumLength(q.getDataType().length()); if (q.getDataType().hasPrecision()) iq.setNumericPrecision(q.getDataType().precision()); if (q.getDataType().hasScale()) iq.setNumericScale(q.getDataType().scale()); result.getSequences().add(iq); }