A new model for query templates

* Compose cached queries with plain queries and other cached queries

* Uniform handling of parameterized and non-parameterized queries

* Uniform handling of record- and collection-valued queries

* Support for updating and deleting with cached statements

Fixes issue #17. Review by @cvogt.