@Override public void compactInternally(final TableReference tableRef) { if (sqlDialect.family() == SQLDialect.POSTGRES) { run((Function<DSLContext, Void>) ctx -> { ctx.execute("VACUUM ANALYZE " + tableName(tableRef)); return null; }); } }
@Override public String translate(SQLDialect dialect) { switch (dialect.family()) { case DERBY: case SQLITE: return "length"; } return "char_length"; } },
@Override public String translate(SQLDialect dialect) { switch (dialect.family()) { case HSQLDB: return "rownum"; } return "row_number"; } },
TableLike<?> values(DSLContext ctx, RowN[] rows, String tableName, String... fieldNames) { switch (sqlDialect.family()) { case H2: List<SelectField<?>> fields = Lists.newArrayListWithCapacity(fieldNames.length); for (int i = 1; i <= fieldNames.length; i++) { fields.add(DSL.field("C" + i).as(fieldNames[i-1])); } RenderContext context = ctx.renderContext(); context.start(TABLE_VALUES) .keyword("values") .formatIndentLockStart(); boolean firstRow = true; for (Row row : rows) { if (!firstRow) { context.sql(',').formatSeparator(); } context.sql(row.toString()); firstRow = false; } context.formatIndentLockEnd() .end(TABLE_VALUES); String valuesClause = context.render(); return ctx.select(fields).from(valuesClause).asTable(tableName); default: return DSL.values(rows).as(tableName, fieldNames); } }
@Override final QueryPart getFunction0(Configuration configuration) { switch (configuration.dialect().family()) { default: return new Native(); } }
@Override final QueryPart getFunction0(Configuration configuration) { switch (configuration.dialect().family()) { default: return new Native(); } }
@Override final QueryPart getFunction0(Configuration configuration) { switch (configuration.dialect().family()) { /* [pro] xx xxxx xxxxxxx xxxxxx xxx xxxxxxxxx xx [/pro] */ default: return new Native(); } }
@Override public String getJavaIdentifier(Definition definition) { String identifier = getFixedJavaIdentifier(definition); if (identifier != null) return identifier; // [#6307] Some databases work with per-table namespacing for indexes, not per-schema namespacing. // In order to have non-ambiguous identifiers, we need to include the table name. else if (definition instanceof IndexDefinition && asList(MYSQL, MARIADB).contains(definition.getDatabase().getDialect().family())) return ((IndexDefinition) definition).getTable().getOutputName().toUpperCase() + "_" + definition.getOutputName().toUpperCase(); else return definition.getOutputName().toUpperCase(); }
@Override final QueryPart getFunction0(Configuration configuration) { switch (configuration.dialect().family()) { default: return DSL.field("{nullif}({0}, {1})", getDataType(), arg1, arg2); } } }
@Override final QueryPart getFunction0(Configuration configuration) { switch (configuration.dialect().family()) { default: return DSL.field("{atan}({0})", getDataType(), arg); } } }
@Override final QueryPart getFunction0(Configuration configuration) { switch (configuration.dialect().family()) { default: return DSL.field("{asin}({0})", getDataType(), arg); } } }
@Override final QueryPart getFunction0(Configuration configuration) { switch (configuration.dialect().family()) { /* [pro] xx xxxx xxxxxxx xxxxxx xxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxx xxxxx xx [/pro] */ default: return field("{atan}({0})", getDataType(), arg); } } }
private final void toSQLAssign(RenderContext context) { switch (context.configuration().dialect().family()) { /* [pro] xx xxxx xxxxxxx xxxxxxxxxxxxxx xx xxx xxxxxx xx [/pro] */ default: context.sql("? = "); break; } }
@Override final QueryPart getFunction0(Configuration configuration) { switch (configuration.dialect().family()) { /* [pro] xx xxxx xxxxxxx xxxxxx xxxxxxxxxxxxxxxxxxxx x xxxx xxxxx xxxxxx xxxxxxxxxxxxxx xxxxx xxxxxx xx [/pro] */ default: return DSL.field("{nullif}({0}, {1})", getDataType(), arg1, arg2); } } }
private QueryPart delegate(Configuration configuration) { switch (configuration.dialect().family().toString()) { case "MYSQL": case "POSTGRES": return DSL.field("ST_IsSimple({0})", Boolean.class, field); case "SQLSERVER": return DSL.field("{0}.STIsSimple()", Boolean.class, field); default: throw new UnsupportedOperationException("Dialect not supported"); } } }
private QueryPart delegate(Configuration configuration) { switch (configuration.dialect().family().toString()) { case "MYSQL": case "POSTGRES": return DSL.field("ST_Disjoint({0}, {1})", Boolean.class, field1, field2); case "SQLSERVER": return DSL.field("{0}.STDisjoint({1})", Boolean.class, field1, field2); default: throw new UnsupportedOperationException("Dialect not supported"); } } }
private QueryPart delegate(Configuration configuration) { switch (configuration.dialect().family().toString()) { case "MYSQL": case "POSTGRES": return DSL.field("ST_GeomFromText({0})", byte[].class, field); case "SQLSERVER": return DSL.field("{0}.STGeomFromText(0)", byte[].class, field); default: throw new UnsupportedOperationException("Dialect not supported"); } }
private QueryPart delegate(Configuration configuration) { switch (configuration.dialect().family().toString()) { case "MYSQL": case "POSTGRES": return DSL.field("ST_IsClosed({0})", Boolean.class, field); case "SQLSERVER": return DSL.field("{0}.STIsClosed()", Boolean.class, field); default: throw new UnsupportedOperationException("Dialect not supported"); } } }
@Override final Field<T> getFunction0(Configuration configuration) { switch (configuration.dialect().family()) { case SQLITE: return new Expression<T>(MODULO, arg1, arg2); } return function("mod", getDataType(), arg1, arg2); } }
@Override final Field<T> getFunction0(Configuration configuration) { switch (configuration.dialect().family()) { case H2: case HSQLDB: return DSL.field("{nvl2}({0}, {1}, {2})", getDataType(), arg1, arg2, arg3); default: return DSL.when(arg1.isNotNull(), arg2).otherwise(arg3); } } }