Exemplo n.º 1
0
 internal override void OnWriteBufferModified(UInt32 recordNo, byte[] oldBuffer, byte[] newBuffer)
 {
     for (int i = 0; i < mIndexes.Count; i++)
     {
         NdxFile <TRecord> index = mIndexes[i];
         index.OnDbfRecordModified(recordNo, oldBuffer, newBuffer);
     }
 }
Exemplo n.º 2
0
        private int FindInsertPos(NdxEntry newEntry, NdxFile ndxFile)
        {
            int  pos;
            bool equal;

            FindPos(newEntry, ndxFile, out equal, out pos);
            if (equal)
            {
                throw new Exception("Duplicated entries in the Index file.");
            }
            return(pos);
        }
Exemplo n.º 3
0
 public int ChainCompare(int[] cmp, NdxFile index, NdxEntry other)
 {
     this.Fields.ChainCompare(other.Fields, cmp);
     // to do check for ascending descending
     for (int i = 0; i < cmp.Length; i++)
     {
         if (cmp[i] != 0)
         {
             return(cmp[i]);
         }
     }
     // if we're here the fields are identical
     // we compare RecordNo when the index is NOT unique
     if (index.mNdxHeader.UniqueFlag)
     {
         return(0);
     }
     else
     {
         return(DbfRecordNo.CompareTo(other.DbfRecordNo));
     }
 }
Exemplo n.º 4
0
        private void FindPos(NdxEntry newEntry, NdxFile ndxFile, out bool equal, out int pos)
        {
            int min = 0;
            int max = EntriesCount - 1;

            int[] cmpArray = new int[ndxFile.mSortFieldsCount];
#if DUMP_INSERTS
            System.Diagnostics.Trace.WriteLine("Searching entry '" + newEntry.Fields.ToString() + " #" + newEntry.DbfRecordNo + "' position in page #" + this.RecordNo);
            Dump("      ");
#endif

            while (max >= min)
            {
                int      mid   = (min + max) / 2;
                NdxEntry other = GetEntry(mid);
                int      cmp   = newEntry.ChainCompare(cmpArray, ndxFile, other);
                if (cmp > 0)
                {
                    min = mid + 1;
                }
                else if (cmp < 0)
                {
                    max = mid - 1;
                }
                else
                {
                    equal = true;
                    pos   = mid;
                    return;
                }
            }
#if DUMP_INSERTS
            System.Diagnostics.Trace.WriteLine("   Result:" + min);
#endif
            equal = false;
            pos   = min;
        }
Exemplo n.º 5
0
 internal void Read(NdxFile ndxFile, object dbfRecord)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 6
0
 internal void Read(NdxFile ndxFile, Byte[] recordBuffer)
 {
     throw new NotImplementedException();
 }