Clean up query execution with a fetch class.

* Don't instantiate classes we don't need to. Fixes habari/habari#517.
* Following on from 75fea9db, class names are case-sensitive.
* Use a sensible variable name.