private IEnumerable <IResultRow> JoinRecords(IResultTable first, IResultTable second, Func <IResultRow, bool> predicate) { HashSet <IResultRow> usedRows = new HashSet <IResultRow>(); var result = internalJoinRecords(usedRows, first, second, predicate); return(result.Concat(buildOrphanRows(usedRows))); }
public CrossJoinedTable(IResultTable first, IResultTable second) : base() { this.first = first; this.second = second; Columns = JoinColumns(first, second); Records = JoinRecords(first, second); }
public OuterJoinedTable(QualifiedJoinType joinType, IResultTable first, IResultTable second, Func <IResultRow, bool> predicate) { this.first = first; this.second = second; this.joinType = joinType; Columns = JoinColumns(first, second); Records = JoinRecords(first, second, predicate); }
protected virtual IEnumerable <IResultRow> JoinRecords(IResultTable first, IResultTable second) { //TODO: this behaviour properly foreach (var row1 in first.Records) { foreach (var row2 in second.Records) { var row = new Record( row1.ItemArray.Concat(row2.ItemArray).ToArray() , this); yield return(row); } } }
public InnerJoinedTable(IResultTable first, IResultTable second, Func <IResultRow, bool> predicate) { innerTable = new CrossJoinedTable(first, second); this.Columns = innerTable.Columns; Records = FilterRecords(innerTable.Records, predicate); }
protected virtual IEnumerable <ResultColumn> JoinColumns(IResultTable first, IResultTable second) { return(first.Columns.Union(second.Columns).ToArray()); }
public SQLExecutionResult(int rowsAffected, IResultTable values) { RowsAffected = rowsAffected; Values = values; }
private IEnumerable <IResultRow> internalJoinRecords(HashSet <IResultRow> usedRows, IResultTable first, IResultTable second, Func <IResultRow, bool> predicate) { //TODO: this behaviour properly foreach (var row1 in first.Records) { foreach (var row2 in second.Records) { var row = new Record( row1.ItemArray.Concat(row2.ItemArray).ToArray() , this); if (predicate(row)) { usedRows.Add(row1); usedRows.Add(row2); yield return(row); } } } }