[odb-users] Multiple placeholders

Boris Kolpackov boris at codesynthesis.com
Tue Apr 12 11:50:51 EDT 2016

Hi Aarón,

Aarón Bueno Villares <abv150ci at gmail.com> writes:

> Can views have more than one placeholders (?) to pass more than one
> parameter? For example, a "and filter" for the where clause and a group by
> clause, or parametrized limits, and such kind of things.

Not yet, but there are plans to support this (will have to drop C++98 support
first; see below). In the meantime, the workaround is to push the final
"query trailer" construction to runtime, for example:

db.query<person> (query::name == "John" + "ORDER BY" + query::age)

Here is the entry in our "change management" repository for this issue:

- Multiple (?) or order_by() in query condition


  #pragma ... query(foo.bar.not_null () && (?))

  If we substitute "ORDER BY ..." for (?), then we will get "... AND ORDER BY"
  in the statement. We can make it work by changing && to + but then if
  we actually have additional conditions, that won't work.

  One idea: have order_by() pragma? Though we can also have LIMIT, OFFSET,
  etc. This should also align with ORDER BY, etc syntax in general queries.

  Another idea: support multiple (?) that are "filled" from multiple
  query() arguments (C++11 variadic template).


More information about the odb-users mailing list