Build the same cache key when $fields:

* is a string containing fields separated by comma.
* is an array with one element being a string containing fields
separated by comma.
* is an array containing fields.

In every case, the cache key will be the same when:
 * fields (which can contain expressions) are duplicated.
 * fiels are empty.
Add documentation to the quite obscure fields(), and make some additions:

* Avoid duplicating virtual fields when trying to remove them from the fields array.
* _constructVirtualFields() should handle field (full) qualification.
* Remove unnecessary vars.
* Handle the case where $fields is an SQL function with a fully qualified or a numeric field inside.