When execution commences the value of :_currobj value is
null
and the value of :_allobjs is equal to the list of objects passed in. If a EXECUTE ON ALL clause is defined using :_allobjs in that context means "the objects passed in to the execute method". When these functions are executed the function itself may set the value of: :_currobj to allow expressions to work correctly, for example:SELECT * FROM java.io.File EXECUTE ON ALL avg (:_allobjs, length) avgLength
q.setCurrentObject (object);
When a WHERE clause is being executed, the list of objects passed in to the execute method is iterated over, the :_currobj value is set to the current object in the iteration and the WHERE clause then executed for that object. In essence the loop looks like (in the
Query.execute(List)
method):// Iterate over all the objects passed in. for (int i = 0; i < objs.size (); i++) { Object o = objs.get (i); setCurrentObject (o); if (whereClause.isTrue (this, o)) { // Add to results. } }
true
). At this point any EXECUTE ON RESULTS functions are executed, the same rules as for the EXECUTE ON ALL apply, the only difference here is that the :_allobjs bind variable now refers to the list of objects that were accepted by the WHERE clause. When the ORDER BY clause (if any) is then executed the value of :_currobj is a little more complex.