Click here to Skip to main content
Click here to Skip to main content
 
Add your own
alternative version

Tagged as

Building an embedded database engine in C#

, 10 Jun 2009 CPOL
DbfDotNet is a very fast and compact fully managed standalone database/entity framework, for the .Net Framework.
using System;
using System.Collections.Generic;
using System.Text;

namespace DbfDotNet.Core
{
    [Record(FieldMapping = FieldMapping.ExplicitColumnsOnly)]
    internal class NdxEntry 
    {
        [Column(Type = ColumnType.UINT32)]
        internal UInt32 mNdxNativeLowerPageNo;

        [Column(Type = ColumnType.UINT32)]
        public UInt32 DbfRecordNo;

        private SortFields mFields;
        
        public SortFields Fields
        {
            get { return mFields; }
            set { 
                if (mFields==value) return;
                mFields = value;
            }
        }

        public UInt32 LowerPageRecordNo
        {
            get { return mNdxNativeLowerPageNo - 1; }
            set { mNdxNativeLowerPageNo = value + 1; }
        }

        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);
            
        }

        public override string ToString()
        {
            return Fields.ToString() + " " + DbfRecordNo.ToString();
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Pascal Ganaye
Software Developer (Senior)
United Kingdom United Kingdom
I am a French programmer.
These days I spend most of my time with the .NET framework, JavaScript and html.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.141220.1 | Last Updated 10 Jun 2009
Article Copyright 2009 by Pascal Ganaye
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid