[qtcontacts-sqlite] Cache detail tables queries

Previously, the detail table queries were built and prepared each
time they were run during either the creation or regeneration of
an aggregate.  This commit ensures that the prepared queries are
cached for later re-use.  In particular, this improves the perf
of batch updates of existing contacts, as this would trigger
regeneration of each aggregate (and for each regeneration, the
queryContacts() function is called once per aggregate).
[qtcontacts-sqlite] Use setForwardOnly() on SELECT queries

Previously, only the cached queries in the writer had setForwardOnly
set to true.  This commit sets this flag for SELECT queries in the
reader, to reduce memory usage while iterating over result sets.