/// <inheritdoc/> public override string Translate(SqlCompilerContext context, SqlAlterTable node, AlterTableSection section) { switch (section) { case AlterTableSection.AddColumn: return("ADD"); case AlterTableSection.AlterColumn: return("ALTER"); case AlterTableSection.DropColumn: return("DROP"); case AlterTableSection.RenameColumn: return("ALTER"); case AlterTableSection.DropBehavior: return(string.Empty); } return(base.Translate(context, node, section)); }
public override string Translate(SqlCompilerContext context, SqlAlterTable node, AlterTableSection section) { switch (section) { case AlterTableSection.DropBehavior: var cascadableAction = node.Action as SqlCascadableAction; if (cascadableAction == null || !cascadableAction.Cascade) { return(string.Empty); } if (cascadableAction is SqlDropConstraint) { return(string.Empty); } return(cascadableAction.Cascade ? "CASCADE" : "RESTRICT"); default: return(base.Translate(context, node, section)); } }
/// <inheritdoc/> public override string Translate(SqlCompilerContext context, SqlAlterTable node, AlterTableSection section) { switch (section) { case AlterTableSection.Entry: return("ALTER TABLE " + Translate(context, node.Table)); case AlterTableSection.AddColumn: return("ADD"); case AlterTableSection.Exit: return(string.Empty); default: throw SqlHelper.NotSupported(node.Action.GetType().Name); } }
public override string Translate(SqlCompilerContext context, SqlAlterTable node, AlterTableSection section) { switch (section) { case AlterTableSection.AddColumn: return("ADD"); case AlterTableSection.DropBehavior: var cascadableAction = node.Action as SqlCascadableAction; if (cascadableAction == null || !cascadableAction.Cascade) { return(string.Empty); } if (cascadableAction is SqlDropConstraint) { return("CASCADE"); } if (cascadableAction is SqlDropColumn) { return("CASCADE CONSTRAINTS"); } throw new ArgumentOutOfRangeException("node.Action"); default: return(base.Translate(context, node, section)); } }