[jOOQ/jOOQ#7172] [jOOQ/jOOQ#10274] Fix also SchemaImpl::equals
Just like TableImpl::equals, SchemaImpl::equals must not use getQualifiedName() yet, but call getCatalog() for it to work correctly with generated code.
This commit is contained in:
parent
9a60e71852
commit
681f14b2e8
@ -66,6 +66,7 @@ public class CatalogImpl extends AbstractNamed implements Catalog {
|
||||
*/
|
||||
private static final long serialVersionUID = -3650318934053960244L;
|
||||
private static final Clause[] CLAUSES = { CATALOG, CATALOG_REFERENCE };
|
||||
static final Catalog DEFAULT_CATALOG = new CatalogImpl("");
|
||||
|
||||
public CatalogImpl(Name name) {
|
||||
this(name, null);
|
||||
|
||||
@ -40,6 +40,8 @@ package org.jooq.impl;
|
||||
|
||||
import static org.jooq.Clause.SCHEMA;
|
||||
import static org.jooq.Clause.SCHEMA_REFERENCE;
|
||||
import static org.jooq.impl.CatalogImpl.DEFAULT_CATALOG;
|
||||
import static org.jooq.tools.StringUtils.defaultIfNull;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@ -56,6 +58,7 @@ import org.jooq.Schema;
|
||||
import org.jooq.Sequence;
|
||||
import org.jooq.Table;
|
||||
import org.jooq.UDT;
|
||||
import org.jooq.tools.StringUtils;
|
||||
|
||||
/**
|
||||
* A common base class for database schemata
|
||||
@ -218,4 +221,30 @@ public class SchemaImpl extends AbstractNamed implements Schema {
|
||||
return getSequences().stream();
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// XXX: Object API
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (this == that)
|
||||
return true;
|
||||
|
||||
// [#2144] SchemaImpl equality can be decided without executing the
|
||||
// rather expensive implementation of AbstractQueryPart.equals()
|
||||
if (that instanceof SchemaImpl) {
|
||||
SchemaImpl other = (SchemaImpl) that;
|
||||
return
|
||||
|
||||
// [#7172] [#10274] Cannot use getQualifiedName() yet here
|
||||
StringUtils.equals(
|
||||
defaultIfNull(getCatalog(), DEFAULT_CATALOG),
|
||||
defaultIfNull(other.getCatalog(), DEFAULT_CATALOG)
|
||||
) &&
|
||||
StringUtils.equals(getName(), other.getName());
|
||||
}
|
||||
|
||||
return super.equals(that);
|
||||
}
|
||||
}
|
||||
|
||||
@ -229,6 +229,12 @@ public class TableImpl<R extends Record> extends AbstractTable<R> {
|
||||
return fields;
|
||||
}
|
||||
|
||||
// [#8489] this override is necessary due to a Scala compiler bug (versions 2.10 and 2.11)
|
||||
@Override
|
||||
public Row fieldsRow() {
|
||||
return super.fieldsRow();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Clause[] clauses(Context<?> ctx) {
|
||||
return alias != null ? CLAUSES_TABLE_ALIAS : CLAUSES_TABLE_REFERENCE;
|
||||
@ -357,9 +363,8 @@ public class TableImpl<R extends Record> extends AbstractTable<R> {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (this == that) {
|
||||
if (this == that)
|
||||
return true;
|
||||
}
|
||||
|
||||
// [#2144] TableImpl equality can be decided without executing the
|
||||
// rather expensive implementation of AbstractQueryPart.equals()
|
||||
@ -378,11 +383,4 @@ public class TableImpl<R extends Record> extends AbstractTable<R> {
|
||||
|
||||
return super.equals(that);
|
||||
}
|
||||
|
||||
// [#8489] this override is necessary due to a Scala compiler bug (versions 2.10 and 2.11)
|
||||
@Override
|
||||
public Row fieldsRow() {
|
||||
return super.fieldsRow();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user