@Override public boolean equals(Object obj) { if (obj == this) return true; if (obj instanceof Table) { Table that = (Table) obj; return this.id().equals(that.id()) && this.columns().equals(that.columns()) && this.primaryKeyColumnNames().equals(that.primaryKeyColumnNames()) && Strings.equalsIgnoreCase(this.defaultCharsetName(), that.defaultCharsetName()); } return false; }
/** * Load the database schema information using the previously-recorded history, and stop reading the history when the * the history reaches the supplied starting point. * * @param startingPoint the source information with the current {@link SourceInfo#partition()} and {@link SourceInfo#offset() * offset} at which the database schemas are to reflect; may not be null */ public void loadHistory(SourceInfo startingPoint) { // Read the system variables from the MySQL instance and load them into the DDL parser as defaults ... Map<String, String> variables = connectionContext.readMySqlCharsetSystemVariables(); dbSchema.setSystemVariables(variables); // And then load the history ... dbSchema.loadHistory(startingPoint); // The server's default character set may have changed since we last recorded it in the history, // so we need to see if the history's state does not match ... String systemCharsetName = variables.get(MySqlSystemVariables.CHARSET_NAME_SERVER); String systemCharsetNameFromHistory = dbSchema.systemVariables().getVariable(MySqlSystemVariables.CHARSET_NAME_SERVER); if (!Strings.equalsIgnoreCase(systemCharsetName, systemCharsetNameFromHistory)) { // The history's server character set is NOT the same as the server's current default, // so record the change in the history ... String ddlStatement = connectionContext.setStatementFor(variables); dbSchema.applyDdl(source, "", ddlStatement, null); } recordProcessor.regenerate(); }
@Override public boolean equals(Object obj) { if (obj == this) return true; if (obj instanceof Column) { Column that = (Column) obj; return this.name().equalsIgnoreCase(that.name()) && this.typeExpression().equalsIgnoreCase(that.typeExpression()) && this.typeName().equalsIgnoreCase(that.typeName()) && this.jdbcType() == that.jdbcType() && Strings.equalsIgnoreCase(this.charsetName(),that.charsetName()) && this.position() == that.position() && this.length() == that.length() && this.scale().equals(that.scale()) && this.isOptional() == that.isOptional() && this.isAutoIncremented() == that.isAutoIncremented() && this.isGenerated() == that.isGenerated() && Objects.equals(this.defaultValue(), that.defaultValue()) && this.hasDefaultValue() == that.hasDefaultValue(); } return false; }
@Override public boolean equals(Object obj) { if (obj == this) return true; if (obj instanceof Table) { Table that = (Table) obj; return this.id().equals(that.id()) && this.columns().equals(that.columns()) && this.primaryKeyColumnNames().equals(that.primaryKeyColumnNames()) && Strings.equalsIgnoreCase(this.defaultCharsetName(), that.defaultCharsetName()); } return false; }
@Override public boolean equals(Object obj) { if (obj == this) return true; if (obj instanceof Column) { Column that = (Column) obj; return this.name().equalsIgnoreCase(that.name()) && this.typeExpression().equalsIgnoreCase(that.typeExpression()) && this.typeName().equalsIgnoreCase(that.typeName()) && this.jdbcType() == that.jdbcType() && Strings.equalsIgnoreCase(this.charsetName(),that.charsetName()) && this.position() == that.position() && this.length() == that.length() && this.scale().equals(that.scale()) && this.isOptional() == that.isOptional() && this.isAutoIncremented() == that.isAutoIncremented() && this.isGenerated() == that.isGenerated() && Objects.equals(this.defaultValue(), that.defaultValue()) && this.hasDefaultValue() == that.hasDefaultValue(); } return false; }