protected virtual bool CompareInsertSelect(InsertSelectExpression a, InsertSelectExpression b) { return(a.Table == b.Table && a.UseHistoryTable == b.UseHistoryTable && CompareList(a.Assigments, b.Assigments, CompareAssigment) && Compare(a.Source, b.Source)); }
protected internal override Expression VisitInsertSelect(InsertSelectExpression insertSelect) { if (insertSelect.ReturnRowCount == false) { return(insertSelect); } return(new InsertSelectExpression(insertSelect.Table, insertSelect.UseHistoryTable, insertSelect.Source, insertSelect.Assigments, returnRowCount: false)); }
protected internal virtual Expression VisitInsertSelect(InsertSelectExpression insertSelect) { var source = VisitSource(insertSelect.Source); var assigments = Visit(insertSelect.Assigments, VisitColumnAssigment); if (source != insertSelect.Source || assigments != insertSelect.Assigments) { return(new InsertSelectExpression(insertSelect.Table, insertSelect.UseHistoryTable, (SourceWithAliasExpression)source, assigments, insertSelect.ReturnRowCount)); } return(insertSelect); }
protected internal override Expression VisitInsertSelect(InsertSelectExpression insertSelect) { var assigments = Visit(insertSelect.Assigments, VisitColumnAssigment); var source = Visit(insertSelect.Source); if (source != insertSelect.Source || assigments != insertSelect.Assigments) { return(new InsertSelectExpression(insertSelect.Table, (SourceWithAliasExpression)source, assigments)); } return(insertSelect); }
protected internal override Expression VisitInsertSelect(InsertSelectExpression insertSelect) { var coll = GetColumnCollector(insertSelect.Source.KnownAliases); foreach (var ca in insertSelect.Assigments) { coll.Visit(ca.Expression); } var source = Visit(insertSelect.Source); var assigments = Visit(insertSelect.Assigments, VisitColumnAssigment); if (source != insertSelect.Source || assigments != insertSelect.Assigments) { return(new InsertSelectExpression(insertSelect.Table, insertSelect.UseHistoryTable, (SourceWithAliasExpression)source, assigments)); } return(insertSelect); }
protected internal override Expression VisitInsertSelect(InsertSelectExpression insertSelect) { sb.Append("INSERT INTO "); sb.Append(insertSelect.Name.ToString()); sb.Append("("); for (int i = 0, n = insertSelect.Assigments.Count; i < n; i++) { ColumnAssignment assignment = insertSelect.Assigments[i]; if (i > 0) { sb.Append(", "); if (i % 4 == 0) { this.AppendNewLine(Indentation.Same); } } sb.Append(assignment.Column.SqlEscape()); } sb.Append(")"); this.AppendNewLine(Indentation.Same); sb.Append("SELECT "); for (int i = 0, n = insertSelect.Assigments.Count; i < n; i++) { ColumnAssignment assignment = insertSelect.Assigments[i]; if (i > 0) { sb.Append(", "); if (i % 4 == 0) { this.AppendNewLine(Indentation.Same); } } this.Visit(assignment.Expression); } sb.Append(" FROM "); VisitSource(insertSelect.Source); return(insertSelect); }