コード例 #1
0
        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)));
        }
コード例 #2
0
 public CrossJoinedTable(IResultTable first, IResultTable second)
     : base()
 {
     this.first  = first;
     this.second = second;
     Columns     = JoinColumns(first, second);
     Records     = JoinRecords(first, second);
 }
コード例 #3
0
 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);
 }
コード例 #4
0
 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);
         }
     }
 }
コード例 #5
0
 public InnerJoinedTable(IResultTable first, IResultTable second, Func <IResultRow, bool> predicate)
 {
     innerTable   = new CrossJoinedTable(first, second);
     this.Columns = innerTable.Columns;
     Records      = FilterRecords(innerTable.Records, predicate);
 }
コード例 #6
0
 protected virtual IEnumerable <ResultColumn> JoinColumns(IResultTable first, IResultTable second)
 {
     return(first.Columns.Union(second.Columns).ToArray());
 }
コード例 #7
0
 public SQLExecutionResult(int rowsAffected, IResultTable values)
 {
     RowsAffected = rowsAffected;
     Values       = values;
 }
コード例 #8
0
 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);
             }
         }
     }
 }