[jOOQ/jOOQ#12240] Apply fix only to SQL Server
A lot of dialects report some sort of catalog, which can't be used in SQL, and which we don't know anything about. We mustn't use that catalog for lookups
This commit is contained in:
parent
57115719a9
commit
11d4cfef21
@ -74,6 +74,7 @@ import static org.jooq.impl.Tools.flatMap;
|
||||
import static org.jooq.impl.Tools.map;
|
||||
import static org.jooq.tools.StringUtils.defaultIfEmpty;
|
||||
import static org.jooq.tools.StringUtils.defaultString;
|
||||
import static org.jooq.tools.StringUtils.isEmpty;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.sql.DatabaseMetaData;
|
||||
@ -158,6 +159,10 @@ final class MetaImpl extends AbstractMeta {
|
||||
this.inverseSchemaCatalog = INVERSE_SCHEMA_CATALOG.contains(dialect());
|
||||
}
|
||||
|
||||
final boolean hasCatalog(Catalog catalog) {
|
||||
return catalog != null && !isEmpty(catalog.getName());
|
||||
}
|
||||
|
||||
final <R> R catalogSchema(Catalog catalog, Schema schema, ThrowingBiFunction<String, String, R, SQLException> function) throws SQLException {
|
||||
return catalogSchema(
|
||||
catalog != null ? catalog.getName() : null,
|
||||
@ -824,7 +829,7 @@ final class MetaImpl extends AbstractMeta {
|
||||
|
||||
// [#7377] The schema may be null instead of "" in some dialects
|
||||
Schema schema = schemas.get(name(
|
||||
defaultString(k.get(0, String.class)),
|
||||
hasCatalog(getCatalog()) ? defaultString(k.get(0, String.class)) : null,
|
||||
defaultString(k.get(1, String.class))
|
||||
));
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user