Exemplo n.º 1
0
Arquivo: DBIndex.cs Projeto: mo5h/omeo
        internal DBIndex(ITableDesign tableDesign, string name, FixedLengthKey fixedFactory,
                         FixedLengthKey fixedFactory1, FixedLengthKey fixedFactory2, FixedLengthKey fixedFactoryValue)
        {
            Init(tableDesign, name);
            string[] names = name.Split('#');
            if (names.Length == 2)
            {
                _firstCompoundName  = names[0];
                _secondCompoundName = names[1];
            }
            _version = _tableDesign.Version;

            _fullName =
                DBHelper.GetFullNameForIndex(tableDesign.Database.Path, tableDesign.Database.Name,
                                             tableDesign.Name, _name);

            _fixedFactory      = fixedFactory;
            _fixedFactory2     = fixedFactory2;
            _fixedFactoryValue = fixedFactoryValue;
            _searchBegin       = (FixedLengthKey)_fixedFactory.FactoryMethod();
            _searchEnd         = (FixedLengthKey)_fixedFactory.FactoryMethod();

            if (!IBTree._bUseOldKeys)
            {
                Object key = _fixedFactory.Key;
                if (key is int || key is long || key is DateTime || key is Double)
                {
                    _bTree = new OmniaMeaBTree(_fullName, _fixedFactory);
                }
                else
                {
                    Compound compound = key as Compound;
                    if (compound != null)
                    {
                        if (compound._key1 is int)
                        {
                            if (compound._key2 is int)
                            {
                                _bTree = new OmniaMeaBTree(_fullName, _fixedFactory);
                            }
                            if (compound._key2 is DateTime)
                            {
                                _bTree = new OmniaMeaBTree(_fullName, _fixedFactory);
                            }
                        }
                    }
                    else
                    {
                        CompoundAndValue compval = key as CompoundAndValue;
                        if (compval != null)
                        {
                            if (compval._key1 is int)
                            {
                                if (compval._key2 is int)
                                {
                                    if (compval._value is int || compval._value is DateTime)
                                    {
                                        _bTree = new OmniaMeaBTree(_fullName, _fixedFactory);
                                    }
                                }
                                else if (compval._key2 is DateTime)
                                {
                                    if (compval._value is int)
                                    {
                                        _bTree = new OmniaMeaBTree(_fullName, _fixedFactory);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            if (_bTree == null)
            {
                throw new InvalidOperationException("Not supported key type!");
                //_bTree = new BTree( _fullName, _fixedFactory );
            }
            _isOpen = false;
        }
Exemplo n.º 2
0
Arquivo: DBIndex.cs Projeto: mo5h/omeo
 private void Init(ITableDesign tableDesign, string name)
 {
     _name        = name;
     _tableDesign = tableDesign;
 }