[jOOQ/jOOQ#15318] MetaImpl is missing view source code or unique constraints for objects in other catalogs
This commit is contained in:
parent
679b0c7f63
commit
3d3a7bc0ca
@ -197,6 +197,48 @@ final class MetaImpl extends AbstractMeta {
|
||||
}
|
||||
catch (SQLException e) {
|
||||
throw new DataAccessException("Error while running MetaFunction", e);
|
||||
}
|
||||
}
|
||||
|
||||
private static final <T, E extends Exception> T withCatalog(Catalog catalog, DSLContext ctx, ThrowingFunction<DSLContext, T, E> supplier) throws E {
|
||||
String previous = null;
|
||||
Exception e = null;
|
||||
|
||||
try {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return supplier.apply(ctx);
|
||||
}
|
||||
catch (Exception x) {
|
||||
e = x;
|
||||
throw (E) x;
|
||||
}
|
||||
finally {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -473,14 +515,18 @@ final class MetaImpl extends AbstractMeta {
|
||||
String sql = M_UNIQUE_KEYS(family());
|
||||
|
||||
if (sql != null) {
|
||||
Result<Record> result = meta(meta -> DSL.using(meta.getConnection(), family()).resultQuery(
|
||||
sql,
|
||||
NO_SUPPORT_SCHEMAS.contains(dialect())
|
||||
? EMPTY_OBJECT
|
||||
: inverseSchemaCatalog
|
||||
? new Object[] { catalog }
|
||||
: new Object[] { schema }
|
||||
).fetch());
|
||||
Result<Record> result = meta(meta ->
|
||||
withCatalog(DSL.catalog(catalog), DSL.using(meta.getConnection(), family()), ctx ->
|
||||
ctx.resultQuery(
|
||||
sql,
|
||||
NO_SUPPORT_SCHEMAS.contains(dialect())
|
||||
? EMPTY_OBJECT
|
||||
: inverseSchemaCatalog
|
||||
? new Object[] { catalog }
|
||||
: new Object[] { schema }
|
||||
).fetch()
|
||||
)
|
||||
);
|
||||
|
||||
// TODO Support catalogs as well
|
||||
Map<Record, Result<Record>> groups = result.intoGroups(new Field[] { result.field(0), result.field(1), result.field(2) });
|
||||
@ -644,7 +690,11 @@ final class MetaImpl extends AbstractMeta {
|
||||
String sql = M_SOURCES(family());
|
||||
|
||||
if (sql != null) {
|
||||
Result<Record> result = meta(meta -> DSL.using(meta.getConnection(), family()).resultQuery(sql, MetaSchema.this.getName()).fetch());
|
||||
Result<Record> result = meta(meta ->
|
||||
withCatalog(getCatalog(), DSL.using(meta.getConnection(), family()), ctx ->
|
||||
ctx.resultQuery(sql, MetaSchema.this.getName()).fetch()
|
||||
)
|
||||
);
|
||||
|
||||
// TODO Support catalogs as well
|
||||
Map<Record, Result<Record>> groups = result.intoGroups(new Field[] { result.field(0), result.field(1), result.field(2) });
|
||||
|
||||
Loading…
Reference in New Issue
Block a user