Пример #1
0
 public FixedLengthKey_CompoundWithValue(FixedLengthKey key1, FixedLengthKey key2, FixedLengthKey value)
 {
     _key1  = key1;
     _key2  = key2;
     _value = value;
     _key   = new CompoundAndValue(_key1.Key, _key2.Key, _value.Key);
 }
Пример #2
0
            public IComparable GetCurrentRecordValue(int index)
            {
                FixedLengthKey_CompoundWithValue keyWithValue = _keyPair._key as FixedLengthKey_CompoundWithValue;
                CompoundAndValue compoundAndValue             = keyWithValue.Key as CompoundAndValue;

                if (index == _indexField1)
                {
                    return(compoundAndValue._key1);
                }
                if (index == _indexField2)
                {
                    return(compoundAndValue._key2);
                }
                if (index == _indexValue)
                {
                    return(compoundAndValue._value);
                }

                throw new IndexOutOfRangeException("Index out of range; value=" + index);
            }
Пример #3
0
        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;
        }