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; }
// 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); } }
public QCandidate 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) { QCandidate candidate = new QCandidate(this, obj, context.Container().GetID(context .Transaction(), obj)); 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) { var id = context.CollectionID(); if (id == 0) { return; } var transaction = context.Transaction(); var container = context.Container(); var obj = container.GetByID(transaction, id); if (obj == null) { return; } // FIXME: [TA] review activation depth var depth = DepthUtil.AdjustDepthToBorders(2); container.Activate(transaction, obj, container.ActivationDepthProvider().ActivationDepth (depth, ActivationMode.Activate)); Platform4.ForEachCollectionElement(obj, new _IVisitor4_390(context)); }
/// <exception cref="Db4objects.Db4o.Ext.Db4oIOException"></exception> private bool CollectIDsByTypehandlerAspect(QueryingReadContext context) { var aspectFound = new BooleanByRef(false); var 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; }
// 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)); }