Exemplo n.º 1
0
 public GridTable(ITableStructure table, string title)
     : base((IPhysicalConnection)null)
 {
     m_title = title;
     m_file  = Path.GetTempFileName();
     m_cache = new FileStream(m_file, FileMode.Create);
     m_table = table;
     m_state = TabularDataViewState.Prepared;
     //m_colnames = new List<string>(from c in m_table.Columns select c.ColumnName).ToArray();
     //m_schema = schema;
     //m_dialect = dialect;
 }
Exemplo n.º 2
0
        private void DoFillOnBackground(IDataQueue queue)
        {
            try
            {
                m_state = TabularDataViewState.Loading;
                //DataTable curbuf = null;
                Chunk curchunk = null;
                try
                {
                    while (!queue.IsEof)
                    {
                        if (curchunk == null)
                        {
                            curchunk = new Chunk();
                        }

                        IBedRecord rec = queue.GetRecord();
                        curchunk.SaveRecord(rec);

                        if (curchunk.Count >= BUFFER_SIZE)
                        {
                            FlushChunk(curchunk);
                            curchunk = null;
                        }
                    }
                }
                finally
                {
                    queue.CloseReading();
                }
                if (curchunk != null)
                {
                    FlushChunk(curchunk);
                }
                m_state = TabularDataViewState.Prepared;
            }
            catch (Exception e)
            {
                Errors.Report(e);
                m_state = TabularDataViewState.Error;
                queue.PutError(e);
            }
            finally
            {
                queue.CloseWriting();
            }
            if (LoadedNextData != null)
            {
                LoadedNextData(this, new LoadedNextDataArgs(m_serializedRows));
            }
        }