internal override void Collect(QCandidates a_candidates) { if (i_field.IsClass()) { a_candidates.Traverse(i_field); a_candidates.Filter(i_candidates); } }
public _IClosure4_318(QCandidate _enclosing, ITypeHandler4 arrayElementHandler, IReadBuffer buffer, QCandidates candidates) { this._enclosing = _enclosing; this.arrayElementHandler = arrayElementHandler; this.buffer = buffer; this.candidates = candidates; }
private bool CreateChildForDescendable(QCandidates parentCandidates, ITypeHandler4 handler, QueryingReadContext queryingReadContext, ITypeHandler4 arrayElementHandler ) { int offset = queryingReadContext.Offset(); bool outerRes = true; // The following construct is worse than not ideal. For each constraint it completely reads the // underlying structure again. The structure could be kept fairly easy. TODO: Optimize! IEnumerator i = parentCandidates.IterateConstraints(); while (i.MoveNext()) { QCon qcon = (QCon)i.Current; QField qf = qcon.GetField(); if (qf != null && !qf.Name().Equals(_fieldMetadata.GetName())) { continue; } QCon tempParent = qcon.Parent(); qcon.SetParent(null); QCandidates candidates = new QCandidates(parentCandidates.i_trans, null, qf, false ); candidates.AddConstraint(qcon); qcon.SetCandidates(candidates); ReadArrayCandidates(handler, queryingReadContext.Buffer(), arrayElementHandler, candidates ); queryingReadContext.Seek(offset); bool isNot = qcon.IsNot(); if (isNot) { qcon.RemoveNot(); } candidates.Evaluate(); ByRef pending = ByRef.NewInstance(); BooleanByRef innerRes = new BooleanByRef(isNot); candidates.Traverse(new QCandidate.CreateDescendChildTraversingVisitor(pending, innerRes , isNot)); if (isNot) { qcon.Not(); } // In case we had pending subresults, we need to communicate them up to our root. if (((Tree)pending.value) != null) { ((Tree)pending.value).Traverse(new _IVisitor4_168(this)); } if (!innerRes.value) { // Again this could be double triggering. // // We want to clean up the "No route" at some stage. qcon.Visit(GetRoot(), qcon.Evaluator().Not(false)); outerRes = false; } qcon.SetParent(tempParent); } return(outerRes); }
internal override void EvaluateEvaluationsExec(QCandidates a_candidates, bool rereadObject ) { if (rereadObject) { a_candidates.Traverse(new _IVisitor4_31()); } a_candidates.Filter(this); }
internal override void EvaluateEvaluationsExec(QCandidates a_candidates, bool rereadObject ) { if (rereadObject) { a_candidates.Traverse(new _IVisitor4_31()); } a_candidates.Filter(this); }
public virtual bool CreateChild(QField field, QCandidates candidates) { if (!_include) { return(false); } UseField(field); if (_fieldMetadata == null || _fieldMetadata is NullFieldMetadata) { return(false); } ITypeHandler4 handler = _fieldMetadata.GetHandler(); if (handler != null) { QueryingReadContext queryingReadContext = new QueryingReadContext(Transaction(), MarshallerFamily().HandlerVersion(), _bytes, _key); ITypeHandler4 arrayElementHandler = Handlers4.ArrayElementHandler(handler, queryingReadContext ); if (arrayElementHandler != null) { return(CreateChildForDescendable(candidates, handler, queryingReadContext, arrayElementHandler )); } // We may get simple types here too, if the YapField was null // in the higher level simple evaluation. Evaluate these // immediately. if (Handlers4.IsQueryLeaf(handler)) { candidates._currentConstraint.Visit(this); return(true); } } _classMetadata.SeekToField(Transaction(), _bytes, _fieldMetadata); IInternalCandidate candidate = ReadSubCandidate(candidates); if (candidate == null) { return(false); } // fast early check for ClassMetadata if (candidates._classMetadata != null && candidates._classMetadata.IsStronglyTyped ()) { if (Handlers4.IsUntyped(handler)) { handler = TypeHandlerFor(candidate); } if (handler == null) { return(false); } } AddDependant(candidates.Add(candidate)); return(true); }
public QCandidate(QCandidates candidates, object member, int id) : base(candidates , id) { // db4o ID is stored in _key; // db4o byte stream storing the object // the ClassMetadata of this object // temporary field and member for one field during evaluation // null denotes null object _member = member; }
public override void SetProcessedByIndex(QCandidates candidates) { if (ProcessedByIndex()) { return; } base.SetProcessedByIndex(candidates); Constraint1().SetProcessedByIndex(candidates); Constraint2().SetProcessedByIndex(candidates); }
internal override void EvaluateSimpleExec(QCandidates a_candidates) { // TODO: The following can be skipped if we used the index on // this field to load the objects, if hasOrdering() is false if (i_field.IsQueryLeaf() || IsNullConstraint()) { PrepareComparison(i_field); a_candidates.Filter(i_field, this); } }
private QueryingReadContext(Transaction transaction, QCandidates candidates, int handlerVersion, IReadBuffer buffer, int collectionID, IdObjectCollector collector ) : base(transaction, buffer) { _candidates = candidates; _activationDepth = new LegacyActivationDepth(0); _collectionID = collectionID; _handlerVersion = handlerVersion; _collector = collector; }
private void ReadArrayCandidates(ITypeHandler4 typeHandler, IReadBuffer buffer, ITypeHandler4 arrayElementHandler, QCandidates candidates) { if (!Handlers4.IsCascading(arrayElementHandler)) { return; } SlotFormat slotFormat = SlotFormat.ForHandlerVersion(_handlerVersion); slotFormat.DoWithSlotIndirection(buffer, typeHandler, new _IClosure4_318(this, arrayElementHandler , buffer, candidates)); }
public QCandidateBase(QCandidates candidates, int id) : base(id) { if (DTrace.enabled) { DTrace.CreateCandidate.Log(id); } _candidates = candidates; if (id == 0) { _key = candidates.GenerateCandidateId(); } }
internal override void EvaluateEvaluationsExec(QCandidates a_candidates, bool rereadObject ) { // if (rereadObject) { // a_candidates.traverse(new Visitor4() { // public void visit(Object a_object) { // ((QCandidate) a_object).useField(null); // } // }); // } a_candidates.Filter(this); }
protected virtual void InternalSetProcessedByIndex(QCandidates candidates) { _processedByIndex = true; if (i_joins != null) { IEnumerator i = i_joins.GetEnumerator(); while (i.MoveNext()) { ((QConJoin)i.Current).SetProcessedByIndex(candidates); } } }
public QCandidateBase(QCandidates candidates, int id) : base(id) { if (DTrace.enabled) { DTrace.CreateCandidate.Log(id); } _candidates = candidates; if (id == 0) { _key = candidates.GenerateCandidateId(); } }
internal override void EvaluateEvaluationsExec(QCandidates a_candidates, bool rereadObject ) { // if (rereadObject) { // a_candidates.traverse(new Visitor4() { // public void visit(Object a_object) { // ((QCandidate) a_object).useField(null); // } // }); // } a_candidates.Filter(this); }
internal void Collect(Db4objects.Db4o.Internal.Query.Processor.QCandidates a_candidates ) { IEnumerator i = IterateConstraints(); while (i.MoveNext()) { QCon qCon = (QCon)i.Current; SetCurrentConstraint(qCon); qCon.Collect(a_candidates); } SetCurrentConstraint(null); }
internal void Collect(QCandidates a_candidates ) { var i = IterateConstraints(); while (i.MoveNext()) { var qCon = (QCon)i.Current; SetCurrentConstraint(qCon); qCon.Collect(a_candidates); } SetCurrentConstraint(null); }
protected override void InternalSetProcessedByIndex(QCandidates candidates) { base.InternalSetProcessedByIndex(candidates); if (i_field == null) { return; } FieldMetadata fieldMetadata = i_field.GetFieldMetadata(); if (!fieldMetadata.IsVirtual()) { candidates.WasLoadedFromClassFieldIndex(true); } }
public QCandidate(QCandidates candidates, object member, int id) : base(id) { if (DTrace.enabled) { DTrace.CreateCandidate.Log(id); } _candidates = candidates; _member = member; _include = true; if (id == 0) { _key = candidates.GenerateCandidateId(); } }
private QCandidate(QCandidates qcandidates) : base(0) { // db4o ID is stored in _key; // db4o byte stream storing the object // Dependent candidates // whether to include in the result set // may use id for optimisation ??? // Possible pending joins on children // The evaluation root to compare all ORs // the ClassMetadata of this object // temporary field and member for one field during evaluation // null denotes null object _candidates = qcandidates; }
public QCandidate(QCandidates candidates, object member, int id) : base(id) { if (DTrace.enabled) { DTrace.CreateCandidate.Log(id); } _candidates = candidates; _member = member; _include = true; if (id == 0) { _key = candidates.GenerateCandidateId(); } }
private QCandidate(QCandidates qcandidates) : base(0) { // db4o ID is stored in _key; // db4o byte stream storing the object // Dependent candidates // whether to include in the result set // may use id for optimisation ??? // Possible pending joins on children // The evaluation root to compare all ORs // the ClassMetadata of this object // temporary field and member for one field during evaluation // null denotes null object _candidates = qcandidates; }
private void AddConstraintToCandidatesList(List4 candidatesList, QCon qcon) { if (candidatesList == null) { return; } IEnumerator j = new Iterator4Impl(candidatesList); while (j.MoveNext()) { QCandidates candidates = (QCandidates)j.Current; candidates.AddConstraint(qcon); } }
private bool ConstraintCanBeAddedToExisting(List4 candidatesList, QCon constraint ) { IEnumerator j = new Iterator4Impl(candidatesList); while (j.MoveNext()) { QCandidates candidates = (QCandidates)j.Current; if (candidates.FitsIntoExistingConstraintHierarchy(constraint)) { return(true); } } return(false); }
internal virtual void CreateCandidates(Collection4 a_candidateCollection) { IEnumerator j = a_candidateCollection.GetEnumerator(); while (j.MoveNext()) { QCandidates candidates = (QCandidates)j.Current; if (candidates.TryAddConstraint(this)) { i_candidates = candidates; return; } } i_candidates = new QCandidates((LocalTransaction)i_trans, GetYapClass(), GetField ()); i_candidates.AddConstraint(this); a_candidateCollection.Add(i_candidates); }
public virtual void ExecuteLocal(IdListQueryResult result) { CheckConstraintsEvaluationMode(); QQueryBase.CreateCandidateCollectionResult r = CreateCandidateCollection(); bool checkDuplicates = r.checkDuplicates; bool topLevel = r.topLevel; List4 candidateCollection = r.candidateCollection; if (candidateCollection != null) { Collection4 executionPath = topLevel ? null : FieldPathFromTop(); IEnumerator i = new Iterator4Impl(candidateCollection); while (i.MoveNext()) { ((QCandidates)i.Current).Execute(); } if (((List4)candidateCollection._next) != null) { checkDuplicates = true; } if (checkDuplicates) { result.CheckDuplicates(); } ObjectContainerBase stream = Stream(); i = new Iterator4Impl(candidateCollection); while (i.MoveNext()) { QCandidates candidates = (QCandidates)i.Current; if (topLevel) { candidates.Traverse(result); } else { candidates.Traverse(new _IVisitor4_374(this, executionPath, stream, result)); } } } Sort(result); }
public virtual IEnumerator ExecuteSnapshot() { QQueryBase.CreateCandidateCollectionResult r = CreateCandidateCollection(); Collection4 executionPath = ExecutionPath(r); IEnumerator candidatesIterator = new Iterator4Impl(r.candidateCollection); Collection4 snapshots = new Collection4(); while (candidatesIterator.MoveNext()) { QCandidates candidates = (QCandidates)candidatesIterator.Current; snapshots.Add(candidates.ExecuteSnapshot(executionPath)); } IEnumerator snapshotsIterator = snapshots.GetEnumerator(); CompositeIterator4 resultingIDs = new CompositeIterator4(snapshotsIterator); if (!r.checkDuplicates) { return(resultingIDs); } return(CheckDuplicates(resultingIDs)); }
private Db4objects.Db4o.Internal.Query.Processor.QCandidate ReadSubCandidate(QCandidates candidateCollection) { Read(); if (_bytes == null || _fieldMetadata == null) { return null; } int offset = CurrentOffSet(); QueryingReadContext context = NewQueryingReadContext(); ITypeHandler4 handler = HandlerRegistry.CorrectHandlerVersion(context, _fieldMetadata .GetHandler()); Db4objects.Db4o.Internal.Query.Processor.QCandidate subCandidate = candidateCollection .ReadSubCandidate(context, handler); Seek(offset); if (subCandidate != null) { subCandidate._root = GetRoot(); return subCandidate; } return null; }
private IInternalCandidate ReadSubCandidate(QCandidates candidateCollection) { Read(); if (_bytes == null || _fieldMetadata == null) { return(null); } int offset = CurrentOffSet(); QueryingReadContext context = NewQueryingReadContext(); ITypeHandler4 handler = HandlerRegistry.CorrectHandlerVersion(context, _fieldMetadata .GetHandler()); IInternalCandidate subCandidate = candidateCollection.ReadSubCandidate(context, handler ); Seek(offset); if (subCandidate != null) { subCandidate.Root(GetRoot()); return(subCandidate); } return(null); }
private QCandidate ReadSubCandidate(QCandidates candidateCollection) { Read(); if (_bytes == null || _fieldMetadata == null) { return(null); } var offset = CurrentOffSet(); var context = NewQueryingReadContext(); var handler = HandlerRegistry.CorrectHandlerVersion(context, _fieldMetadata .GetHandler()); var subCandidate = candidateCollection .ReadSubCandidate(context, handler); Seek(offset); if (subCandidate != null) { subCandidate._root = GetRoot(); return(subCandidate); } return(null); }
private List4 CreateQCandidatesList() { List4 candidatesList = null; IEnumerator i = IterateConstraints(); while (i.MoveNext()) { QCon constraint = (QCon)i.Current; constraint = constraint.GetRoot(); ClassMetadata classMetadata = constraint.GetYapClass(); if (classMetadata == null) { continue; } if (ConstraintCanBeAddedToExisting(candidatesList, constraint)) { continue; } QCandidates candidates = new QCandidates((LocalTransaction)_trans, classMetadata, null); candidatesList = new List4(candidatesList, candidates); } return(candidatesList); }
public virtual void SetProcessedByIndex(QCandidates candidates) { InternalSetProcessedByIndex(candidates); }
/// <param name="candidates"></param> internal virtual void EvaluateSimpleExec(QCandidates candidates) { }
public virtual void SetCandidates(QCandidates a_candidates) { i_candidates = a_candidates; }
internal virtual void CreateCandidates(Collection4 a_candidateCollection) { IEnumerator j = a_candidateCollection.GetEnumerator(); while (j.MoveNext()) { QCandidates candidates = (QCandidates)j.Current; if (candidates.TryAddConstraint(this)) { i_candidates = candidates; return; } } i_candidates = new QCandidates((LocalTransaction)i_trans, GetYapClass(), GetField (), false); i_candidates.AddConstraint(this); a_candidateCollection.Add(i_candidates); }
/// <param name="candidates"></param> /// <param name="rereadObject"></param> internal virtual void EvaluateEvaluationsExec(QCandidates candidates, bool rereadObject ) { }
private QCandidate ReadSubCandidate(QCandidates candidateCollection) { Read(); if (_bytes == null || _fieldMetadata == null) { return null; } var offset = CurrentOffSet(); var context = NewQueryingReadContext(); var handler = HandlerRegistry.CorrectHandlerVersion(context, _fieldMetadata .GetHandler()); var subCandidate = candidateCollection .ReadSubCandidate(context, handler); Seek(offset); if (subCandidate != null) { subCandidate._root = GetRoot(); return subCandidate; } return null; }
internal virtual bool CreateChild(QCandidates a_candidates) { if (!_include) { return false; } if (_fieldMetadata != null) { var handler = _fieldMetadata.GetHandler(); if (handler != null) { var queryingReadContext = new QueryingReadContext(Transaction(), MarshallerFamily().HandlerVersion(), _bytes, _key); var arrayElementHandler = Handlers4.ArrayElementHandler(handler, queryingReadContext ); if (arrayElementHandler != null) { var offset = queryingReadContext.Offset(); var outerRes = true; // The following construct is worse than not ideal. // For each constraint it completely reads the // underlying structure again. The structure could b // kept fairly easy. TODO: Optimize! var i = a_candidates.IterateConstraints(); while (i.MoveNext()) { var qcon = (QCon) i.Current; var qf = qcon.GetField(); if (qf == null || qf.Name().Equals(_fieldMetadata.GetName())) { var tempParent = qcon.Parent(); qcon.SetParent(null); var candidates = new QCandidates(a_candidates.i_trans, null, qf); candidates.AddConstraint(qcon); qcon.SetCandidates(candidates); ReadArrayCandidates(handler, queryingReadContext.Buffer(), arrayElementHandler, candidates ); queryingReadContext.Seek(offset); var isNot = qcon.IsNot(); if (isNot) { qcon.RemoveNot(); } candidates.Evaluate(); var pending = ByRef.NewInstance(); bool[] innerRes = {isNot}; candidates.Traverse(new _IVisitor4_160(innerRes, isNot, pending)); // Collect all pending subresults. // We need to change // the // constraint here, so // our // pending collector // uses // the right // comparator. // We only keep one // pending result // for // all array // elements. // and memorize, // whether we had a // true or a false // result. // or both. if (isNot) { qcon.Not(); } // In case we had pending subresults, we // need to communicate // them up to our root. if (((Tree) pending.value) != null) { ((Tree) pending.value).Traverse(new _IVisitor4_229(this)); } if (!innerRes[0]) { // Again this could be double triggering. // // We want to clean up the "No route" // at some stage. qcon.Visit(GetRoot(), qcon.Evaluator().Not(false)); outerRes = false; } qcon.SetParent(tempParent); } } return outerRes; } // We may get simple types here too, if the YapField was null // in the higher level simple evaluation. Evaluate these // immediately. if (Handlers4.IsQueryLeaf(handler)) { a_candidates.i_currentConstraint.Visit(this); return true; } } } if (_fieldMetadata == null) { return false; } if (_fieldMetadata is NullFieldMetadata) { return false; } _classMetadata.SeekToField(Transaction(), _bytes, _fieldMetadata); var candidate = ReadSubCandidate( a_candidates); if (candidate == null) { return false; } // fast early check for ClassMetadata if (a_candidates.i_classMetadata != null && a_candidates.i_classMetadata.IsStronglyTyped ()) { var handler = _fieldMetadata.GetHandler(); if (Handlers4.IsUntyped(handler)) { handler = TypeHandlerFor(candidate); } if (handler == null) { return false; } } AddDependant(a_candidates.Add(candidate)); return true; }
public _IFunction4_205(QCandidates _enclosing, string fieldName) { this._enclosing = _enclosing; this.fieldName = fieldName; }
public _IVisitor4_346(QCandidates _enclosing, QCandidates.TreeIntBuilder result) { this._enclosing = _enclosing; this.result = result; }
public _IVisitor4_336(QCandidates candidates) { this.candidates = candidates; }
public override void MarkAsBestIndex(QCandidates candidates) { _constraint.SetProcessedByIndex(candidates); _next.MarkAsBestIndex(candidates); }
public _IClosure4_318(QCandidate _enclosing, ITypeHandler4 arrayElementHandler, IReadBuffer buffer, QCandidates candidates) { this._enclosing = _enclosing; this.arrayElementHandler = arrayElementHandler; this.buffer = buffer; this.candidates = candidates; }
internal override void EvaluateSimpleExec(QCandidates a_candidates) { // TODO: The following can be skipped if we used the index on // this field to load the objects, if hasOrdering() is false if (i_field.IsQueryLeaf() || IsNullConstraint()) { a_candidates.Traverse(i_field); PrepareComparison(i_field); a_candidates.Filter(this); } }
public IndexedNodeCollector(QCandidates candidates) { _nodes = new Collection4(); _nodeCache = new Hashtable4(); CollectIndexedNodes(candidates); }
protected virtual void InternalSetProcessedByIndex(QCandidates candidates) { _processedByIndex = true; if (i_joins != null) { IEnumerator i = i_joins.GetEnumerator(); while (i.MoveNext()) { ((QConJoin)i.Current).SetProcessedByIndex(candidates); } } }
public FieldIndexProcessor(QCandidates candidates) { _candidates = candidates; }
internal virtual QCandidate ToQCandidate(QCandidates candidates) { QCandidate qc = new QCandidate(candidates, null, _key); qc._preceding = ToQCandidate((Db4objects.Db4o.Internal.TreeInt)((Tree)_preceding) , candidates); qc._subsequent = ToQCandidate((Db4objects.Db4o.Internal.TreeInt)((Tree)_subsequent ), candidates); qc._size = _size; return qc; }
private void ReadArrayCandidates(ITypeHandler4 typeHandler, IReadBuffer buffer, ITypeHandler4 arrayElementHandler, QCandidates candidates) { if (!Handlers4.IsCascading(arrayElementHandler)) { return; } var slotFormat = SlotFormat.ForHandlerVersion(_handlerVersion); slotFormat.DoWithSlotIndirection(buffer, typeHandler, new _IClosure4_318(this, arrayElementHandler , buffer, candidates)); }
public _IProcedure4_243(QCandidates _enclosing) { this._enclosing = _enclosing; }
public _IVisitor4_346(QCandidates _enclosing, QCandidates.TreeIntBuilder result) { this._enclosing = _enclosing; this.result = result; }
public virtual Tree ToQCandidate(QCandidates candidates) { return TreeInt.ToQCandidate(ToTreeInt(), candidates); }
/// <param name="candidates"></param> internal virtual void Collect(QCandidates candidates) { }
public _IFunction4_159(QCandidates _enclosing) { this._enclosing = _enclosing; }
private void CollectIndexedNodes(QCandidates candidates) { CollectIndexedNodes(candidates.IterateConstraints()); ImplicitlyAndJoinsOnSameField(); }
internal override void EvaluateSimpleExec(QCandidates a_candidates) { a_candidates.Filter(this); }
public _IFunction4_205(QCandidates _enclosing, string fieldName) { this._enclosing = _enclosing; this.fieldName = fieldName; }
public static QCandidate ToQCandidate(Db4objects.Db4o.Internal.TreeInt tree, QCandidates candidates) { if (tree == null) { return null; } return tree.ToQCandidate(candidates); }
public _IProcedure4_243(QCandidates _enclosing) { this._enclosing = _enclosing; }