org.jooq.impl.DefaultDataType Java Examples
The following examples show how to use
org.jooq.impl.DefaultDataType.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ColumnDefinition.java From java-crud-api with MIT License | 6 votes |
public DataType<?> getDataType(DSLContext dsl) { override(dsl); DataType<?> result = DefaultDataType.getDataType(SQLDialect.DEFAULT, type); if (result.isNumeric() && !result.hasScale()) { result = result.identity(pk); } if (length >= 0) { result = result.length(length); } if (precision >= 0) { result = result.precision(precision); } if (scale >= 0) { result = result.scale(scale); } result = result.nullable(nullable); return result; }
Example #2
Source File: ColumnDefinition.java From java-crud-api with MIT License | 6 votes |
public ColumnDefinition(Field<?> field) { DataType<?> dataType = field.getDataType(); setPk(dataType.identity()); DataType<?> defaultType = dataType.getSQLDataType(); if (defaultType == null) { defaultType = DefaultDataType.getDefaultDataType(dataType.getTypeName()); } setType(defaultType.getTypeName()); if (dataType.hasLength()) { setLength(dataType.length()); } if (dataType.hasPrecision()) { setPrecision(dataType.precision()); } if (dataType.hasScale()) { setScale(dataType.scale()); } setNullable(dataType.nullable()); }
Example #3
Source File: TemplateQueryGenerator.java From ingestion with Apache License 2.0 | 6 votes |
public TemplateQueryGenerator(final SQLDialect sqlDialect, final String sql) { final Matcher m = PARAMETER_PATTERN.matcher(sql); parameters = new ArrayList<Parameter>(); while (m.find()) { final String part = m.group("part").toUpperCase(Locale.ENGLISH); final String header = m.group("header"); final String type = m.group("type").toUpperCase(Locale.ENGLISH); DataType<?> dataType = DefaultDataType.getDataType(sqlDialect, type); if (BODY.equals(part)) { if (header != null) { throw new IllegalArgumentException("BODY parameter must have no header name specifier (${body:" + type + "}, not (${body." + header + ":" + type + "}"); } } final Parameter parameter = new Parameter(header, dataType); parameters.add(parameter); log.trace("Parameter: {}", parameter); } this.sql = m.replaceAll("?"); log.debug("Generated SQL: {}", this.sql); }
Example #4
Source File: SpatialDSL.java From java-crud-api with MIT License | 5 votes |
public static void registerDataTypes(DSLContext dsl) { SQLDialect dialect = dsl.dialect(); switch (dialect.family().toString()) { case "MYSQL": case "POSTGRES": case "SQLSERVER": DefaultDataType.getDefaultDataType(SQLDialect.DEFAULT, "geometry"); break; } }
Example #5
Source File: JooqMapperBuilder.java From SimpleFlatMapper with MIT License | 4 votes |
protected FakeField(String name) { super(name, new DefaultDataType<Object>(SQLDialect.DEFAULT, Object.class, "varchar")); }