protected virtual void VisitDeleteCommandTree(DbDeleteCommandTree deleteTree) { //Contract.Requires(deleteTree != null); VisitExpressionBindingPre(deleteTree.Target); VisitExpression(deleteTree.Predicate); VisitExpressionBindingPost(deleteTree.Target); }
protected virtual void VisitDeleteCommandTree(DbDeleteCommandTree deleteTree) { EntityUtil.CheckArgumentNull(deleteTree, "deleteTree"); this.VisitExpressionBindingPre(deleteTree.Target); this.VisitExpression(deleteTree.Predicate); this.VisitExpressionBindingPost(deleteTree.Target); }
internal static string GenerateDeleteSql(DbDeleteCommandTree tree, out List<DbParameter> parameters) { StringBuilder commandText = new StringBuilder(CommandTextBuilderInitialCapacity); ExpressionTranslator translator = new ExpressionTranslator(commandText, tree, false); commandText.Append("DELETE FROM "); tree.Target.Expression.Accept(translator); commandText.AppendLine(); // where c1 = ... AND c2 = ... commandText.Append("WHERE "); tree.Predicate.Accept(translator); parameters = translator.Parameters; return commandText.ToString(); }
/// <summary> /// Builds a delete command. /// </summary> /// <param name="oldRow">Value of the row being deleted.</param> /// <param name="processor">Context for the table containing row.</param> /// <returns>Delete command.</returns> internal UpdateCommand BuildDeleteCommand(PropagatorResult oldRow, TableChangeProcessor processor) { // If we're deleting a row, the row must always be touched bool rowMustBeTouched = true; // Initialize DML command tree DbExpressionBinding target = GetTarget(processor); // Create delete predicate DbExpression predicate = BuildPredicate(target, oldRow, null, processor, ref rowMustBeTouched); DbDeleteCommandTree commandTree = new DbDeleteCommandTree(m_translator.MetadataWorkspace, DataSpace.SSpace, target, predicate); // Set command // Initialize delete command UpdateCommand command = new DynamicUpdateCommand(processor, m_translator, ModificationOperator.Delete, oldRow, null, commandTree, null); return command; }
internal static string[] GenerateDeleteSql(DbDeleteCommandTree tree, out List<DbParameter> parameters, bool isLocalProvider) { var commandTexts = new List<String>(); var commandText = new StringBuilder(s_commandTextBuilderInitialCapacity); var translator = new ExpressionTranslator(commandText, tree, false, isLocalProvider); // delete [schemaName].[tableName] commandText.Append("delete "); tree.Target.Expression.Accept(translator); commandText.AppendLine(); // where c1 = ... AND c2 = ... commandText.Append("where "); tree.Predicate.Accept(translator); commandTexts.Add(commandText.ToString()); commandText.Length = 0; parameters = translator.Parameters; return commandTexts.ToArray(); }
public SqlDeleteGenerator(DbDeleteCommandTree commandTree) { _commandTree = commandTree; }
internal static string GenerateDeleteSql(DbDeleteCommandTree tree, SqlVersion sqlVersion, out List<SqlParameter> parameters) { StringBuilder commandText = new StringBuilder(s_commandTextBuilderInitialCapacity); ExpressionTranslator translator = new ExpressionTranslator(commandText, tree, false, sqlVersion); // delete [schemaName].[tableName] commandText.Append("delete "); tree.Target.Expression.Accept(translator); commandText.AppendLine(); // where c1 = ... AND c2 = ... commandText.Append("where "); tree.Predicate.Accept(translator); parameters = translator.Parameters; return commandText.ToString(); }