Exemplo n.º 1
0
        private void AddRowToRowIndex(TableContextRowID rowID)
        {
            // Add the row to the list
            m_rowIndex.Add(rowID);
            // add the row to the BTH
            BTreeOnHeap <TableContextRowID> bTreeOnHeap = new BTreeOnHeap <TableContextRowID>(m_heap, m_tcInfo.hidRowIndex);

            bTreeOnHeap.AddRecord(rowID);
        }
Exemplo n.º 2
0
        private void DeleteLastRowFromRowIndex()
        {
            uint rowID = m_rowIndex[m_rowIndex.Count - 1].dwRowID;

            m_rowIndex.RemoveAt(m_rowIndex.Count - 1);

            BTreeOnHeap <TableContextRowID> bTreeOnHeap = new BTreeOnHeap <TableContextRowID>(m_heap, m_tcInfo.hidRowIndex);

            bTreeOnHeap.RemoveRecord(LittleEndianConverter.GetBytes(rowID));
        }
Exemplo n.º 3
0
        private Subnode m_subnodeRows; // for buffering purposes

        public TableContext(HeapOnNode heap, SubnodeBTree subnodeBTree)
        {
            m_heap         = heap;
            m_subnodeBTree = subnodeBTree;
            m_tcInfo       = new TableContextInfo(m_heap.GetHeapItem(m_heap.HeapHeader.hidUserRoot));

            BTreeOnHeap <TableContextRowID> bTreeOnHeap = new BTreeOnHeap <TableContextRowID>(m_heap, m_tcInfo.hidRowIndex);

            if (bTreeOnHeap.BTreeHeader.hidRoot.hidIndex > 0) // hidRoot is set to zero if the BTH is empty.
            {
                m_rowIndex = bTreeOnHeap.GetAll();
                m_rowIndex.Sort(TableContextRowID.CompareByRowIndex);
            }

            m_rowsPerBlock = (int)Math.Floor((double)DataBlock.MaximumDataLength / RowLength);
        }
Exemplo n.º 4
0
        /// <summary>
        /// For discovery purposes
        /// </summary>
        public List <string> ListRowIndex()
        {
            List <string> result = new List <string>();
            BTreeOnHeap <TableContextRowID> bTreeOnHeap = new BTreeOnHeap <TableContextRowID>(m_heap, m_tcInfo.hidRowIndex);

            if (bTreeOnHeap.BTreeHeader.hidRoot.hidIndex > 0) // hidRoot is set to zero if the BTH is empty.
            {
                result.Add("Index levels: " + bTreeOnHeap.BTreeHeader.bIdxLevels);
            }

            for (int rowIndex = 0; rowIndex < m_rowIndex.Count; rowIndex++)
            {
                result.Add(String.Format("RowIndex: {0}, RowID: {1}", m_rowIndex[rowIndex].dwRowIndex, m_rowIndex[rowIndex].dwRowID));
            }
            return(result);
        }
Exemplo n.º 5
0
        private void SwitchRowsInRowIndex(int rowIndex1, int rowIndex2)
        {
            TableContextRowID record1 = m_rowIndex[rowIndex1];
            TableContextRowID record2 = m_rowIndex[rowIndex2];
            uint temp = record1.dwRowIndex;

            record1.dwRowIndex = record2.dwRowIndex;
            record2.dwRowIndex = temp;

            m_rowIndex[rowIndex1] = record2;
            m_rowIndex[rowIndex2] = record1;

            BTreeOnHeap <TableContextRowID> bTreeOnHeap = new BTreeOnHeap <TableContextRowID>(m_heap, m_tcInfo.hidRowIndex);

            bTreeOnHeap.UpdateRecord(record1);
            bTreeOnHeap.UpdateRecord(record2);
        }