PrevUpHomeNext

Buliding a Query

    const query<cinema> local_cinemas =
        cinemas
        .where(within_radius);

Remarks

local_cinemas is a query that filters the records in cinemas by the predicate within_radius. Its output is all the records in cinemas for which the predicate within_radius evaluates to true.

Here are two things to know about queries:

In the case of local_cinemas, its value mapper is identical to cinemas's value mapper, in the strictest sense of identical: cinemas.operator->() == local_cinemas.operator->(). That is because local_cinemas was created by where(), which has the following rules:

(which, by the way, are also true of Q.distinct(...), Q.distinct_on(...), Q.except(...), Q.except_all(...), Q.intersect(...), Q.intersect_all(...), Q.limit(...), Q.order(...), Q.skip(...), Q.union_(...), and Q.union_all(...). On the other hand there are somewhat different rules for select() and functions in the join() family.)

And here are two more things to know about queries (and tables also):


PrevUpHomeNext