/** * Check whether this dialect supports another one. * <p> * This is: * <ul> * <li><code>false</code> if dialects don't belong to the same family</li> * <li><code>true</code> if either dialect {@link #isFamily()}</li> * <li><code>true</code> if <code>other</code> dialect precedes this * dialect</li> * </ul> * <p> * The <code>other</code> argument dialect is typically referenced from a * {@link Support} annotation, whereas this dialect is the user dialect. */ public final boolean supports(SQLDialect other) { if (family != other.family) return false; if (isFamily() || other.isFamily()) return true; return other.precedes(this); }
final void toSQLFilterClause(Context<?> ctx) { if (filter != null && ( HSQLDB == ctx.family() || POSTGRES_9_4.precedes(ctx.dialect()))) { ctx.sql(' ') .visit(K_FILTER) .sql(" (") .visit(K_WHERE) .sql(' ') .visit(filter) .sql(')'); } }
final void toSQLArguments1(Context<?> ctx, QueryPartList<QueryPart> args) { if (distinct) { ctx.visit(K_DISTINCT); // [#2883] PostgreSQL can use the DISTINCT keyword with formal row value expressions. if (( ctx.family() == POSTGRES) && args.size() > 1) ctx.sql('('); else ctx.sql(' '); } if (!args.isEmpty()) { if (filter == null || HSQLDB == ctx.family() || POSTGRES_9_4.precedes(ctx.dialect())) { ctx.visit(args); } else { QueryPartList<Field<?>> expressions = new QueryPartList<Field<?>>(); for (QueryPart argument : args) expressions.add(DSL.when(filter, argument == ASTERISK ? one() : argument)); ctx.visit(expressions); } } if (distinct) if (( ctx.family() == POSTGRES) && args.size() > 1) ctx.sql(')'); }
if (POSTGRES_10.precedes(ctx.dialect())) ctx.visit(K_ROW).sql(" ");