void OptimizeQuery(Db4objects.Db4o.Query.IQuery q, object predicate, System.Reflection.MethodBase filterMethod) { if (_builder == null) { _builder = NQOptimizerFactory.CreateExpressionBuilder(); } _builder.Optimize(q, predicate, filterMethod); }
public virtual System.Collections.Generic.IList <Extent> Execute <Extent>(Db4objects.Db4o.Query.IQuery query, System.Predicate <Extent> match, Db4objects.Db4o.Query.IQueryComparator comparator) { #if CF return(ExecuteUnoptimized <Extent>(QueryForExtent <Extent>(query, comparator), match)); #else // XXX: check GetDelegateList().Length // only 1 delegate must be allowed // although we could use it as a filter chain // (and) return(ExecuteImpl <Extent>(query, match, match.Target, match.Method, match, comparator)); #endif }
private System.Collections.Generic.IList <Extent> ExecuteImpl <Extent>( Db4objects.Db4o.Query.IQuery query, object originalPredicate, object matchTarget, System.Reflection.MethodBase matchMethod, System.Predicate <Extent> match, Db4objects.Db4o.Query.IQueryComparator comparator) { Db4objects.Db4o.Query.IQuery q = QueryForExtent <Extent>(query, comparator); try { if (OptimizeNativeQueries()) { OptimizeQuery(q, matchTarget, matchMethod); OnQueryExecution(originalPredicate, QueryExecutionKind.DynamicallyOptimized); return(WrapQueryResult <Extent>(q)); } } catch (FileNotFoundException fnfe) { NativeQueryOptimizerNotLoaded(fnfe); } catch (TargetInvocationException tie) { NativeQueryOptimizerNotLoaded(tie); } catch (TypeLoadException tle) { NativeQueryOptimizerNotLoaded(tle); } catch (System.Exception e) { OnQueryOptimizationFailure(e); NativeQueryUnoptimized(e); } return(ExecuteUnoptimized(q, match)); }
private Db4objects.Db4o.Query.IQuery ConfigureQuery(Db4objects.Db4o.Query.IQuery query, Db4objects.Db4o.Query.Predicate predicate) { IDb4oEnhancedFilter filter = predicate as IDb4oEnhancedFilter; if (null != filter) { filter.OptimizeQuery(query); OnQueryExecution(predicate, QueryExecutionKind.PreOptimized); return(query); } query.Constrain(predicate.ExtentType()); try { if (OptimizeNativeQueries()) { OptimizeQuery(query, predicate, predicate.GetFilterMethod()); OnQueryExecution(predicate, QueryExecutionKind.DynamicallyOptimized); return(query); } } catch (System.Exception e) { OnQueryOptimizationFailure(e); if (OptimizeNativeQueries()) { DiagnosticProcessor dp = Container()._handlers.DiagnosticProcessor(); if (dp.Enabled()) { dp.NativeQueryUnoptimized(predicate, e); } } } query.Constrain(new Db4objects.Db4o.Internal.Query.PredicateEvaluation(predicate)); OnQueryExecution(predicate, QueryExecutionKind.Unoptimized); return(query); }
public virtual Db4objects.Db4o.IObjectSet Execute(Db4objects.Db4o.Query.IQuery query, Db4objects.Db4o.Query.Predicate predicate, Db4objects.Db4o.Query.IQueryComparator comparator) { Db4objects.Db4o.Query.IQuery q = ConfigureQuery(query, predicate); q.SortBy(comparator); return(q.Execute()); }
private static System.Collections.Generic.IList <Extent> WrapQueryResult <Extent>(Db4objects.Db4o.Query.IQuery query) { IQueryResult queryResult = ((QQuery)query).GetQueryResult(); return(new GenericObjectSetFacade <Extent>(queryResult)); }
private Db4objects.Db4o.Query.IQuery QueryForExtent <Extent>(Db4objects.Db4o.Query.IQuery query, Db4objects.Db4o.Query.IQueryComparator comparator) { query.Constrain(typeof(Extent)); query.SortBy(comparator); return(query); }