public boolean isSameObject(DatabaseObject databaseObject1, DatabaseObject databaseObject2, Database accordingTo, DatabaseObjectComparatorChain chain) {
if (!(databaseObject1 instanceof Schema && databaseObject2 instanceof Schema)) {
return false;
}
CatalogAndSchema thisSchema = ((Schema) databaseObject1).toCatalogAndSchema().standardize(accordingTo);
CatalogAndSchema otherSchema = ((Schema) databaseObject2).toCatalogAndSchema().standardize(accordingTo);
if (accordingTo.supportsCatalogs()) {
if (thisSchema.getCatalogName() == null) {
if (!(otherSchema.getCatalogName() == null || accordingTo.getDefaultCatalogName() == null || accordingTo.getDefaultCatalogName().equalsIgnoreCase(otherSchema.getCatalogName()))) {
return false;
}
} else {
if (!thisSchema.getCatalogName().equalsIgnoreCase(otherSchema.getCatalogName())) {
return false;
}
}
}
if (accordingTo.supportsCatalogs() && accordingTo.supportsSchemas()) {
String thisSchemaName = thisSchema.getSchemaName();
String otherSchemaName = otherSchema.getSchemaName();
if (thisSchemaName == null) {
return otherSchemaName == null;
}
return thisSchemaName.equalsIgnoreCase(otherSchemaName);
}