protected override Expression VisitUpdate(UpdateCommand update) { this.Write("UPDATE "); this.WriteTableName(update.Table.Name); this.WriteLine(Indentation.Same); bool hideColumnAliases = this.HideColumnAliases; this.HideColumnAliases = true; this.Write("SET "); int num = 0; int count = update.Assignments.Count; while (num < count) { ColumnAssignment assignment = update.Assignments[num]; if (num > 0) { this.Write(", "); } this.Visit(assignment.Column); this.Write(" = "); this.Visit(assignment.Expression); num++; } if (update.Where != null) { this.WriteLine(Indentation.Same); this.Write("WHERE "); this.VisitPredicate(update.Where); } this.HideColumnAliases = hideColumnAliases; return(update); }
protected virtual ColumnAssignment VisitColumnAssignment(ColumnAssignment ca) { ColumnExpression c = (ColumnExpression)this.Visit(ca.Column); Expression e = this.Visit(ca.Expression); return(this.UpdateColumnAssignment(ca, c, e)); }
protected virtual ReadOnlyCollection <ColumnAssignment> VisitColumnAssignments(ReadOnlyCollection <ColumnAssignment> assignments) { List <ColumnAssignment> list = null; int count = 0; int num2 = assignments.Count; while (count < num2) { ColumnAssignment item = this.VisitColumnAssignment(assignments[count]); if ((list == null) && (item != assignments[count])) { list = assignments.Take <ColumnAssignment>(count).ToList <ColumnAssignment>(); } if (list != null) { list.Add(item); } count++; } if (list != null) { return(list.AsReadOnly()); } return(assignments); }
protected ColumnAssignment UpdateColumnAssignment(ColumnAssignment ca, ColumnExpression c, Expression e) { if ((c != ca.Column) || (e != ca.Expression)) { return(new ColumnAssignment(c, e)); } return(ca); }
protected override ColumnAssignment VisitColumnAssignment(ColumnAssignment ca) { ca = base.VisitColumnAssignment(ca); Expression e = ca.Expression; NamedValueExpression expression2 = e as NamedValueExpression; if (expression2 != null) { e = new NamedValueExpression(expression2.Name, ca.Column.QueryType, expression2.Value); } return(base.UpdateColumnAssignment(ca, ca.Column, e)); }