public void Put(object obj, int mask)
#endif
        {
            StorageImpl db = (StorageImpl)Storage;

            if (db == null)
            {
                throw new StorageError(StorageError.ErrorCode.DELETED_OBJECT);
            }
            Key ins = new Key(mask, db.MakePersistent(obj));

            if (root == 0)
            {
                root   = BitIndexPage.allocate(db, 0, ins);
                height = 1;
            }
            else
            {
                BtreeResult result = BitIndexPage.insert(db, root, ins, height);
                if (result == BtreeResult.Overflow)
                {
                    root    = BitIndexPage.allocate(db, root, ins);
                    height += 1;
                }
            }
            updateCounter += 1;
            nElems        += 1;
            Modify();
        }
Exemplo n.º 2
0
        public void Put(T obj, int mask)
        {
            DatabaseImpl db = (DatabaseImpl)Database;

            if (db == null)
            {
                throw new DatabaseException(DatabaseException.ErrorCode.DELETED_OBJECT);
            }
            if (!obj.IsPersistent())
            {
                db.MakePersistent(obj);
            }
            Key ins = new Key(mask, obj.Oid);

            if (root == 0)
            {
                root   = BitIndexPage.allocate(db, 0, ins);
                height = 1;
            }
            else
            {
                OldBtreeResult result = BitIndexPage.insert(db, root, ins, height);
                if (result == OldBtreeResult.Overflow)
                {
                    root    = BitIndexPage.allocate(db, root, ins);
                    height += 1;
                }
            }
            updateCounter += 1;
            nElems        += 1;
            Modify();
        }