Refactoring: simplify use of cursor queries

When the query has been built with a known set of fields to retrieve,
there is no need to compute them as we statically know them.

Also, the cursor cannot be null after a query that did not raise an
exception. It is positionned before the first result, so moveToNext()
can be called right away on it, allowing the use of while { … } rather
than do { … } while.