Exemplo n.º 1
0
        public override bool MatchObjectWithOid(NeoDatis.Odb.OID oid, bool returnObject,
                                                bool inMemory)
        {
            currentOid = oid;
            // Gets a map with the values with the fields involved in the query
            values = objectReader.ReadObjectInfoValuesFromOID(classInfo, currentOid, true, involvedFields
                                                              , involvedFields, 0, criteriaQuery.GetOrderByFieldNames());
            bool objectMatches = true;

            if (!criteriaQuery.IsForSingleOid())
            {
                // Then apply the query on the field values
                objectMatches = NeoDatis.Odb.Impl.Core.Query.Criteria.CriteriaQueryManager.Match(
                    criteriaQuery, values);
            }
            NeoDatis.Odb.Core.Layers.Layer2.Meta.ObjectInfoHeader oih = values.GetObjectInfoHeader
                                                                            ();
            // Stores the next position
            nextOID = oih.GetNextObjectOID();
            return(objectMatches);
        }
Exemplo n.º 2
0
        public override bool MatchObjectWithOid(NeoDatis.Odb.OID oid, bool returnObject,
                                                bool inMemory)
        {
            currentOid = oid;
            ITmpCache        tmpCache = session.GetTmpCache();
            ObjectInfoHeader oih      = null;

            try
            {
                if (!criteriaQuery.HasCriteria())
                {
                    // true, false = use cache, false = do not return object
                    // TODO Warning setting true to useCache will put all objects in
                    // the cache
                    // This is not a good idea for big queries!, But use cache=true
                    // resolves when object have not been committed yet!
                    // for big queries, user should use a LazyCache!
                    if (inMemory)
                    {
                        currentNnoi = objectReader.ReadNonNativeObjectInfoFromOid(classInfo, currentOid,
                                                                                  true, returnObject);
                        if (currentNnoi.IsDeletedObject())
                        {
                            return(false);
                        }
                        currentOid = currentNnoi.GetOid();
                        nextOID    = currentNnoi.GetNextObjectOID();
                    }
                    else
                    {
                        oih     = objectReader.ReadObjectInfoHeaderFromOid(currentOid, false);
                        nextOID = oih.GetNextObjectOID();
                    }
                    return(true);
                }
                // Gets a map with the values with the fields involved in the query
                AttributeValuesMap attributeValues = objectReader.ReadObjectInfoValuesFromOID(classInfo, currentOid, true, involvedFields, involvedFields
                                                                                              , 0, criteriaQuery.GetOrderByFieldNames());
                // Then apply the query on the field values
                bool objectMatches = CriteriaQueryManager.Match(criteriaQuery, attributeValues);
                if (objectMatches)
                {
                    // Then load the entire object
                    // true, false = use cache
                    currentNnoi = objectReader.ReadNonNativeObjectInfoFromOid(classInfo, currentOid,
                                                                              true, returnObject);
                    currentOid = currentNnoi.GetOid();
                }
                oih = attributeValues.GetObjectInfoHeader();
                // Stores the next position
                nextOID = oih.GetNextObjectOID();
                return(objectMatches);
            }
            finally
            {
                tmpCache.ClearObjectInfos();
            }
        }