[jOOQ/jOOQ#10313] SQLDialect.supportedBy() sets should be used with
contains(dialect()), not contains(family())
This commit is contained in:
parent
cf84aa6757
commit
aa2afc3b23
@ -127,7 +127,7 @@ implements
|
||||
ctx.visit(K_DISTINCT).sql(' ');
|
||||
|
||||
// [#2883][#9109] PostgreSQL and H2 can use the DISTINCT keyword with formal row value expressions.
|
||||
if (args.size() > 1 && SUPPORT_DISTINCT_RVE.contains(ctx.family()))
|
||||
if (args.size() > 1 && SUPPORT_DISTINCT_RVE.contains(ctx.dialect()))
|
||||
ctx.sql('(');
|
||||
}
|
||||
|
||||
@ -146,7 +146,7 @@ implements
|
||||
}
|
||||
|
||||
if (distinct)
|
||||
if (args.size() > 1 && SUPPORT_DISTINCT_RVE.contains(ctx.family()))
|
||||
if (args.size() > 1 && SUPPORT_DISTINCT_RVE.contains(ctx.dialect()))
|
||||
ctx.sql(')');
|
||||
}
|
||||
|
||||
|
||||
@ -127,7 +127,7 @@ implements
|
||||
// [#3727] Referenced WindowDefinitions that contain a frame clause
|
||||
// shouldn't be referenced from within parentheses (in MySQL and PostgreSQL)
|
||||
if (windowDefinition != null)
|
||||
if (SUPPORT_NO_PARENS_WINDOW_REFERENCE.contains(ctx.family()))
|
||||
if (SUPPORT_NO_PARENS_WINDOW_REFERENCE.contains(ctx.dialect()))
|
||||
return windowDefinition;
|
||||
else
|
||||
return DSL.sql("({0})", windowDefinition);
|
||||
|
||||
@ -301,13 +301,13 @@ final class Alias<Q extends QueryPart> extends AbstractQueryPart {
|
||||
ctx.sql(' ').visit(K_AS);
|
||||
}
|
||||
else if (wrapped instanceof Field) {
|
||||
if (ctx.settings().getRenderOptionalAsKeywordForFieldAliases() == RenderOptionalKeyword.DEFAULT && SUPPORT_AS_REQUIRED.contains(ctx.family()))
|
||||
if (ctx.settings().getRenderOptionalAsKeywordForFieldAliases() == RenderOptionalKeyword.DEFAULT && SUPPORT_AS_REQUIRED.contains(ctx.dialect()))
|
||||
ctx.sql(' ').visit(K_AS);
|
||||
else if (ctx.settings().getRenderOptionalAsKeywordForFieldAliases() == RenderOptionalKeyword.ON)
|
||||
ctx.sql(' ').visit(K_AS);
|
||||
}
|
||||
else {
|
||||
if (ctx.settings().getRenderOptionalAsKeywordForTableAliases() == RenderOptionalKeyword.DEFAULT && SUPPORT_AS_REQUIRED.contains(ctx.family()))
|
||||
if (ctx.settings().getRenderOptionalAsKeywordForTableAliases() == RenderOptionalKeyword.DEFAULT && SUPPORT_AS_REQUIRED.contains(ctx.dialect()))
|
||||
ctx.sql(' ').visit(K_AS);
|
||||
|
||||
|
||||
|
||||
@ -130,7 +130,7 @@ implements
|
||||
|
||||
|
||||
private final boolean supportsIfExists(Context<?> ctx) {
|
||||
return !NO_SUPPORT_IF_EXISTS.contains(ctx.family());
|
||||
return !NO_SUPPORT_IF_EXISTS.contains(ctx.dialect());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -315,11 +315,11 @@ implements
|
||||
private static final Set<SQLDialect> NO_SUPPORT_DROP_CONSTRAINT_IF_EXISTS = SQLDialect.supportedBy(FIREBIRD);
|
||||
|
||||
private final boolean supportsRenameConstraintIfExists(Context<?> ctx) {
|
||||
return !NO_SUPPORT_RENAME_CONSTRAINT_IF_EXISTS.contains(ctx.family());
|
||||
return !NO_SUPPORT_RENAME_CONSTRAINT_IF_EXISTS.contains(ctx.dialect());
|
||||
}
|
||||
|
||||
private final boolean supportsDropConstraintIfExists(Context<?> ctx) {
|
||||
return !NO_SUPPORT_DROP_CONSTRAINT_IF_EXISTS.contains(ctx.family());
|
||||
return !NO_SUPPORT_DROP_CONSTRAINT_IF_EXISTS.contains(ctx.dialect());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -156,7 +156,7 @@ final class AlterIndexImpl extends AbstractRowCountQuery implements
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
private final boolean supportsIfExists(Context<?> ctx) {
|
||||
return !NO_SUPPORT_IF_EXISTS.contains(ctx.family());
|
||||
return !NO_SUPPORT_IF_EXISTS.contains(ctx.dialect());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -172,7 +172,7 @@ final class AlterIndexImpl extends AbstractRowCountQuery implements
|
||||
}
|
||||
|
||||
private final void accept0(Context<?> ctx) {
|
||||
boolean renameIndex = SUPPORT_RENAME_INDEX.contains(ctx.family());
|
||||
boolean renameIndex = SUPPORT_RENAME_INDEX.contains(ctx.dialect());
|
||||
boolean qualify = ctx.qualify();
|
||||
|
||||
switch (ctx.family()) {
|
||||
|
||||
@ -967,15 +967,15 @@ final class AlterTableImpl extends AbstractRowCountQuery implements
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
private final boolean supportsIfExists(Context<?> ctx) {
|
||||
return !NO_SUPPORT_IF_EXISTS.contains(ctx.family());
|
||||
return !NO_SUPPORT_IF_EXISTS.contains(ctx.dialect());
|
||||
}
|
||||
|
||||
private final boolean supportsIfExistsColumn(Context<?> ctx) {
|
||||
return !NO_SUPPORT_IF_EXISTS_COLUMN.contains(ctx.family());
|
||||
return !NO_SUPPORT_IF_EXISTS_COLUMN.contains(ctx.dialect());
|
||||
}
|
||||
|
||||
private final boolean supportsIfNotExistsColumn(Context<?> ctx) {
|
||||
return !NO_SUPPORT_IF_NOT_EXISTS_COLUMN.contains(ctx.family());
|
||||
return !NO_SUPPORT_IF_NOT_EXISTS_COLUMN.contains(ctx.dialect());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -1172,13 +1172,13 @@ final class AlterTableImpl extends AbstractRowCountQuery implements
|
||||
|
||||
ctx.start(ALTER_TABLE_RENAME);
|
||||
|
||||
if (NO_SUPPORT_RENAME_QUALIFIED_TABLE.contains(ctx.family()))
|
||||
if (NO_SUPPORT_RENAME_QUALIFIED_TABLE.contains(ctx.dialect()))
|
||||
ctx.qualify(false);
|
||||
|
||||
ctx.visit(renameObject || renameTable ? K_TO : K_RENAME_TO).sql(' ')
|
||||
.visit(renameTo);
|
||||
|
||||
if (NO_SUPPORT_RENAME_QUALIFIED_TABLE.contains(ctx.family()))
|
||||
if (NO_SUPPORT_RENAME_QUALIFIED_TABLE.contains(ctx.dialect()))
|
||||
ctx.qualify(qualify);
|
||||
|
||||
ctx.end(ALTER_TABLE_RENAME);
|
||||
@ -1299,7 +1299,7 @@ final class AlterTableImpl extends AbstractRowCountQuery implements
|
||||
}
|
||||
else if (add != null) {
|
||||
boolean qualify = ctx.qualify();
|
||||
boolean multiAdd = REQUIRE_REPEAT_ADD_ON_MULTI_ALTER.contains(ctx.family());
|
||||
boolean multiAdd = REQUIRE_REPEAT_ADD_ON_MULTI_ALTER.contains(ctx.dialect());
|
||||
boolean parens = !multiAdd ;
|
||||
boolean comma = true ;
|
||||
|
||||
@ -1673,7 +1673,7 @@ final class AlterTableImpl extends AbstractRowCountQuery implements
|
||||
// dropped by dropping their declarations.
|
||||
ctx.visit(dropConstraint.getUnqualifiedName().empty() ? K_DROP : K_DROP_CONSTRAINT).sql(' ');
|
||||
|
||||
if (ifExistsConstraint && !NO_SUPPORT_IF_EXISTS_CONSTRAINT.contains(ctx.family()))
|
||||
if (ifExistsConstraint && !NO_SUPPORT_IF_EXISTS_CONSTRAINT.contains(ctx.dialect()))
|
||||
ctx.visit(K_IF_EXISTS).sql(' ');
|
||||
|
||||
ctx.visit(dropConstraint);
|
||||
|
||||
@ -147,9 +147,8 @@ final class AlterViewImpl extends AbstractRowCountQuery implements
|
||||
// XXX: QueryPart API
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
// private static final EnumSet<SQLDialect> SUPPORT_IF_EXISTS =
|
||||
private final boolean supportsIfExists(Context<?> ctx) {
|
||||
return !SUPPORT_IF_EXISTS.contains(ctx.family());
|
||||
return !SUPPORT_IF_EXISTS.contains(ctx.dialect());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -102,7 +102,7 @@ final class Array<T> extends AbstractField<T[]> {
|
||||
.visit(fields)
|
||||
.sql(squareBrackets ? ']' : ')');
|
||||
|
||||
if (fields.fields.length == 0 && REQUIRES_CAST.contains(ctx.family()))
|
||||
if (fields.fields.length == 0 && REQUIRES_CAST.contains(ctx.dialect()))
|
||||
ctx.sql("::").visit(K_INT).sql("[]");
|
||||
|
||||
break;
|
||||
|
||||
@ -151,7 +151,7 @@ final class BetweenCondition<T> extends AbstractCondition implements BetweenAndS
|
||||
? f.betweenSymmetric(min).and(max)
|
||||
: f.between(min).and(max));
|
||||
}
|
||||
else if (symmetric && NO_SUPPORT_SYMMETRIC.contains(configuration.family()))
|
||||
else if (symmetric && NO_SUPPORT_SYMMETRIC.contains(configuration.dialect()))
|
||||
return (QueryPartInternal) (not
|
||||
? field.notBetween(minValue, maxValue).and(field.notBetween(maxValue, minValue))
|
||||
: field.between(minValue, maxValue).or(field.between(maxValue, minValue)));
|
||||
|
||||
@ -406,7 +406,7 @@ final class BlockImpl extends AbstractRowCountQuery implements Block {
|
||||
|
||||
|
||||
|
||||
if (s instanceof NullStatement && !SUPPORTS_NULL_STATEMENT.contains(ctx.family()))
|
||||
if (s instanceof NullStatement && !SUPPORTS_NULL_STATEMENT.contains(ctx.dialect()))
|
||||
continue statementLoop;
|
||||
|
||||
ctx.formatSeparator();
|
||||
|
||||
@ -212,7 +212,7 @@ implements
|
||||
ctx.visit(K_COMMENT).sql(' ').visit(K_ON).sql(' ');
|
||||
|
||||
if (table != null)
|
||||
ctx.visit(isView && SUPPORTS_COMMENT_ON_VIEW.contains(ctx.family()) ? K_VIEW : K_TABLE)
|
||||
ctx.visit(isView && SUPPORTS_COMMENT_ON_VIEW.contains(ctx.dialect()) ? K_VIEW : K_TABLE)
|
||||
.sql(' ')
|
||||
.visit(table);
|
||||
else if (field != null)
|
||||
|
||||
@ -89,7 +89,7 @@ implements
|
||||
private static final Set<SQLDialect> NO_SUPPORT_IF_NOT_EXISTS = SQLDialect.supportedBy(DERBY, FIREBIRD, POSTGRES);
|
||||
|
||||
private final boolean supportsIfNotExists(Context<?> ctx) {
|
||||
return !NO_SUPPORT_IF_NOT_EXISTS.contains(ctx.family());
|
||||
return !NO_SUPPORT_IF_NOT_EXISTS.contains(ctx.dialect());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -155,7 +155,7 @@ implements
|
||||
private static final Set<SQLDialect> NO_SUPPORT_IF_NOT_EXISTS = SQLDialect.supportedBy(FIREBIRD, POSTGRES);
|
||||
|
||||
private final boolean supportsIfNotExists(Context<?> ctx) {
|
||||
return !NO_SUPPORT_IF_NOT_EXISTS.contains(ctx.family());
|
||||
return !NO_SUPPORT_IF_NOT_EXISTS.contains(ctx.dialect());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -257,7 +257,7 @@ final class CreateIndexImpl extends AbstractRowCountQuery implements
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
private final boolean supportsIfNotExists(Context<?> ctx) {
|
||||
return !NO_SUPPORT_IF_NOT_EXISTS.contains(ctx.family());
|
||||
return !NO_SUPPORT_IF_NOT_EXISTS.contains(ctx.dialect());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -290,7 +290,7 @@ final class CreateIndexImpl extends AbstractRowCountQuery implements
|
||||
if (index != null)
|
||||
ctx.visit(index)
|
||||
.sql(' ');
|
||||
else if (!SUPPORT_UNNAMED_INDEX.contains(ctx.family()))
|
||||
else if (!SUPPORT_UNNAMED_INDEX.contains(ctx.dialect()))
|
||||
ctx.visit(generatedName())
|
||||
.sql(' ');
|
||||
|
||||
|
||||
@ -95,7 +95,7 @@ implements
|
||||
|
||||
|
||||
private final boolean supportsIfNotExists(Context<?> ctx) {
|
||||
return !NO_SUPPORT_IF_NOT_EXISTS.contains(ctx.family());
|
||||
return !NO_SUPPORT_IF_NOT_EXISTS.contains(ctx.dialect());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -248,7 +248,7 @@ implements
|
||||
private static final Set<SQLDialect> OMIT_NO_MAXVALUE = SQLDialect.supportedBy(FIREBIRD);
|
||||
|
||||
private final boolean supportsIfNotExists(Context<?> ctx) {
|
||||
return !NO_SUPPORT_IF_NOT_EXISTS.contains(ctx.family());
|
||||
return !NO_SUPPORT_IF_NOT_EXISTS.contains(ctx.dialect());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -351,7 +351,7 @@ final class CreateTableImpl extends AbstractRowCountQuery implements
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
private final boolean supportsIfNotExists(Context<?> ctx) {
|
||||
return !NO_SUPPORT_IF_NOT_EXISTS.contains(ctx.family());
|
||||
return !NO_SUPPORT_IF_NOT_EXISTS.contains(ctx.dialect());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -367,18 +367,18 @@ final class CreateTableImpl extends AbstractRowCountQuery implements
|
||||
}
|
||||
|
||||
private final void accept0(Context<?> ctx) {
|
||||
boolean c = comment != null && EMULATE_COMMENT_IN_BLOCK.contains(ctx.family());
|
||||
boolean i = !indexes.isEmpty() && EMULATE_INDEXES_IN_BLOCK.contains(ctx.family());
|
||||
boolean c = comment != null && EMULATE_COMMENT_IN_BLOCK.contains(ctx.dialect());
|
||||
boolean i = !indexes.isEmpty() && EMULATE_INDEXES_IN_BLOCK.contains(ctx.dialect());
|
||||
|
||||
if (c || i) {
|
||||
begin(ctx);
|
||||
|
||||
if (REQUIRE_EXECUTE_IMMEDIATE.contains(ctx.family()))
|
||||
if (REQUIRE_EXECUTE_IMMEDIATE.contains(ctx.dialect()))
|
||||
beginExecuteImmediate(ctx);
|
||||
|
||||
accept1(ctx);
|
||||
|
||||
if (REQUIRE_EXECUTE_IMMEDIATE.contains(ctx.family()))
|
||||
if (REQUIRE_EXECUTE_IMMEDIATE.contains(ctx.dialect()))
|
||||
endExecuteImmediate(ctx);
|
||||
else
|
||||
ctx.sql(';');
|
||||
@ -386,12 +386,12 @@ final class CreateTableImpl extends AbstractRowCountQuery implements
|
||||
if (c) {
|
||||
ctx.formatSeparator();
|
||||
|
||||
if (REQUIRE_EXECUTE_IMMEDIATE.contains(ctx.family()))
|
||||
if (REQUIRE_EXECUTE_IMMEDIATE.contains(ctx.dialect()))
|
||||
beginExecuteImmediate(ctx);
|
||||
|
||||
ctx.visit(commentOnTable(table).is(comment));
|
||||
|
||||
if (REQUIRE_EXECUTE_IMMEDIATE.contains(ctx.family()))
|
||||
if (REQUIRE_EXECUTE_IMMEDIATE.contains(ctx.dialect()))
|
||||
endExecuteImmediate(ctx);
|
||||
else
|
||||
ctx.sql(';');
|
||||
@ -401,7 +401,7 @@ final class CreateTableImpl extends AbstractRowCountQuery implements
|
||||
for (Index index : indexes) {
|
||||
ctx.formatSeparator();
|
||||
|
||||
if (REQUIRE_EXECUTE_IMMEDIATE.contains(ctx.family()))
|
||||
if (REQUIRE_EXECUTE_IMMEDIATE.contains(ctx.dialect()))
|
||||
beginExecuteImmediate(ctx);
|
||||
|
||||
if ("".equals(index.getName()))
|
||||
@ -409,7 +409,7 @@ final class CreateTableImpl extends AbstractRowCountQuery implements
|
||||
else
|
||||
ctx.visit(createIndex(index.getUnqualifiedName()).on(index.getTable(), index.getFields()));
|
||||
|
||||
if (REQUIRE_EXECUTE_IMMEDIATE.contains(ctx.family()))
|
||||
if (REQUIRE_EXECUTE_IMMEDIATE.contains(ctx.dialect()))
|
||||
endExecuteImmediate(ctx);
|
||||
else
|
||||
ctx.sql(';');
|
||||
@ -442,7 +442,7 @@ final class CreateTableImpl extends AbstractRowCountQuery implements
|
||||
toSQLOnCommit(ctx);
|
||||
}
|
||||
|
||||
if (comment != null && !EMULATE_COMMENT_IN_BLOCK.contains(ctx.family()))
|
||||
if (comment != null && !EMULATE_COMMENT_IN_BLOCK.contains(ctx.dialect()))
|
||||
ctx.formatSeparator()
|
||||
.visit(K_COMMENT).sql(' ').visit(comment);
|
||||
|
||||
@ -458,7 +458,7 @@ final class CreateTableImpl extends AbstractRowCountQuery implements
|
||||
toSQLCreateTableName(ctx);
|
||||
|
||||
if (!columnFields.isEmpty()
|
||||
&& (select == null || !NO_SUPPORT_CTAS_COLUMN_NAMES.contains(ctx.family()))) {
|
||||
&& (select == null || !NO_SUPPORT_CTAS_COLUMN_NAMES.contains(ctx.dialect()))) {
|
||||
ctx.sql(" (")
|
||||
.start(CREATE_TABLE_COLUMNS)
|
||||
.formatIndentStart()
|
||||
@ -498,7 +498,7 @@ final class CreateTableImpl extends AbstractRowCountQuery implements
|
||||
.formatSeparator()
|
||||
.visit(constraint);
|
||||
|
||||
if (EMULATE_SOME_ENUM_TYPES_AS_CHECK.contains(ctx.family())) {
|
||||
if (EMULATE_SOME_ENUM_TYPES_AS_CHECK.contains(ctx.dialect())) {
|
||||
for (int i = 0; i < columnFields.size(); i++) {
|
||||
DataType<?> type = columnTypes.get(i);
|
||||
|
||||
@ -507,7 +507,7 @@ final class CreateTableImpl extends AbstractRowCountQuery implements
|
||||
@SuppressWarnings("unchecked")
|
||||
DataType<EnumType> enumType = (DataType<EnumType>) type;
|
||||
|
||||
if (EMULATE_STORED_ENUM_TYPES_AS_CHECK.contains(ctx.family()) || !storedEnumType(enumType)) {
|
||||
if (EMULATE_STORED_ENUM_TYPES_AS_CHECK.contains(ctx.dialect()) || !storedEnumType(enumType)) {
|
||||
Field<?> field = columnFields.get(i);
|
||||
|
||||
ctx.sql(',')
|
||||
@ -521,7 +521,7 @@ final class CreateTableImpl extends AbstractRowCountQuery implements
|
||||
|
||||
ctx.end(CREATE_TABLE_CONSTRAINTS);
|
||||
|
||||
if (!indexes.isEmpty() && !EMULATE_INDEXES_IN_BLOCK.contains(ctx.family())) {
|
||||
if (!indexes.isEmpty() && !EMULATE_INDEXES_IN_BLOCK.contains(ctx.dialect())) {
|
||||
ctx.qualify(false);
|
||||
|
||||
for (Index index : indexes) {
|
||||
@ -562,41 +562,41 @@ final class CreateTableImpl extends AbstractRowCountQuery implements
|
||||
ctx.formatSeparator()
|
||||
.visit(K_AS);
|
||||
|
||||
if (WRAP_SELECT_IN_PARENS.contains(ctx.family()))
|
||||
if (WRAP_SELECT_IN_PARENS.contains(ctx.dialect()))
|
||||
ctx.sql(" (")
|
||||
.formatIndentStart()
|
||||
.formatNewLine();
|
||||
else
|
||||
ctx.formatSeparator();
|
||||
|
||||
if (FALSE.equals(withData) && NO_SUPPORT_WITH_DATA.contains(ctx.family()))
|
||||
if (FALSE.equals(withData) && NO_SUPPORT_WITH_DATA.contains(ctx.dialect()))
|
||||
ctx.data(DATA_SELECT_NO_DATA, true);
|
||||
|
||||
ctx.start(CREATE_TABLE_AS);
|
||||
|
||||
if (!columnFields.isEmpty() && NO_SUPPORT_CTAS_COLUMN_NAMES.contains(ctx.family()))
|
||||
if (!columnFields.isEmpty() && NO_SUPPORT_CTAS_COLUMN_NAMES.contains(ctx.dialect()))
|
||||
ctx.visit(select(asterisk()).from(select.asTable(table(name("t")), columnFields.toArray(EMPTY_FIELD))));
|
||||
else
|
||||
ctx.visit(select);
|
||||
|
||||
ctx.end(CREATE_TABLE_AS);
|
||||
|
||||
if (FALSE.equals(withData) && NO_SUPPORT_WITH_DATA.contains(ctx.family()))
|
||||
if (FALSE.equals(withData) && NO_SUPPORT_WITH_DATA.contains(ctx.dialect()))
|
||||
ctx.data().remove(DATA_SELECT_NO_DATA);
|
||||
|
||||
if (WRAP_SELECT_IN_PARENS.contains(ctx.family())) {
|
||||
if (WRAP_SELECT_IN_PARENS.contains(ctx.dialect())) {
|
||||
ctx.formatIndentEnd()
|
||||
.formatNewLine()
|
||||
.sql(')');
|
||||
}
|
||||
|
||||
if (FALSE.equals(withData) && !NO_SUPPORT_WITH_DATA.contains(ctx.family()))
|
||||
if (FALSE.equals(withData) && !NO_SUPPORT_WITH_DATA.contains(ctx.dialect()))
|
||||
ctx.formatSeparator()
|
||||
.visit(K_WITH_NO_DATA);
|
||||
else if (TRUE.equals(withData) && !NO_SUPPORT_WITH_DATA.contains(ctx.family()))
|
||||
else if (TRUE.equals(withData) && !NO_SUPPORT_WITH_DATA.contains(ctx.dialect()))
|
||||
ctx.formatSeparator()
|
||||
.visit(K_WITH_DATA);
|
||||
else if (REQUIRES_WITH_DATA.contains(ctx.family()))
|
||||
else if (REQUIRES_WITH_DATA.contains(ctx.dialect()))
|
||||
ctx.formatSeparator()
|
||||
.visit(K_WITH_DATA);
|
||||
}
|
||||
@ -649,7 +649,7 @@ final class CreateTableImpl extends AbstractRowCountQuery implements
|
||||
.sql(' ');
|
||||
|
||||
if (temporary)
|
||||
if (SUPPORT_TEMPORARY.contains(ctx.family()))
|
||||
if (SUPPORT_TEMPORARY.contains(ctx.dialect()))
|
||||
ctx.visit(K_TEMPORARY).sql(' ');
|
||||
else
|
||||
ctx.visit(K_GLOBAL_TEMPORARY).sql(' ');
|
||||
|
||||
@ -202,7 +202,7 @@ final class CreateViewImpl<R extends Record> extends AbstractRowCountQuery imple
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
private final boolean supportsIfNotExists(Context<?> ctx) {
|
||||
return !NO_SUPPORT_IF_NOT_EXISTS.contains(ctx.family());
|
||||
return !NO_SUPPORT_IF_NOT_EXISTS.contains(ctx.dialect());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -123,7 +123,7 @@ final class CurrentTimestamp<T> extends AbstractField<T> {
|
||||
case HSQLDB:
|
||||
case POSTGRES:
|
||||
case SQLITE:
|
||||
if (precision != null && !NO_SUPPORT_PRECISION.contains(ctx.family()))
|
||||
if (precision != null && !NO_SUPPORT_PRECISION.contains(ctx.dialect()))
|
||||
ctx.visit(K_CURRENT).sql('_').visit(K_TIMESTAMP).sql('(').visit(precision).sql(')');
|
||||
else
|
||||
ctx.visit(K_CURRENT).sql('_').visit(K_TIMESTAMP);
|
||||
@ -131,7 +131,7 @@ final class CurrentTimestamp<T> extends AbstractField<T> {
|
||||
break;
|
||||
|
||||
default:
|
||||
if (precision != null && !NO_SUPPORT_PRECISION.contains(ctx.family()))
|
||||
if (precision != null && !NO_SUPPORT_PRECISION.contains(ctx.dialect()))
|
||||
ctx.visit(N_CURRENT_TIMESTAMP).sql('(').visit(precision).sql(')');
|
||||
else
|
||||
ctx.visit(N_CURRENT_TIMESTAMP).sql("()");
|
||||
|
||||
@ -1019,7 +1019,7 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
|
||||
ctx.render().sql(')');
|
||||
}
|
||||
|
||||
else if (REQUIRES_ARRAY_CAST.contains(ctx.family())) {
|
||||
else if (REQUIRES_ARRAY_CAST.contains(ctx.dialect())) {
|
||||
|
||||
// [#8933] In some cases, we cannot derive the cast type from
|
||||
// array type directly
|
||||
@ -1048,7 +1048,7 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
|
||||
|
||||
// [#3214] Some PostgreSQL array type literals need explicit casting
|
||||
// TODO: This seems mutually exclusive with the previous branch. Still needed?
|
||||
if ((REQUIRES_ARRAY_CAST.contains(ctx.family())) && EnumType.class.isAssignableFrom(type.getComponentType()))
|
||||
if ((REQUIRES_ARRAY_CAST.contains(ctx.dialect())) && EnumType.class.isAssignableFrom(type.getComponentType()))
|
||||
DefaultEnumTypeBinding.pgRenderEnumCast(ctx.render(), type);
|
||||
}
|
||||
}
|
||||
@ -1436,8 +1436,8 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
|
||||
/**
|
||||
* Generated UID
|
||||
*/
|
||||
private static final long serialVersionUID = -8912971184035434281L;
|
||||
private static final Set<SQLDialect> BIND_AS_STRING = SQLDialect.supportedBy(SQLITE);
|
||||
private static final long serialVersionUID = -8912971184035434281L;
|
||||
private static final Set<SQLDialect> BIND_AS_STRING = SQLDialect.supportedBy(SQLITE);
|
||||
|
||||
DefaultBigDecimalBinding(Converter<BigDecimal, U> converter, boolean isLob) {
|
||||
super(converter, isLob);
|
||||
@ -1450,7 +1450,7 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
|
||||
|
||||
@Override
|
||||
final void set0(BindingSetStatementContext<U> ctx, BigDecimal value) throws SQLException {
|
||||
if (BIND_AS_STRING.contains(ctx.family()))
|
||||
if (BIND_AS_STRING.contains(ctx.dialect()))
|
||||
ctx.statement().setString(ctx.index(), value.toString());
|
||||
else
|
||||
ctx.statement().setBigDecimal(ctx.index(), value);
|
||||
@ -1506,7 +1506,7 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
|
||||
|
||||
@Override
|
||||
final void set0(BindingSetStatementContext<U> ctx, BigInteger value) throws SQLException {
|
||||
if (BIND_AS_STRING.contains(ctx.family()))
|
||||
if (BIND_AS_STRING.contains(ctx.dialect()))
|
||||
ctx.statement().setString(ctx.index(), value.toString());
|
||||
else
|
||||
ctx.statement().setBigDecimal(ctx.index(), new BigDecimal(value));
|
||||
@ -1625,7 +1625,7 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
|
||||
final void sqlInline0(BindingSQLContext<U> ctx, Boolean value) {
|
||||
|
||||
// [#1153] Some dialects don't support boolean literals TRUE and FALSE
|
||||
if (BIND_AS_1_0.contains(ctx.family()))
|
||||
if (BIND_AS_1_0.contains(ctx.dialect()))
|
||||
ctx.render().sql(value ? "1" : "0");
|
||||
|
||||
|
||||
@ -1805,7 +1805,7 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
|
||||
|
||||
|
||||
|
||||
if (INLINE_AS_X_APOS.contains(ctx.family()))
|
||||
if (INLINE_AS_X_APOS.contains(ctx.dialect()))
|
||||
ctx.render()
|
||||
.sql("X'")
|
||||
.sql(convertBytesToHex(value))
|
||||
@ -1822,7 +1822,7 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
|
||||
|
||||
|
||||
|
||||
else if (REQUIRE_BYTEA_CAST.contains(ctx.family()))
|
||||
else if (REQUIRE_BYTEA_CAST.contains(ctx.dialect()))
|
||||
ctx.render()
|
||||
.sql("E'")
|
||||
.sql(PostgresUtils.toPGString(value))
|
||||
@ -1986,7 +1986,7 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
|
||||
|
||||
// The SQLite JDBC driver does not implement the escape syntax
|
||||
// [#1253] Sybase does not implement date literals
|
||||
if (INLINE_AS_STRING_LITERAL.contains(ctx.family()))
|
||||
if (INLINE_AS_STRING_LITERAL.contains(ctx.dialect()))
|
||||
ctx.render().sql('\'').sql(escape(value, ctx.render())).sql('\'');
|
||||
|
||||
|
||||
@ -2006,7 +2006,7 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
|
||||
ctx.render().visit(K_DATE).sql("('").sql(escape(value, ctx.render())).sql("')");
|
||||
|
||||
// [#3648] Circumvent a MySQL bug related to date literals
|
||||
else if (REQUIRE_JDBC_DATE_LITERAL.contains(ctx.family()))
|
||||
else if (REQUIRE_JDBC_DATE_LITERAL.contains(ctx.dialect()))
|
||||
ctx.render().sql("{d '").sql(escape(value, ctx.render())).sql("'}");
|
||||
|
||||
// Most dialects implement SQL standard date literals
|
||||
@ -2173,7 +2173,7 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
|
||||
@Override
|
||||
void sqlInline0(BindingSQLContext<U> ctx, DayToSecond value) throws SQLException {
|
||||
// [#566] Interval data types are best bound as Strings
|
||||
if (REQUIRE_PG_INTERVAL_SYNTAX.contains(ctx.family())) {
|
||||
if (REQUIRE_PG_INTERVAL_SYNTAX.contains(ctx.dialect())) {
|
||||
int sign = value.getSign();
|
||||
int days = sign * value.getDays();
|
||||
ctx.render().sql('\'')
|
||||
@ -2197,7 +2197,7 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
|
||||
final void set0(BindingSetStatementContext<U> ctx, DayToSecond value) throws SQLException {
|
||||
|
||||
// [#566] Interval data types are best bound as Strings
|
||||
if (REQUIRE_PG_INTERVAL_SYNTAX.contains(ctx.family()))
|
||||
if (REQUIRE_PG_INTERVAL_SYNTAX.contains(ctx.dialect()))
|
||||
ctx.statement().setObject(ctx.index(), toPGInterval(value));
|
||||
else
|
||||
ctx.statement().setString(ctx.index(), value.toString());
|
||||
@ -2210,7 +2210,7 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
|
||||
|
||||
@Override
|
||||
final DayToSecond get0(BindingGetResultSetContext<U> ctx) throws SQLException {
|
||||
if (REQUIRE_PG_INTERVAL_SYNTAX.contains(ctx.family())) {
|
||||
if (REQUIRE_PG_INTERVAL_SYNTAX.contains(ctx.dialect())) {
|
||||
Object object = ctx.resultSet().getObject(ctx.index());
|
||||
return object == null ? null : PostgresUtils.toDayToSecond(object);
|
||||
}
|
||||
@ -2222,7 +2222,7 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
|
||||
|
||||
@Override
|
||||
final DayToSecond get0(BindingGetStatementContext<U> ctx) throws SQLException {
|
||||
if (REQUIRE_PG_INTERVAL_SYNTAX.contains(ctx.family())) {
|
||||
if (REQUIRE_PG_INTERVAL_SYNTAX.contains(ctx.dialect())) {
|
||||
Object object = ctx.statement().getObject(ctx.index());
|
||||
return object == null ? null : PostgresUtils.toDayToSecond(object);
|
||||
}
|
||||
@ -2261,7 +2261,7 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
|
||||
|
||||
// [#5249] [#6912] [#8063] Special inlining of special floating point values
|
||||
if (value.isNaN())
|
||||
if (REQUIRE_NAN_CAST.contains(ctx.family()))
|
||||
if (REQUIRE_NAN_CAST.contains(ctx.dialect()))
|
||||
ctx.render().visit(inline("NaN")).sql("::float8");
|
||||
else if (ctx.family() == HSQLDB)
|
||||
ctx.render().visit(sqrt(inline(-1)));
|
||||
@ -2339,7 +2339,7 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
|
||||
super.sqlBind0(ctx, value);
|
||||
|
||||
// Postgres needs explicit casting for enum (array) types
|
||||
if (REQUIRE_ENUM_CAST.contains(ctx.family()))
|
||||
if (REQUIRE_ENUM_CAST.contains(ctx.dialect()))
|
||||
pgRenderEnumCast(ctx.render(), type);
|
||||
}
|
||||
|
||||
@ -2436,7 +2436,7 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
|
||||
|
||||
// [#5249] [#6912] [#8063] Special inlining of special floating point values
|
||||
if (value.isNaN())
|
||||
if (REQUIRE_NAN_CAST.contains(ctx.family()))
|
||||
if (REQUIRE_NAN_CAST.contains(ctx.dialect()))
|
||||
ctx.render().visit(inline("NaN")).sql("::float4");
|
||||
else if (ctx.family() == HSQLDB)
|
||||
ctx.render().visit(sqrt(inline(-1)));
|
||||
@ -3263,13 +3263,13 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
|
||||
void sqlBind0(BindingSQLContext<U> ctx, Record value) throws SQLException {
|
||||
super.sqlBind0(ctx, value);
|
||||
|
||||
if (REQUIRE_RECORD_CAST.contains(ctx.family()) && value != null)
|
||||
if (REQUIRE_RECORD_CAST.contains(ctx.dialect()) && value != null)
|
||||
pgRenderRecordCast(ctx.render(), value);
|
||||
}
|
||||
|
||||
@Override
|
||||
final void sqlInline0(BindingSQLContext<U> ctx, Record value) throws SQLException {
|
||||
if (REQUIRE_RECORD_CAST.contains(ctx.family())) {
|
||||
if (REQUIRE_RECORD_CAST.contains(ctx.dialect())) {
|
||||
ctx.render().visit(inline(PostgresUtils.toPGString(value)));
|
||||
pgRenderRecordCast(ctx.render(), value);
|
||||
}
|
||||
@ -3292,7 +3292,7 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
|
||||
|
||||
@Override
|
||||
final void set0(BindingSetStatementContext<U> ctx, Record value) throws SQLException {
|
||||
if (REQUIRE_RECORD_CAST.contains(ctx.family()) && value != null)
|
||||
if (REQUIRE_RECORD_CAST.contains(ctx.dialect()) && value != null)
|
||||
ctx.statement().setString(ctx.index(), PostgresUtils.toPGString(value));
|
||||
else
|
||||
ctx.statement().setObject(ctx.index(), value);
|
||||
@ -3760,7 +3760,7 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
|
||||
|
||||
// The SQLite JDBC driver does not implement the escape syntax
|
||||
// [#1253] Sybase does not implement time literals
|
||||
if (INLINE_AS_STRING_LITERAL.contains(ctx.family()))
|
||||
if (INLINE_AS_STRING_LITERAL.contains(ctx.dialect()))
|
||||
ctx.render().sql('\'').sql(new SimpleDateFormat("HH:mm:ss").format(value)).sql('\'');
|
||||
|
||||
|
||||
@ -3775,7 +3775,7 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
|
||||
ctx.render().visit(K_TIME).sql("('").sql(escape(value, ctx.render())).sql("')");
|
||||
|
||||
// [#3648] Circumvent a MySQL bug related to date literals
|
||||
else if (REQUIRE_JDBC_DATE_LITERAL.contains(ctx.family()))
|
||||
else if (REQUIRE_JDBC_DATE_LITERAL.contains(ctx.dialect()))
|
||||
ctx.render().sql("{t '").sql(escape(value, ctx.render())).sql("'}");
|
||||
|
||||
|
||||
@ -3854,7 +3854,7 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
|
||||
|
||||
// The SQLite JDBC driver does not implement the escape syntax
|
||||
// [#1253] Sybase does not implement timestamp literals
|
||||
if (INLINE_AS_STRING_LITERAL.contains(ctx.family()))
|
||||
if (INLINE_AS_STRING_LITERAL.contains(ctx.dialect()))
|
||||
ctx.render().sql('\'').sql(escape(value, ctx.render())).sql('\'');
|
||||
|
||||
|
||||
@ -3878,7 +3878,7 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
|
||||
ctx.render().visit(K_DATETIME).sql(" '").sql(escape(value, ctx.render())).sql('\'');
|
||||
|
||||
// [#3648] Circumvent a MySQL bug related to date literals
|
||||
else if (REQUIRE_JDBC_DATE_LITERAL.contains(ctx.family()))
|
||||
else if (REQUIRE_JDBC_DATE_LITERAL.contains(ctx.dialect()))
|
||||
ctx.render().sql("{ts '").sql(escape(value, ctx.render())).sql("'}");
|
||||
|
||||
// Most dialects implement SQL standard timestamp literals
|
||||
@ -4501,7 +4501,7 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
|
||||
final void set0(BindingSetStatementContext<U> ctx, YearToSecond value) throws SQLException {
|
||||
|
||||
// [#566] Interval data types are best bound as Strings
|
||||
if (REQUIRE_PG_INTERVAL.contains(ctx.family()))
|
||||
if (REQUIRE_PG_INTERVAL.contains(ctx.dialect()))
|
||||
ctx.statement().setObject(ctx.index(), toPGInterval(value));
|
||||
else
|
||||
ctx.statement().setString(ctx.index(), value.toString());
|
||||
@ -4514,7 +4514,7 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
|
||||
|
||||
@Override
|
||||
final YearToSecond get0(BindingGetResultSetContext<U> ctx) throws SQLException {
|
||||
if (REQUIRE_PG_INTERVAL.contains(ctx.family())) {
|
||||
if (REQUIRE_PG_INTERVAL.contains(ctx.dialect())) {
|
||||
Object object = ctx.resultSet().getObject(ctx.index());
|
||||
return object == null ? null : PostgresUtils.toYearToSecond(object);
|
||||
}
|
||||
@ -4526,7 +4526,7 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
|
||||
|
||||
@Override
|
||||
final YearToSecond get0(BindingGetStatementContext<U> ctx) throws SQLException {
|
||||
if (REQUIRE_PG_INTERVAL.contains(ctx.family())) {
|
||||
if (REQUIRE_PG_INTERVAL.contains(ctx.dialect())) {
|
||||
Object object = ctx.statement().getObject(ctx.index());
|
||||
return object == null ? null : PostgresUtils.toYearToSecond(object);
|
||||
}
|
||||
@ -4564,7 +4564,7 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
|
||||
final void set0(BindingSetStatementContext<U> ctx, YearToMonth value) throws SQLException {
|
||||
|
||||
// [#566] Interval data types are best bound as Strings
|
||||
if (REQUIRE_PG_INTERVAL.contains(ctx.family()))
|
||||
if (REQUIRE_PG_INTERVAL.contains(ctx.dialect()))
|
||||
ctx.statement().setObject(ctx.index(), toPGInterval(value));
|
||||
else
|
||||
ctx.statement().setString(ctx.index(), value.toString());
|
||||
@ -4577,7 +4577,7 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
|
||||
|
||||
@Override
|
||||
final YearToMonth get0(BindingGetResultSetContext<U> ctx) throws SQLException {
|
||||
if (REQUIRE_PG_INTERVAL.contains(ctx.family())) {
|
||||
if (REQUIRE_PG_INTERVAL.contains(ctx.dialect())) {
|
||||
Object object = ctx.resultSet().getObject(ctx.index());
|
||||
return object == null ? null : PostgresUtils.toYearToMonth(object);
|
||||
}
|
||||
@ -4589,7 +4589,7 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
|
||||
|
||||
@Override
|
||||
final YearToMonth get0(BindingGetStatementContext<U> ctx) throws SQLException {
|
||||
if (REQUIRE_PG_INTERVAL.contains(ctx.family())) {
|
||||
if (REQUIRE_PG_INTERVAL.contains(ctx.dialect())) {
|
||||
Object object = ctx.statement().getObject(ctx.index());
|
||||
return object == null ? null : PostgresUtils.toYearToMonth(object);
|
||||
}
|
||||
|
||||
@ -205,7 +205,7 @@ final class DeleteQueryImpl<R extends Record> extends AbstractDMLQuery<R> implem
|
||||
|
||||
// [#2464] MySQL supports a peculiar multi-table DELETE syntax for aliased tables:
|
||||
// DELETE t1 FROM my_table AS t1
|
||||
if (SPECIAL_DELETE_AS_SYNTAX.contains(ctx.family())) {
|
||||
if (SPECIAL_DELETE_AS_SYNTAX.contains(ctx.dialect())) {
|
||||
|
||||
// [#2579] [#6304] TableAlias discovery
|
||||
if (Tools.alias(table()) != null)
|
||||
@ -231,7 +231,7 @@ final class DeleteQueryImpl<R extends Record> extends AbstractDMLQuery<R> implem
|
||||
|
||||
|
||||
// [#2059] MemSQL does not support DELETE ... ORDER BY
|
||||
if (limit != null && NO_SUPPORT_LIMIT.contains(ctx.family()) ) {
|
||||
if (limit != null && NO_SUPPORT_LIMIT.contains(ctx.dialect()) ) {
|
||||
Field<?>[] keyFields =
|
||||
table().getKeys().isEmpty()
|
||||
? new Field[] { table().rowid() }
|
||||
|
||||
@ -89,7 +89,7 @@ implements
|
||||
private static final Set<SQLDialect> NO_SUPPORT_IF_EXISTS = SQLDialect.supportedBy(DERBY, FIREBIRD);
|
||||
|
||||
private final boolean supportsIfExists(Context<?> ctx) {
|
||||
return !NO_SUPPORT_IF_EXISTS.contains(ctx.family());
|
||||
return !NO_SUPPORT_IF_EXISTS.contains(ctx.dialect());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -122,7 +122,7 @@ implements
|
||||
private static final Set<SQLDialect> NO_SUPPORT_IF_EXISTS = SQLDialect.supportedBy(FIREBIRD);
|
||||
|
||||
private final boolean supportsIfExists(Context<?> ctx) {
|
||||
return !NO_SUPPORT_IF_EXISTS.contains(ctx.family());
|
||||
return !NO_SUPPORT_IF_EXISTS.contains(ctx.dialect());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -148,7 +148,7 @@ final class DropIndexImpl extends AbstractRowCountQuery implements
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
private final boolean supportsIfExists(Context<?> ctx) {
|
||||
return !NO_SUPPORT_IF_EXISTS.contains(ctx.family());
|
||||
return !NO_SUPPORT_IF_EXISTS.contains(ctx.dialect());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -176,7 +176,7 @@ final class DropIndexImpl extends AbstractRowCountQuery implements
|
||||
|
||||
ctx.visit(index);
|
||||
|
||||
if (on != null && REQUIRES_ON.contains(ctx.family()))
|
||||
if (on != null && REQUIRES_ON.contains(ctx.dialect()))
|
||||
ctx.sql(' ').visit(K_ON).sql(' ').visit(on);
|
||||
|
||||
if (cascade != null)
|
||||
|
||||
@ -129,7 +129,7 @@ implements
|
||||
|
||||
|
||||
private final boolean supportsIfExists(Context<?> ctx) {
|
||||
return !NO_SUPPORT_IF_EXISTS.contains(ctx.family());
|
||||
return !NO_SUPPORT_IF_EXISTS.contains(ctx.dialect());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -180,7 +180,7 @@ implements
|
||||
|
||||
if (cascade != null && cascade)
|
||||
ctx.sql(' ').visit(K_CASCADE);
|
||||
else if (cascade != null && !cascade || REQUIRES_RESTRICT.contains(ctx.family()))
|
||||
else if (cascade != null && !cascade || REQUIRES_RESTRICT.contains(ctx.dialect()))
|
||||
ctx.sql(' ').visit(K_RESTRICT);
|
||||
|
||||
ctx.end(Clause.DROP_SCHEMA_SCHEMA);
|
||||
|
||||
@ -90,7 +90,7 @@ implements
|
||||
private static final Set<SQLDialect> NO_SUPPORT_IF_EXISTS = SQLDialect.supportedBy(DERBY, FIREBIRD);
|
||||
|
||||
private final boolean supportsIfExists(Context<?> ctx) {
|
||||
return !NO_SUPPORT_IF_EXISTS.contains(ctx.family());
|
||||
return !NO_SUPPORT_IF_EXISTS.contains(ctx.dialect());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -133,7 +133,7 @@ final class DropTableImpl extends AbstractRowCountQuery implements
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
private final boolean supportsIfExists(Context<?> ctx) {
|
||||
return !NO_SUPPORT_IF_EXISTS.contains(ctx.family());
|
||||
return !NO_SUPPORT_IF_EXISTS.contains(ctx.dialect());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -154,7 +154,7 @@ final class DropTableImpl extends AbstractRowCountQuery implements
|
||||
// [#6371] [#9019] While many dialects do not require this keyword, in
|
||||
// some dialects (e.g. MySQL), there is a semantic
|
||||
// difference, e.g. with respect to transactions.
|
||||
if (temporary && TEMPORARY_SEMANTIC.contains(ctx.family()))
|
||||
if (temporary && TEMPORARY_SEMANTIC.contains(ctx.dialect()))
|
||||
ctx.visit(K_DROP).sql(' ').visit(K_TEMPORARY).sql(' ').visit(K_TABLE).sql(' ');
|
||||
else
|
||||
ctx.visit(K_DROP_TABLE).sql(' ');
|
||||
|
||||
@ -98,7 +98,7 @@ final class DropViewImpl extends AbstractRowCountQuery implements
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
private final boolean supportsIfExists(Context<?> ctx) {
|
||||
return !NO_SUPPORT_IF_EXISTS.contains(ctx.family());
|
||||
return !NO_SUPPORT_IF_EXISTS.contains(ctx.dialect());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -833,7 +833,7 @@ final class Expression<T> extends AbstractField<T> {
|
||||
public final void accept(Context<?> ctx) {
|
||||
String op = operator.toSQL();
|
||||
|
||||
if (operator == BIT_XOR && HASH_OP_FOR_BIT_XOR.contains(ctx.family()))
|
||||
if (operator == BIT_XOR && HASH_OP_FOR_BIT_XOR.contains(ctx.dialect()))
|
||||
op = "#";
|
||||
|
||||
ctx.sql('(');
|
||||
|
||||
@ -93,7 +93,7 @@ final class FieldMapForUpdate extends AbstractQueryPartMap<Field<?>, Field<?>> {
|
||||
// disambiguated columns in queries like
|
||||
// UPDATE t1 JOIN t2 .. SET t1.val = ..., t2.val = ...
|
||||
boolean restoreQualify = ctx.qualify();
|
||||
boolean supportsQualify = NO_SUPPORT_QUALIFY.contains(ctx.family()) ? false : restoreQualify;
|
||||
boolean supportsQualify = NO_SUPPORT_QUALIFY.contains(ctx.dialect()) ? false : restoreQualify;
|
||||
|
||||
// [#2823] [#10034] Few dialects need bind value casts for UPDATE .. SET
|
||||
// Some regressions have been observed e.g. in PostgreSQL with JSON types, so let's be careful.
|
||||
|
||||
@ -138,7 +138,7 @@ final class ForLock extends AbstractQueryPart {
|
||||
|
||||
// [#4151] [#6117] Some databases don't allow for qualifying column
|
||||
// names here. Copy also to TableList
|
||||
boolean unqualified = NO_SUPPORT_FOR_UPDATE_QUALIFIED.contains(ctx.family());
|
||||
boolean unqualified = NO_SUPPORT_FOR_UPDATE_QUALIFIED.contains(ctx.dialect());
|
||||
boolean qualify = ctx.qualify();
|
||||
|
||||
if (unqualified)
|
||||
|
||||
@ -141,7 +141,7 @@ final class InCondition<T> extends AbstractCondition {
|
||||
}
|
||||
|
||||
private final void accept0(Context<?> ctx) {
|
||||
if (values.size() == 0 && NO_SUPPORT_EMPTY_LISTS.contains(ctx.family())) {
|
||||
if (values.size() == 0 && NO_SUPPORT_EMPTY_LISTS.contains(ctx.dialect())) {
|
||||
if (comparator == IN)
|
||||
ctx.visit(falseCondition());
|
||||
else
|
||||
@ -202,7 +202,7 @@ final class InCondition<T> extends AbstractCondition {
|
||||
|
||||
static <T> List<T> padded(Context<?> ctx, List<T> list) {
|
||||
return ctx.paramType() == INDEXED && TRUE.equals(ctx.settings().isInListPadding())
|
||||
? new PaddedList<>(list, REQUIRES_IN_LIMIT.contains(ctx.family())
|
||||
? new PaddedList<>(list, REQUIRES_IN_LIMIT.contains(ctx.dialect())
|
||||
? IN_LIMIT
|
||||
: Integer.MAX_VALUE,
|
||||
defaultIfNull(ctx.settings().getInListPadBase(), 2))
|
||||
|
||||
@ -98,7 +98,7 @@ class IndexImpl extends AbstractNamed implements Index {
|
||||
|
||||
@Override
|
||||
public final void accept(Context<?> ctx) {
|
||||
if (NO_SUPPORT_INDEX_QUALIFICATION.contains(ctx.family()))
|
||||
if (NO_SUPPORT_INDEX_QUALIFICATION.contains(ctx.dialect()))
|
||||
ctx.visit(getUnqualifiedName());
|
||||
else if (getTable() == null)
|
||||
ctx.visit(getQualifiedName());
|
||||
|
||||
@ -630,7 +630,7 @@ final class InsertQueryImpl<R extends Record> extends AbstractStoreQuery<R> impl
|
||||
// [#4376] [#8433] for SQLite render using ON CONFLICT DO NOTHING
|
||||
// rather than INSERT OR IGNORE
|
||||
if (onDuplicateKeyIgnore)
|
||||
if (SUPPORT_INSERT_IGNORE.contains(ctx.family()))
|
||||
if (SUPPORT_INSERT_IGNORE.contains(ctx.dialect()))
|
||||
ctx.visit(K_IGNORE).sql(' ');
|
||||
|
||||
ctx.visit(K_INTO)
|
||||
|
||||
@ -294,7 +294,7 @@ implements
|
||||
toSQLJoinCondition(ctx);
|
||||
ctx.formatIndentEnd();
|
||||
}
|
||||
else if (OUTER_APPLY == translatedType && EMULATE_APPLY.contains(ctx.family())) {
|
||||
else if (OUTER_APPLY == translatedType && EMULATE_APPLY.contains(ctx.dialect())) {
|
||||
ctx.formatIndentStart()
|
||||
.formatSeparator()
|
||||
.start(TABLE_JOIN_ON)
|
||||
@ -353,9 +353,9 @@ implements
|
||||
break;
|
||||
}
|
||||
|
||||
if (translatedType == CROSS_APPLY && EMULATE_APPLY.contains(ctx.family()))
|
||||
if (translatedType == CROSS_APPLY && EMULATE_APPLY.contains(ctx.dialect()))
|
||||
keyword = K_CROSS_JOIN_LATERAL;
|
||||
else if (translatedType == OUTER_APPLY && EMULATE_APPLY.contains(ctx.family()))
|
||||
else if (translatedType == OUTER_APPLY && EMULATE_APPLY.contains(ctx.dialect()))
|
||||
if (ctx.settings().getRenderOptionalOuterKeyword() == RenderOptionalKeyword.OFF)
|
||||
keyword = K_LEFT_JOIN_LATERAL;
|
||||
else
|
||||
@ -415,22 +415,22 @@ implements
|
||||
/**
|
||||
* Translate the join type for SQL rendering
|
||||
*/
|
||||
final JoinType translateType(Context<?> context) {
|
||||
if (emulateCrossJoin(context))
|
||||
final JoinType translateType(Context<?> ctx) {
|
||||
if (emulateCrossJoin(ctx))
|
||||
return JOIN;
|
||||
else if (emulateNaturalJoin(context))
|
||||
else if (emulateNaturalJoin(ctx))
|
||||
return JOIN;
|
||||
else if (emulateNaturalLeftOuterJoin(context))
|
||||
else if (emulateNaturalLeftOuterJoin(ctx))
|
||||
return LEFT_OUTER_JOIN;
|
||||
else if (emulateNaturalRightOuterJoin(context))
|
||||
else if (emulateNaturalRightOuterJoin(ctx))
|
||||
return RIGHT_OUTER_JOIN;
|
||||
else if (emulateNaturalFullOuterJoin(context))
|
||||
else if (emulateNaturalFullOuterJoin(ctx))
|
||||
return FULL_OUTER_JOIN;
|
||||
else
|
||||
return type;
|
||||
}
|
||||
|
||||
private final boolean emulateCrossJoin(Context<?> context) {
|
||||
private final boolean emulateCrossJoin(Context<?> ctx) {
|
||||
return false
|
||||
|
||||
|
||||
@ -438,25 +438,25 @@ implements
|
||||
;
|
||||
}
|
||||
|
||||
private final boolean emulateNaturalJoin(Context<?> context) {
|
||||
return type == NATURAL_JOIN && EMULATE_NATURAL_JOIN.contains(context.family());
|
||||
private final boolean emulateNaturalJoin(Context<?> ctx) {
|
||||
return type == NATURAL_JOIN && EMULATE_NATURAL_JOIN.contains(ctx.dialect());
|
||||
}
|
||||
|
||||
private final boolean emulateNaturalLeftOuterJoin(Context<?> context) {
|
||||
return type == NATURAL_LEFT_OUTER_JOIN && EMULATE_NATURAL_OUTER_JOIN.contains(context.family());
|
||||
private final boolean emulateNaturalLeftOuterJoin(Context<?> ctx) {
|
||||
return type == NATURAL_LEFT_OUTER_JOIN && EMULATE_NATURAL_OUTER_JOIN.contains(ctx.dialect());
|
||||
}
|
||||
|
||||
private final boolean emulateNaturalRightOuterJoin(Context<?> context) {
|
||||
return type == NATURAL_RIGHT_OUTER_JOIN && EMULATE_NATURAL_OUTER_JOIN.contains(context.family());
|
||||
private final boolean emulateNaturalRightOuterJoin(Context<?> ctx) {
|
||||
return type == NATURAL_RIGHT_OUTER_JOIN && EMULATE_NATURAL_OUTER_JOIN.contains(ctx.dialect());
|
||||
}
|
||||
|
||||
private final boolean emulateNaturalFullOuterJoin(Context<?> context) {
|
||||
return type == NATURAL_FULL_OUTER_JOIN && EMULATE_NATURAL_OUTER_JOIN.contains(context.family());
|
||||
private final boolean emulateNaturalFullOuterJoin(Context<?> ctx) {
|
||||
return type == NATURAL_FULL_OUTER_JOIN && EMULATE_NATURAL_OUTER_JOIN.contains(ctx.dialect());
|
||||
}
|
||||
|
||||
private final void toSQLJoinCondition(Context<?> context) {
|
||||
private final void toSQLJoinCondition(Context<?> ctx) {
|
||||
if (!using.isEmpty()) {
|
||||
boolean qualify = context.qualify();
|
||||
boolean qualify = ctx.qualify();
|
||||
|
||||
|
||||
|
||||
@ -467,30 +467,30 @@ implements
|
||||
|
||||
|
||||
|
||||
context.formatSeparator()
|
||||
.start(TABLE_JOIN_USING)
|
||||
.visit(K_USING)
|
||||
.sql(" (")
|
||||
.qualify(false)
|
||||
.visit(wrap(using).indentSize(0))
|
||||
.qualify(qualify)
|
||||
.sql(')')
|
||||
.end(TABLE_JOIN_USING);
|
||||
ctx.formatSeparator()
|
||||
.start(TABLE_JOIN_USING)
|
||||
.visit(K_USING)
|
||||
.sql(" (")
|
||||
.qualify(false)
|
||||
.visit(wrap(using).indentSize(0))
|
||||
.qualify(qualify)
|
||||
.sql(')')
|
||||
.end(TABLE_JOIN_USING);
|
||||
}
|
||||
|
||||
// [#577] If any NATURAL JOIN syntax needs to be emulated, find out
|
||||
// common fields in lhs and rhs of the JOIN clause
|
||||
else if (emulateNaturalJoin(context) ||
|
||||
emulateNaturalLeftOuterJoin(context) ||
|
||||
emulateNaturalRightOuterJoin(context) ||
|
||||
emulateNaturalFullOuterJoin(context)) {
|
||||
else if (emulateNaturalJoin(ctx) ||
|
||||
emulateNaturalLeftOuterJoin(ctx) ||
|
||||
emulateNaturalRightOuterJoin(ctx) ||
|
||||
emulateNaturalFullOuterJoin(ctx)) {
|
||||
|
||||
toSQLJoinCondition(context, naturalCondition());
|
||||
toSQLJoinCondition(ctx, naturalCondition());
|
||||
}
|
||||
|
||||
// Regular JOIN condition
|
||||
else {
|
||||
toSQLJoinCondition(context, condition);
|
||||
toSQLJoinCondition(ctx, condition);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1599,7 +1599,7 @@ implements
|
||||
// This can also happen in Firebird: http://tracker.firebirdsql.org/browse/JDBC-621
|
||||
|
||||
// [#10054] TODO: Skip all WHEN MATCHED clauses after a WHEN MATCHED clause with no search condition
|
||||
if (NO_SUPPORT_CONDITION_AFTER_NO_CONDITION.contains(ctx.family())) {
|
||||
if (NO_SUPPORT_CONDITION_AFTER_NO_CONDITION.contains(ctx.dialect())) {
|
||||
boolean withoutMatchedConditionFound = false;
|
||||
|
||||
for (MatchedClause m : matched) {
|
||||
@ -1662,7 +1662,7 @@ implements
|
||||
update.condition = update.condition.or(condition);
|
||||
}
|
||||
|
||||
if (REQUIRE_NEGATION.contains(ctx.family()))
|
||||
if (REQUIRE_NEGATION.contains(ctx.dialect()))
|
||||
negate = negate.andNot(m.condition instanceof NoCondition ? trueCondition() : m.condition);
|
||||
}
|
||||
|
||||
@ -1689,7 +1689,7 @@ implements
|
||||
}
|
||||
|
||||
// [#7291] Workaround for https://github.com/h2database/h2database/issues/2552
|
||||
else if (REQUIRE_NEGATION.contains(ctx.family())) {
|
||||
else if (REQUIRE_NEGATION.contains(ctx.dialect())) {
|
||||
Condition negate = noCondition();
|
||||
|
||||
for (MatchedClause m : matched) {
|
||||
|
||||
@ -123,7 +123,7 @@ final class MetaImpl extends AbstractMeta {
|
||||
super(configuration);
|
||||
|
||||
this.databaseMetaData = databaseMetaData;
|
||||
this.inverseSchemaCatalog = INVERSE_SCHEMA_CATALOG.contains(family());
|
||||
this.inverseSchemaCatalog = INVERSE_SCHEMA_CATALOG.contains(dialect());
|
||||
}
|
||||
|
||||
private interface MetaFunction {
|
||||
@ -876,11 +876,11 @@ final class MetaImpl extends AbstractMeta {
|
||||
try {
|
||||
|
||||
// [#7194] Some databases report all default values as expressions, not as values
|
||||
if (EXPRESSION_COLUMN_DEFAULT.contains(family()))
|
||||
if (EXPRESSION_COLUMN_DEFAULT.contains(dialect()))
|
||||
type = type.defaultValue(DSL.field(defaultValue, type));
|
||||
|
||||
// [#5574] MySQL mixes constant value expressions with other column expressions here
|
||||
else if (CURRENT_TIMESTAMP_COLUMN_DEFAULT.contains(family()) && "CURRENT_TIMESTAMP".equalsIgnoreCase(defaultValue))
|
||||
else if (CURRENT_TIMESTAMP_COLUMN_DEFAULT.contains(dialect()) && "CURRENT_TIMESTAMP".equalsIgnoreCase(defaultValue))
|
||||
type = type.defaultValue(DSL.field(defaultValue, type));
|
||||
else
|
||||
type = type.defaultValue(DSL.inline(defaultValue, type));
|
||||
|
||||
@ -152,7 +152,7 @@ final class QuantifiedComparisonCondition extends AbstractCondition implements L
|
||||
|
||||
// [#9224] Special case when a SQL dialect actually supports quantified
|
||||
// arrays, such as x = any(?::int[]) in PostgreSQL
|
||||
if (quantifiedArray && SUPPORTS_QUANTIFIED_ARRAYS.contains(ctx.family()) && !emulateOperator) {
|
||||
if (quantifiedArray && SUPPORTS_QUANTIFIED_ARRAYS.contains(ctx.dialect()) && !emulateOperator) {
|
||||
accept1(ctx);
|
||||
}
|
||||
else if (query.values != null || quantifiedArray) {
|
||||
|
||||
@ -114,7 +114,7 @@ final class RowCondition extends AbstractCondition {
|
||||
private final QueryPartInternal delegate(Configuration configuration) {
|
||||
// Regular comparison predicate emulation
|
||||
if ((comparator == EQUALS || comparator == NOT_EQUALS) &&
|
||||
EMULATE_EQ_AND_NE.contains(configuration.family())) {
|
||||
EMULATE_EQ_AND_NE.contains(configuration.dialect())) {
|
||||
|
||||
Field<?>[] leftFields = left.fields();
|
||||
Field<?>[] rightFields = right.fields();
|
||||
@ -133,7 +133,7 @@ final class RowCondition extends AbstractCondition {
|
||||
|
||||
// Ordering comparison predicate emulation
|
||||
else if ((comparator == GREATER || comparator == GREATER_OR_EQUAL || comparator == LESS || comparator == LESS_OR_EQUAL) &&
|
||||
EMULATE_RANGES.contains(configuration.family())) {
|
||||
EMULATE_RANGES.contains(configuration.dialect())) {
|
||||
|
||||
// The order component of the comparator (stripping the equal component)
|
||||
Comparator order
|
||||
|
||||
@ -109,7 +109,7 @@ final class RowInCondition extends AbstractCondition {
|
||||
}
|
||||
|
||||
private final QueryPartInternal delegate(Configuration configuration) {
|
||||
if (EMULATE_IN.contains(configuration.family())) {
|
||||
if (EMULATE_IN.contains(configuration.dialect())) {
|
||||
List<Condition> conditions = new ArrayList<>(right.size());
|
||||
|
||||
for (Row row : right)
|
||||
|
||||
@ -124,9 +124,9 @@ final class RowIsNull extends AbstractCondition {
|
||||
|
||||
|
||||
|
||||
if (row != null && EMULATE_NULL_ROW.contains(ctx.family()))
|
||||
if (row != null && EMULATE_NULL_ROW.contains(ctx.dialect()))
|
||||
ctx.visit(condition(row.fields()));
|
||||
else if (select != null && EMULATE_NULL_QUERY.contains(ctx.family())) {
|
||||
else if (select != null && EMULATE_NULL_QUERY.contains(ctx.dialect())) {
|
||||
Table<?> t = select.asTable("t", fieldNameStrings(select.getSelect().size()));
|
||||
ctx.visit(inline(1).eq(selectCount().from(t).where(condition(t.fields()))));
|
||||
}
|
||||
|
||||
@ -110,7 +110,7 @@ final class RowOverlapsCondition<T1, T2> extends AbstractCondition {
|
||||
boolean intervalOverlaps = type0.isDateTime() && (type1.isInterval() || type1.isNumeric());
|
||||
|
||||
// The non-standard OVERLAPS predicate is always emulated
|
||||
if (!standardOverlaps || EMULATE_NON_STANDARD_OVERLAPS.contains(ctx.family())) {
|
||||
if (!standardOverlaps || EMULATE_NON_STANDARD_OVERLAPS.contains(ctx.dialect())) {
|
||||
|
||||
// Interval OVERLAPS predicates need some additional arithmetic
|
||||
if (intervalOverlaps)
|
||||
@ -122,7 +122,7 @@ final class RowOverlapsCondition<T1, T2> extends AbstractCondition {
|
||||
}
|
||||
|
||||
// These dialects seem to have trouble with INTERVAL OVERLAPS predicates
|
||||
else if (intervalOverlaps && EMULATE_INTERVAL_OVERLAPS.contains(ctx.family()))
|
||||
else if (intervalOverlaps && EMULATE_INTERVAL_OVERLAPS.contains(ctx.dialect()))
|
||||
ctx.visit(right1.le(left1.add(left2)).and(left1.le(right1.add(right2))));
|
||||
|
||||
// Everyone else can handle OVERLAPS
|
||||
|
||||
@ -884,7 +884,7 @@ final class SelectQueryImpl<R extends Record> extends AbstractResultQuery<R> imp
|
||||
|
||||
// [#6583] Work around MySQL's self-reference-in-DML-subquery restriction
|
||||
if (context.subqueryLevel() == 1
|
||||
&& REQUIRES_DERIVED_TABLE_DML.contains(context.family())
|
||||
&& REQUIRES_DERIVED_TABLE_DML.contains(context.dialect())
|
||||
&& (dmlTable = (Table<?>) context.data(DATA_DML_TARGET_TABLE)) != null
|
||||
&& containsTable(dmlTable)) {
|
||||
context.visit(DSL.select(asterisk()).from(asTable("t")));
|
||||
@ -2216,18 +2216,18 @@ final class SelectQueryImpl<R extends Record> extends AbstractResultQuery<R> imp
|
||||
|
||||
// [#3579] [#6431] [#7222] Some databases don't support nested set operations at all
|
||||
// because they do not allow wrapping set op subqueries in parentheses
|
||||
NO_SUPPORT_UNION_PARENTHESES.contains(ctx.family())
|
||||
NO_SUPPORT_UNION_PARENTHESES.contains(ctx.dialect())
|
||||
|
||||
// [#3579] [#6431] [#7222] Nested set operations aren't supported, but parenthesised
|
||||
// set op subqueries are.
|
||||
|| (TRUE.equals(ctx.data(DATA_NESTED_SET_OPERATIONS)) && UNION_PARENTHESIS.contains(ctx.family()))
|
||||
|| (TRUE.equals(ctx.data(DATA_NESTED_SET_OPERATIONS)) && UNION_PARENTHESIS.contains(ctx.dialect()))
|
||||
|
||||
// [#2995] Ambiguity may need to be resolved when parentheses could mean both:
|
||||
// Set op subqueries or insert column lists
|
||||
|| TRUE.equals(ctx.data(DATA_INSERT_SELECT_WITHOUT_INSERT_COLUMN_LIST))
|
||||
|
||||
// [#7222] [#7711] Workaround for https://issues.apache.org/jira/browse/DERBY-6984
|
||||
|| (ctx.subquery() && UNION_PARENTHESIS_IN_DERIVED_TABLES.contains(ctx.family()))
|
||||
|| (ctx.subquery() && UNION_PARENTHESIS_IN_DERIVED_TABLES.contains(ctx.dialect()))
|
||||
;
|
||||
|
||||
parensRequired |= derivedTable;
|
||||
|
||||
@ -276,7 +276,7 @@ public class TableImpl<R extends Record> extends AbstractTable<R> {
|
||||
ctx.scopeMarkStart(this);
|
||||
|
||||
if (ctx.qualify() &&
|
||||
(!NO_SUPPORT_QUALIFIED_TVF_CALLS.contains(ctx.family()) || parameters == null || ctx.declareTables())) {
|
||||
(!NO_SUPPORT_QUALIFIED_TVF_CALLS.contains(ctx.dialect()) || parameters == null || ctx.declareTables())) {
|
||||
Schema mappedSchema = Tools.getMappedSchema(ctx.configuration(), getSchema());
|
||||
|
||||
if (mappedSchema != null && !"".equals(mappedSchema.getName())) {
|
||||
|
||||
@ -93,7 +93,7 @@ final class TableList extends QueryPartList<Table<?>> {
|
||||
|
||||
// [#4151] [#6117] Some databases don't allow for qualifying column
|
||||
// names here. Copy also to SelectQueryImpl
|
||||
boolean unqualified = UNQUALIFY_FIELDS.contains(ctx.family());
|
||||
boolean unqualified = UNQUALIFY_FIELDS.contains(ctx.dialect());
|
||||
boolean qualify = ctx.qualify();
|
||||
|
||||
if (unqualified)
|
||||
|
||||
@ -237,7 +237,7 @@ public class TableRecordImpl<R extends TableRecord<R>> extends AbstractRecord im
|
||||
|
||||
// [#1859] In some databases, not all fields can be fetched via getGeneratedKeys()
|
||||
if (TRUE.equals(configuration().settings().isReturnAllOnUpdatableRecord())
|
||||
&& REFRESH_GENERATED_KEYS.contains(configuration().family())
|
||||
&& REFRESH_GENERATED_KEYS.contains(configuration().dialect())
|
||||
&& this instanceof UpdatableRecord)
|
||||
((UpdatableRecord<?>) this).refresh(key.toArray(EMPTY_FIELD));
|
||||
}
|
||||
|
||||
@ -2586,7 +2586,7 @@ final class Tools {
|
||||
*/
|
||||
static final boolean needsBackslashEscaping(Configuration configuration) {
|
||||
BackslashEscaping escaping = getBackslashEscaping(configuration.settings());
|
||||
return escaping == ON || (escaping == DEFAULT && REQUIRES_BACKSLASH_ESCAPING.contains(configuration.family()));
|
||||
return escaping == ON || (escaping == DEFAULT && REQUIRES_BACKSLASH_ESCAPING.contains(configuration.dialect()));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -4696,7 +4696,7 @@ final class Tools {
|
||||
|
||||
// [#5356] Some dialects require the DEFAULT clause prior to the
|
||||
// NULL constraints clause
|
||||
if (DEFAULT_BEFORE_NULL.contains(ctx.family()))
|
||||
if (DEFAULT_BEFORE_NULL.contains(ctx.dialect()))
|
||||
toSQLDDLTypeDeclarationDefault(ctx, type);
|
||||
|
||||
if (!type.nullable())
|
||||
@ -4704,10 +4704,10 @@ final class Tools {
|
||||
|
||||
// Some databases default to NOT NULL, so explicitly setting columns to NULL is mostly required here
|
||||
// [#3400] [#4321] [#7392] ... but not in Derby, Firebird, HSQLDB
|
||||
else if (!NO_SUPPORT_NULL.contains(ctx.family()))
|
||||
else if (!NO_SUPPORT_NULL.contains(ctx.dialect()))
|
||||
ctx.sql(' ').visit(K_NULL);
|
||||
|
||||
if (!DEFAULT_BEFORE_NULL.contains(ctx.family()))
|
||||
if (!DEFAULT_BEFORE_NULL.contains(ctx.dialect()))
|
||||
toSQLDDLTypeDeclarationDefault(ctx, type);
|
||||
|
||||
toSQLDDLTypeDeclarationIdentityAfterNull(ctx, type);
|
||||
@ -4853,7 +4853,7 @@ final class Tools {
|
||||
}
|
||||
|
||||
// [#5807] These databases cannot use the DataType.getCastTypeName() (which is simply char in this case)
|
||||
if (type.getType() == UUID.class && NO_SUPPORT_CAST_TYPE_IN_DDL.contains(ctx.family())) {
|
||||
if (type.getType() == UUID.class && NO_SUPPORT_CAST_TYPE_IN_DDL.contains(ctx.dialect())) {
|
||||
toSQLDDLTypeDeclaration(ctx, VARCHAR(36));
|
||||
return;
|
||||
}
|
||||
@ -4864,13 +4864,13 @@ final class Tools {
|
||||
if (type.hasLength() || elementType.hasLength()) {
|
||||
|
||||
// [#6289] [#7191] Some databases don't support lengths on binary types
|
||||
if (type.isBinary() && NO_SUPPORT_BINARY_TYPE_LENGTH.contains(ctx.family()))
|
||||
if (type.isBinary() && NO_SUPPORT_BINARY_TYPE_LENGTH.contains(ctx.dialect()))
|
||||
ctx.sql(typeName);
|
||||
else if (type.length() > 0)
|
||||
ctx.sql(typeName).sql('(').sql(type.length()).sql(')');
|
||||
|
||||
// [#6745] [#9473] The DataType.getCastTypeName() cannot be used in some dialects, for DDL
|
||||
else if (NO_SUPPORT_CAST_TYPE_IN_DDL.contains(ctx.family()))
|
||||
else if (NO_SUPPORT_CAST_TYPE_IN_DDL.contains(ctx.dialect()))
|
||||
if (type.isBinary())
|
||||
ctx.sql(SQLDataType.BLOB.getTypeName(ctx.configuration()));
|
||||
else
|
||||
@ -4886,7 +4886,7 @@ final class Tools {
|
||||
ctx.sql(typeName);
|
||||
}
|
||||
}
|
||||
else if (type.hasPrecision() && type.precision() > 0 && (!type.isTimestamp() || !NO_SUPPORT_TIMESTAMP_PRECISION.contains(ctx.family()))) {
|
||||
else if (type.hasPrecision() && type.precision() > 0 && (!type.isTimestamp() || !NO_SUPPORT_TIMESTAMP_PRECISION.contains(ctx.dialect()))) {
|
||||
if (type.hasScale())
|
||||
ctx.sql(typeName).sql('(').sql(type.precision()).sql(", ").sql(type.scale()).sql(')');
|
||||
else
|
||||
|
||||
@ -473,7 +473,7 @@ public class UpdatableRecordImpl<R extends UpdatableRecord<R>> extends TableReco
|
||||
|
||||
// [#1547] MS Access and SQLite doesn't support FOR UPDATE. CUBRID and SQL Server
|
||||
// can emulate it, though!
|
||||
if (!NO_SUPPORT_FOR_UPDATE.contains(create().configuration().family()))
|
||||
if (!NO_SUPPORT_FOR_UPDATE.contains(create().dialect()))
|
||||
select.setForUpdate(true);
|
||||
|
||||
R record = select.fetchOne();
|
||||
|
||||
@ -555,7 +555,7 @@ final class UpdateQueryImpl<R extends Record> extends AbstractStoreQuery<R> impl
|
||||
if (multiRow != null) {
|
||||
|
||||
// [#6884] This syntax can be emulated trivially, if the RHS is not a SELECT subquery
|
||||
if (multiValue != null && !SUPPORT_RVE_SET.contains(ctx.family())) {
|
||||
if (multiValue != null && !SUPPORT_RVE_SET.contains(ctx.dialect())) {
|
||||
FieldMapForUpdate map = new FieldMapForUpdate(table(), UPDATE_SET_ASSIGNMENT);
|
||||
|
||||
for (int i = 0; i < multiRow.size(); i++) {
|
||||
@ -645,7 +645,7 @@ final class UpdateQueryImpl<R extends Record> extends AbstractStoreQuery<R> impl
|
||||
}
|
||||
|
||||
// [#2059] MemSQL does not support UPDATE ... ORDER BY
|
||||
if (limit != null && NO_SUPPORT_LIMIT.contains(ctx.family()) ) {
|
||||
if (limit != null && NO_SUPPORT_LIMIT.contains(ctx.dialect()) ) {
|
||||
Field<?>[] keyFields =
|
||||
table().getKeys().isEmpty()
|
||||
? new Field[] { table().rowid() }
|
||||
|
||||
@ -152,7 +152,7 @@ final class WindowSpecificationImpl extends AbstractQueryPart implements
|
||||
if (o.isEmpty()) {
|
||||
boolean requiresOrderBy =
|
||||
TRUE.equals(ctx.data(BooleanDataKey.DATA_ORDERED_WINDOW_FUNCTION))
|
||||
&& REQUIRES_ORDER_BY_IN_RANKING.contains(ctx.family());
|
||||
&& REQUIRES_ORDER_BY_IN_RANKING.contains(ctx.dialect());
|
||||
|
||||
|
||||
|
||||
@ -210,7 +210,7 @@ final class WindowSpecificationImpl extends AbstractQueryPart implements
|
||||
// Ignore PARTITION BY 1 clause. These databases erroneously map the
|
||||
// 1 literal onto the column index (CUBRID, Sybase), or do not support
|
||||
// constant expressions in the PARTITION BY clause (HANA)
|
||||
if (partitionByOne && OMIT_PARTITION_BY_ONE.contains(ctx.family())) {
|
||||
if (partitionByOne && OMIT_PARTITION_BY_ONE.contains(ctx.dialect())) {
|
||||
}
|
||||
else {
|
||||
if (hasWindowDefinitions)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user