This commit is contained in:
Lukas Eder 2021-04-28 19:40:24 +02:00
parent 15b3f28ee5
commit 2b28bc4ad4
4 changed files with 14 additions and 10 deletions

View File

@ -472,8 +472,8 @@ public abstract class AbstractDatabase implements Database {
* {@link SQLDialect#POSTGRES_12} without needing to query the information
* schema.
*/
protected boolean configuredDialectIsNotFamilyAndSupports(SQLDialect d, Supplier<Boolean> ifFamily) {
return getDialect().isFamily() ? ifFamily.get() : getDialect().supports(d);
protected boolean configuredDialectIsNotFamilyAndSupports(List<SQLDialect> d, Supplier<Boolean> ifFamily) {
return getDialect().isFamily() ? ifFamily.get() : d.stream().allMatch(getDialect()::supports);
}
@Override

View File

@ -37,6 +37,7 @@
*/
package org.jooq.meta.firebird;
import static java.util.Arrays.asList;
import static java.util.stream.Collectors.mapping;
import static org.jooq.SQLDialect.FIREBIRD;
import static org.jooq.impl.DSL.any;
@ -74,6 +75,7 @@ import static org.jooq.meta.firebird.rdb.Tables.RDB$TRIGGERS;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
@ -660,7 +662,7 @@ public class FirebirdDatabase extends AbstractDatabase implements ResultQueryDat
// [#4254] RDB$GENERATORS.RDB$INITIAL_VALUE was added in Firebird 3.0 only
if (is30 == null)
is30 = configuredDialectIsNotFamilyAndSupports(FIREBIRD_3_0, () -> exists(RDB$GENERATORS.RDB$INITIAL_VALUE));
is30 = configuredDialectIsNotFamilyAndSupports(asList(FIREBIRD), () -> exists(RDB$GENERATORS.RDB$INITIAL_VALUE));
return is30;
}

View File

@ -38,6 +38,7 @@
package org.jooq.meta.mysql;
import static java.util.Arrays.asList;
import static java.util.stream.Collectors.mapping;
import static java.util.stream.Collectors.toList;
import static org.jooq.SQLDialect.MYSQL;
@ -241,7 +242,7 @@ public class MySQLDatabase extends AbstractDatabase implements ResultQueryDataba
// [#6602] The mysql.proc table got removed in MySQL 8.0
if (is8 == null)
is8 = configuredDialectIsNotFamilyAndSupports(MYSQL_8_0, () -> !exists(PROC));
is8 = configuredDialectIsNotFamilyAndSupports(asList(MYSQL), () -> !exists(PROC));
return is8;
}
@ -250,7 +251,7 @@ public class MySQLDatabase extends AbstractDatabase implements ResultQueryDataba
// [#7639] The information_schema.check_constraints table was added in MySQL 8.0.16 only
if (is8_0_16 == null)
is8_0_16 = configuredDialectIsNotFamilyAndSupports(MYSQL_8_0_19, () -> exists(CHECK_CONSTRAINTS));
is8_0_16 = configuredDialectIsNotFamilyAndSupports(asList(MYSQL), () -> exists(CHECK_CONSTRAINTS));
return is8_0_16;
}

View File

@ -38,6 +38,7 @@
package org.jooq.meta.postgres;
import static java.util.Arrays.asList;
import static java.util.stream.Collectors.mapping;
import static java.util.stream.Collectors.toList;
import static org.jooq.Rows.toRowArray;
@ -1000,7 +1001,7 @@ public class PostgresDatabase extends AbstractDatabase implements ResultQueryDat
boolean is84() {
if (is84 == null) {
is84 = configuredDialectIsNotFamilyAndSupports(POSTGRES_9_3, () -> {
is84 = configuredDialectIsNotFamilyAndSupports(asList(POSTGRES), () -> {
// [#2916] Window functions were introduced with PostgreSQL 9.0
try {
@ -1024,7 +1025,7 @@ public class PostgresDatabase extends AbstractDatabase implements ResultQueryDat
// [#4254] INFORMATION_SCHEMA.PARAMETERS.PARAMETER_DEFAULT was added
// in PostgreSQL 9.4 only
if (is94 == null)
is94 = configuredDialectIsNotFamilyAndSupports(POSTGRES_9_4, () -> exists(PARAMETERS.PARAMETER_DEFAULT));
is94 = configuredDialectIsNotFamilyAndSupports(asList(POSTGRES), () -> exists(PARAMETERS.PARAMETER_DEFAULT));
return is94;
}
@ -1033,7 +1034,7 @@ public class PostgresDatabase extends AbstractDatabase implements ResultQueryDat
// [#7785] pg_sequence was added in PostgreSQL 10 only
if (is10 == null)
is10 = configuredDialectIsNotFamilyAndSupports(POSTGRES_10, () -> exists(PG_SEQUENCE.SEQRELID));
is10 = configuredDialectIsNotFamilyAndSupports(asList(POSTGRES), () -> exists(PG_SEQUENCE.SEQRELID));
return is10;
}
@ -1043,7 +1044,7 @@ public class PostgresDatabase extends AbstractDatabase implements ResultQueryDat
// [#7785] pg_proc.prokind was added in PostgreSQL 11 only, and
// pg_proc.proisagg was removed, incompatibly
if (is11 == null)
is11 = configuredDialectIsNotFamilyAndSupports(POSTGRES_11, () -> exists(PG_PROC.PROKIND));
is11 = configuredDialectIsNotFamilyAndSupports(asList(POSTGRES), () -> exists(PG_PROC.PROKIND));
return is11;
}
@ -1052,7 +1053,7 @@ public class PostgresDatabase extends AbstractDatabase implements ResultQueryDat
// [#11325] nameconcatoid was added in PostgreSQL 12 only
if (is12 == null)
is12 = configuredDialectIsNotFamilyAndSupports(POSTGRES_12, () -> exists(table(select(field("nameconcatoid({0}, {1})", PG_PROC.PRONAME, oid(PG_PROC))).from(PG_PROC))));
is12 = configuredDialectIsNotFamilyAndSupports(asList(POSTGRES), () -> exists(table(select(field("nameconcatoid({0}, {1})", PG_PROC.PRONAME, oid(PG_PROC))).from(PG_PROC))));
return is12;
}