Ejemplo n.º 1
0
            public override void Invoke(SpoolSpace Memory)
            {
                Table  Destination = this._Parameters[0].Select(Memory);
                string Source      = this._Parameters[1].Evaluate(Memory).valueCSTRING;

                char[] Delims = this._Parameters[2].Evaluate(Memory).valueCSTRING.ToCharArray();
                char   Escape = (this._Parameters.Count >= 4 ? this._Parameters[3].Evaluate(Memory).valueCSTRING.First() : char.MaxValue);
                int    Skips  = (this._Parameters.Count == 5 ? this._Parameters[4].Evaluate(Memory).valueINT : 0);

                using (StreamReader Reader = new StreamReader(Source))
                {
                    int i = 0;
                    while (i < Skips && !Reader.EndOfStream)
                    {
                        i++;
                        Reader.ReadLine();
                    }

                    using (RecordWriter Writer = Destination.OpenWriter())
                    {
                        while (!Reader.EndOfStream)
                        {
                            Record r = Util.StringUtil.ToRecord(Reader.ReadLine(), Destination.Columns, Delims, Escape);
                            Writer.Insert(r);
                        }
                    }
                }
            }
Ejemplo n.º 2
0
        public virtual void WriteTo(SpoolSpace Memory, RecordWriter Writer)
        {
            Cell val = this.Evaluate(Memory);

            if (val.Affinity == CellAffinity.TREF)
            {
                Table t = this._Host.OpenTable(val.valueTREF);
                using (RecordReader rr = t.OpenReader())
                {
                    while (rr.CanAdvance)
                    {
                        Writer.Insert(rr.ReadNext());
                    }
                }
            }
        }
Ejemplo n.º 3
0
            public override void EndInvoke(SpoolSpace Memory)
            {
                // Open the base stream
                using (RecordWriter writer = this._Output.OpenWriter())
                {
                    // Open a reader //
                    using (RecordReader reader = this._StorageTree.OpenReader())
                    {
                        while (reader.CanAdvance)
                        {
                            Record work   = reader.ReadNext();
                            Record finale = this._Parameters.AggRender(work);
                            writer.Insert(finale);
                        } // end while
                    }     // end reader using
                }         // end using writer

                // Drop the tree
                this._Host.TableStore.DropTable(this._StorageTree.Key);
            }