This topic applies to Java version only.
This feature is not complete and can only be used for experiments
Currently you can only attach a listener to the ObjectContainer:
1public static void nqListener() { 2
ObjectContainer db = Db4o.openFile(DBFILENAME); 3
((InternalObjectContainer)db).getNativeQueryHandler().addListener( 4
new Db4oQueryExecutionListener() { 5
public void notifyQueryExecuted(NQOptimizationInfo info) { 6
System.err.println(info); 7
} 8
}); 9
}
The listener will be notified on each native query call and will be passed the Predicate object processed, the optimized expression tree (if successful) and the success status of the optimization run:
ObjectContainerBase.UNOPTIMIZED ("UNOPTIMIZED")
if the predicate could not be optimized and is run in unoptimized mode
ObjectContainerBase.PREOPTIMIZED ("PREOPTIMIZED")
if the predicate already was optimized (due to class file or load time instrumentation)
ObjectContainerBase.DYNOPTIMIZED ("DYNOPTIMIZED")
if the predicate was optimized at query execution time