public override Resultset Get(QueryContext queryContext, object[] parameters) { DataTable dt = RowType.CreateSchemaTable(); DataRow r = dt.NewRow(); r["ColumnName"] = "Stream"; r["ColumnOrdinal"] = 0; r["DataType"] = typeof(System.Object); dt.Rows.Add(r); EnumeratorProcessingContext context = null; if (FileName.IndexOfAny(new char[] { '?', '*' }) != -1) context = new EnumeratorProcessingContext(null); Resultset rs = new Resultset(new RowType(dt), context); if (context == null) { Stream stm = new FileStream(FileName, FileMode.Open, FileAccess.Read); Row row = rs.NewRow(); row.SetObject(0, stm); rs.Enqueue(row); } else { MultiFile = true; context.Iterator = SearchLoop(queryContext, rs); } return rs; }
public override Resultset Get(QueryContext queryContext, object[] parameters) { Resultset rs1 = null; Resultset rs2 = null; Iterator.Invoke(new Action[] { () => rs1 = ChildNodes[0].Get(queryContext, parameters), () => rs2 = ChildNodes[1].Get(queryContext, parameters) }); DataTable dt1 = rs1.RowType.GetSchemaTable(); DataTable dt2 = rs2.RowType.GetSchemaTable(); foreach (DataRow r2 in dt2.Select()) { DataRow r1 = dt1.NewRow(); r1.ItemArray = r2.ItemArray; dt1.Rows.Add(r1); } EnumeratorProcessingContext context = new EnumeratorProcessingContext(new Resultset[] { rs1, rs2 }); Resultset rs = new Resultset(new RowType(dt1), context); context.Iterator = DataIterator(rs, rs1, rs2); return rs; }
public override Resultset Get(QueryContext queryContext, object[] parameters) { Resultset rs1 = ChildNodes[0].Get(queryContext, parameters); if (rs1.Begin != null) { if (ChildNodes[0] is FlatFileAccessor && ((FlatFileAccessor)ChildNodes[0]).MultiFile) { EnumeratorProcessingContext context = new EnumeratorProcessingContext(null); Resultset rs = new Resultset(RowType.CreateContainerType(typeof(Resultset)), context); context.Iterator = NextFile(rs, rs1, queryContext); return rs; } else { string fileName; Row row = rs1.Dequeue(); Stream stream = (Stream)row.GetObject(0); return CreateResultset(stream, out fileName, queryContext); } } else return new Resultset(RowType.CreateContainerType(typeof(Resultset)), null); }