Ejemplo n.º 1
0
        // TODO Auto-generated method stub
        public virtual void CollectIDs(QueryingReadContext context)
        {
            int   id    = context.ReadInt();
            BTree bTree = NewBTree(context, id);

            bTree.TraverseKeys(context.Transaction(), new _IVisitor4_83(context));
        }
        /// <exception cref="Db4objects.Db4o.Ext.Db4oIOException"></exception>
        private bool CollectIDsByTypehandlerAspect(QueryingReadContext context)
        {
            BooleanByRef     aspectFound = new BooleanByRef(false);
            CollectIdContext subContext  = CollectIdContext.ForID(context.Transaction(), context
                                                                  .Collector(), context.CollectionID());
            ITraverseAspectCommand command = new _MarshallingInfoTraverseAspectCommand_349(this
                                                                                           , aspectFound, subContext, EnsureFieldList(subContext));

            TraverseAllAspects(subContext, command);
            return(aspectFound.value);
        }
Ejemplo n.º 3
0
        public IInternalCandidate ReadSubCandidate(QueryingReadContext context, ITypeHandler4
                                                   handler)
        {
            ObjectID objectID = ObjectID.NotPossible;

            try
            {
                int offset = context.Offset();
                if (handler is IReadsObjectIds)
                {
                    objectID = ((IReadsObjectIds)handler).ReadObjectID(context);
                }
                if (objectID.IsValid())
                {
                    return(new QCandidate(this, null, objectID._id));
                }
                if (objectID == ObjectID.NotPossible)
                {
                    context.Seek(offset);
                    object obj = context.Read(handler);
                    if (obj != null)
                    {
                        int id = context.Container().GetID(context.Transaction(), obj);
                        if (id == 0)
                        {
                            return(new QPrimitiveCandidate(this, obj));
                        }
                        QCandidate candidate = new QCandidate(this, obj, id);
                        candidate.ClassMetadata(context.Container().ClassMetadataForObject(obj));
                        return(candidate);
                    }
                }
            }
            catch (Exception)
            {
            }
            // FIXME: Catchall
            return(null);
        }
        /// <exception cref="Db4objects.Db4o.Ext.Db4oIOException"></exception>
        private void CollectIDsByInstantiatingCollection(QueryingReadContext context)
        {
            int id = context.CollectionID();

            if (id == 0)
            {
                return;
            }
            Transaction         transaction = context.Transaction();
            ObjectContainerBase container   = context.Container();
            object obj = container.GetByID(transaction, id);

            if (obj == null)
            {
                return;
            }
            // FIXME: [TA] review activation depth
            int depth = DepthUtil.AdjustDepthToBorders(2);

            container.Activate(transaction, obj, container.ActivationDepthProvider().ActivationDepth
                                   (depth, ActivationMode.Activate));
            Platform4.ForEachCollectionElement(obj, new _IVisitor4_390(context));
        }
Ejemplo n.º 5
0
        public override ITypeHandler4 ReadCandidateHandler(QueryingReadContext context)
        {
            int id     = 0;
            int offset = context.Offset();

            try
            {
                id = context.ReadInt();
            }
            catch (Exception)
            {
            }
            context.Seek(offset);
            if (id != 0)
            {
                StatefulBuffer reader = context.Container().ReadStatefulBufferById(context.Transaction
                                                                                       (), id);
                if (reader != null)
                {
                    ObjectHeader oh = new ObjectHeader(context.Container(), reader);
                    try
                    {
                        if (oh.ClassMetadata() != null)
                        {
                            context.Buffer(reader);
                            return(oh.ClassMetadata().SeekCandidateHandler(context));
                        }
                    }
                    catch (Exception e)
                    {
                    }
                }
            }
            // TODO: Check Exception Types
            // Errors typically occur, if classes don't match
            return(null);
        }
Ejemplo n.º 6
0
        //      throw new IllegalStateException();
        public virtual void CollectIDs(QueryingReadContext readContext)
        {
            IInternalReadContext context = (IInternalReadContext)readContext;
            int payloadOffset            = context.ReadInt();

            if (payloadOffset == 0)
            {
                return;
            }
            int savedOffSet = context.Offset();

            try
            {
                ITypeHandler4 typeHandler = ReadTypeHandler(context, payloadOffset);
                if (typeHandler == null)
                {
                    return;
                }
                SeekSecondaryOffset(context, typeHandler);
                if (IsPlainObject(typeHandler))
                {
                    readContext.Collector().AddId(readContext.ReadInt());
                    return;
                }
                CollectIdContext collectIdContext = new _CollectIdContext_203(readContext, readContext
                                                                              .Transaction(), readContext.Collector(), null, readContext.Buffer());
                Handlers4.CollectIdsInternal(collectIdContext, context.Container().Handlers.CorrectHandlerVersion
                                                 (typeHandler, context.HandlerVersion()), 0, false);
            }
            finally
            {
                context.Seek(savedOffSet);
            }
        }