[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).