[jOOQ/jOOQ#13764] Refactor internal schema mapping logic to use the new QualifiedImpl type

This commit is contained in:
Lukas Eder 2022-07-05 14:49:28 +02:00
parent f9b777f5ea
commit 9fe180919c
6 changed files with 10 additions and 24 deletions

View File

@ -140,9 +140,6 @@ package org.jooq.impl;

View File

@ -113,9 +113,6 @@ package org.jooq.impl;

View File

@ -37,6 +37,7 @@
*/
package org.jooq.impl;
import static org.jooq.SQLDialect.CUBRID;
import static org.jooq.impl.Tools.getMappedSchema;
import org.jooq.Catalog;
@ -63,13 +64,16 @@ final class QualifiedImpl extends AbstractNamed implements Qualified, UTransient
// XXX: QueryPart
// -------------------------------------------------------------------------
@Override
public final void accept(Context<?> ctx) {
Schema mappedSchema = getMappedSchema(ctx, getSchema());
static final void acceptMappedSchemaPrefix(Context<?> ctx, Schema schema) {
Schema mappedSchema = getMappedSchema(ctx, schema);
if (mappedSchema != null && !"".equals(mappedSchema.getName()))
ctx.visit(mappedSchema).sql('.');
}
@Override
public final void accept(Context<?> ctx) {
acceptMappedSchemaPrefix(ctx, getSchema());
ctx.visit(getUnqualifiedName());
}

View File

@ -343,11 +343,7 @@ implements
Schema mappedSchema = getMappedSchema(ctx, schema);
if (mappedSchema != null && !"".equals(mappedSchema.getName()) && ctx.family() != CUBRID)
ctx.visit(mappedSchema)
.sql('.');
QualifiedImpl.acceptMappedSchemaPrefix(ctx, getSchema());
if (nameIsPlainSQL)
ctx.sql(getName());

View File

@ -410,12 +410,7 @@ implements
)) {
Schema mappedSchema = Tools.getMappedSchema(ctx, getSchema());
if (mappedSchema != null && !"".equals(mappedSchema.getName())) {
ctx.visit(mappedSchema);
ctx.sql('.');
}
QualifiedImpl.acceptMappedSchemaPrefix(ctx, getSchema());
}
ctx.visit(getMappedTable(ctx, this).getUnqualifiedName());

View File

@ -159,10 +159,7 @@ implements
@Override
public final void accept(Context<?> ctx) {
Schema mappedSchema = getMappedSchema(ctx, getSchema());
if (mappedSchema != null && !"".equals(mappedSchema.getName()))
ctx.visit(mappedSchema).sql('.');
QualifiedImpl.acceptMappedSchemaPrefix(ctx, getSchema());