Ejemplo n.º 1
0
        public void SaveFixedData(IDataQueue queue)
        {
            InMemoryTable tbl = InMemoryTable.FromEnumerable(queue.GetRowFormat, queue.EnumRows());

            if (tbl.Rows.Count == 0)
            {
                tbl = null;
            }
            SaveFixedData(tbl);
        }
Ejemplo n.º 2
0
        public InMemoryTable GetTable(bool wantdata)
        {
            List <DataRecord> records = new List <DataRecord>();

            foreach (string row in EnumRows())
            {
                records.Add(FieldAnalyser.AnalyseRecord(row));
            }
            var ts = new TableStructure();
            Dictionary <string, int> colindexes = new Dictionary <string, int>();

            // get column collection
            foreach (var rec in records)
            {
                foreach (var fld in rec.Fields)
                {
                    if (colindexes.ContainsKey(fld.Name))
                    {
                        continue;
                    }
                    var col = new ColumnStructure();
                    col.ColumnName       = fld.Name;
                    col.DataType         = new DbTypeString();
                    colindexes[fld.Name] = ts._Columns.Count;
                    ts._Columns.Add(col);
                }
            }
            if (!wantdata)
            {
                return(new InMemoryTable(ts));
            }
            var recs = new List <ArrayDataRecord>();

            foreach (var rec in records)
            {
                var row = new ArrayDataRecord(ts);
                foreach (var fld in rec.Fields)
                {
                    row.SeekValue(colindexes[fld.Name]);
                    row.SetString(fld.Value);
                }
                recs.Add(row);
            }
            return(InMemoryTable.FromEnumerable(ts, recs));
        }
Ejemplo n.º 3
0
        public override void FillTable(ITableStructure table, IDataQueue queue, TableCopyOptions opts)
        {
            TableStructure dst = null;

            try
            {
                dst = (TableStructure)m_db.Tables[table.FullName];
            }
            catch
            {
                throw new InternalError("DAE-00064 Table not found in target structure:" + table.FullName.ToString());
            }
            InMemoryTable tbl = InMemoryTable.FromEnumerable(queue.GetRowFormat, queue.EnumRows());

            if (tbl.Rows.Count == 0)
            {
                tbl = null;
            }
            dst.FixedData = tbl;
        }