[jOOQ/jOOQ#18520] Interpreter can only work with the first
Settings.interpreterSearchPath
This commit is contained in:
parent
cd5914bb2f
commit
a5d683ec24
@ -1452,7 +1452,7 @@ final class Interpreter {
|
||||
|
||||
private final MutableSchema getSchema(Schema input, boolean create, boolean throwIfNotExists) {
|
||||
if (input == null)
|
||||
return currentSchema(create);
|
||||
return currentSchema();
|
||||
|
||||
MutableCatalog catalog = defaultCatalog;
|
||||
if (input.getCatalog() != null) {
|
||||
@ -1477,21 +1477,28 @@ final class Interpreter {
|
||||
return schema;
|
||||
}
|
||||
|
||||
private final MutableSchema currentSchema(boolean create) {
|
||||
private final MutableSchema currentSchema() {
|
||||
if (currentSchema == null)
|
||||
currentSchema = getInterpreterSearchPathSchema(create);
|
||||
currentSchema = getInterpreterSearchPathSchemas().get(0);
|
||||
|
||||
return currentSchema;
|
||||
}
|
||||
|
||||
private final MutableSchema getInterpreterSearchPathSchema(boolean create) {
|
||||
private final List<MutableSchema> getInterpreterSearchPathSchemas() {
|
||||
List<InterpreterSearchSchema> searchPath = configuration.settings().getInterpreterSearchPath();
|
||||
|
||||
if (searchPath.isEmpty())
|
||||
return defaultSchema;
|
||||
return asList(defaultSchema);
|
||||
|
||||
InterpreterSearchSchema schema = searchPath.get(0);
|
||||
return getSchema(schema(name(schema.getCatalog(), schema.getSchema())), create, false);
|
||||
List<MutableSchema> result = new ArrayList<>();
|
||||
for (InterpreterSearchSchema schema : searchPath) {
|
||||
MutableSchema s = getSchema(schema(name(schema.getCatalog(), schema.getSchema())), false, false);
|
||||
|
||||
if (s != null)
|
||||
result.add(s);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private final MutableTable newTable(
|
||||
@ -1535,7 +1542,19 @@ final class Interpreter {
|
||||
}
|
||||
|
||||
private final MutableTable table(Table<?> table, boolean throwIfNotExists) {
|
||||
MutableTable result = getSchema(table.getSchema(), false, throwIfNotExists).table(table, true);
|
||||
MutableTable result = null;
|
||||
|
||||
if (table.getSchema() != null) {
|
||||
result = getSchema(table.getSchema(), false, throwIfNotExists).table(table, true);
|
||||
}
|
||||
else {
|
||||
for (MutableSchema s : getInterpreterSearchPathSchemas()) {
|
||||
result = s.table(table, true);
|
||||
|
||||
if (result != null)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (result == null && throwIfNotExists)
|
||||
throw notExists(table);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user