public override IEnumerable <Command> HandleAlterCollation(Identifier fieldName, Identifier relationName, IHasCollation collation, IHasCollation otherCollation) { if (collation.CollationId != null && otherCollation.CollationId != collation.CollationId) { throw new NotSupportedOnFirebirdException($"Altering collation on the field is not supported ({relationName}.{fieldName})."); } yield break; }
public virtual IEnumerable <Command> HandleAlterCollation(Identifier fieldName, Identifier relationName, IHasCollation collation, IHasCollation otherCollation) { if (collation.CollationId != null && otherCollation.CollationId != collation.CollationId) { var systemTableName = relationName != null ? "RDB$RELATION_FIELDS" : "RDB$FIELDS"; var builder = new StringBuilder(); builder .Append($"UPDATE {systemTableName}") .AppendLine() .Append($" SET RDB$COLLATION_ID = {collation.CollationId}") .AppendLine() .Append($"WHERE RDB$FIELD_NAME = '{fieldName}'"); if (relationName != null) { builder.Append($" AND RDB$RELATION_NAME = '{relationName}'"); } yield return(new Command().Append(builder.ToString())); } }