Esempio n. 1
0
        public override BedTable GetPreviewRows(int count)
        {
            var props = new TablePageProperties {
                Count = count
            };

            return(m_frame.TabularData.LoadTableData(props));
        }
Esempio n. 2
0
        public BedTable LoadTableData(TablePageProperties props)
        {
            lock (m_directory)
            {
                BedTable table = new BedTable(m_table);

                int start = 0;
                int count = m_serializedRows;
                if (props.Count != null)
                {
                    count = props.Count.Value;
                }
                if (props.Start != null)
                {
                    start = props.Start.Value;
                }

                if (start >= m_serializedRows)
                {
                    return(table);
                }
                int curdic = start / BUFFER_SIZE, skiprec = start % BUFFER_SIZE;
                Errors.Assert(curdic < m_directory.Count);
                m_cache.Seek(m_directory[curdic], SeekOrigin.Begin);

                int          availtables = m_directory.Count - curdic;
                BinaryReader br          = new BinaryReader(m_cache);
                while (table.Rows.Count < count && availtables >= 1)
                {
                    ChunkInfo info = ChunkInfo.LoadInfo(br);
                    if (skiprec > 0)
                    {
                        int skipbytes = 0;
                        for (int i = 0; i < skiprec; i++)
                        {
                            skipbytes += info.Lengths[i];
                        }
                        m_cache.Seek(skipbytes, SeekOrigin.Current);
                    }
                    int rec = skiprec;

                    while (rec < info.Count)
                    {
                        table.AddRowInternal(BedTool.LoadRecord(br, m_table));
                        rec++;
                    }
                    availtables--;
                    skiprec = 0;
                }
                return(table);
            }
        }
Esempio n. 3
0
 public BedTable LoadTableData(TablePageProperties props)
 {
     WantTable();
     return(m_table.ToBinaryTable());
 }
Esempio n. 4
0
        public BedTable LoadTableData(TablePageProperties props)
        {
            DateTime start = DateTime.Now;
            var      per   = props.Perspective;

            try
            {
                BedAdapter adapter;
                string     cmdtext;
                LoadTableDataProlog(props, out adapter, out cmdtext);
                using (var canc = Connection.AddOnCancel(adapter.CancelLoading))
                {
                    BedTable table = null;
                    try
                    {
                        table = adapter.LoadTableData(props.Start, props.Count, cmdtext);
                    }
                    catch (Exception err)
                    {
                        LoadTableDataPrologHandleError(props, err);
                    }
                    var    slen = DateTime.Now - start;
                    double len  = slen.TotalSeconds;
                    if (table != null)
                    {
                        ProgressInfo.Debug(Texts.Get("s_readed$rows$cols$len",
                                                     "rows", table.Rows.Count,
                                                     "cols", table.Structure.Columns.Count,
                                                     "len", len.ToString("0.00")));
                    }
                    m_adapterByTable[table] = adapter;
                    if (per != null)
                    {
                        table.ResultFields = per.Select.Columns;
                    }
                    if (LoadedDataInfo != null)
                    {
                        var ea = new LoadedTableInfoArgs();
                        ea.Duration = slen;
                        ea.Table    = table;
                        LoadedDataInfo(this, ea);
                    }
                    return(table);
                }
            }
            catch (Exception err)
            {
                // probably error in command, clear adapter so that it is recreated next time
                m_adapters.Remove(per ?? nullPer);

                if (LoadedDataInfo != null)
                {
                    var ea = new LoadedTableInfoArgs();
                    ea.Duration = DateTime.Now - start;
                    ea.Error    = err;
                    LoadedDataInfo(this, ea);
                }

                throw;
            }
        }
Esempio n. 5
0
 public BedTable LoadTableData(TablePageProperties props)
 {
     return(m_table);
 }