Fix SQLite parsing fields incorrectly when using subqueries.

When using subqueries or joining against tables containing FROM the
results were bizzare and unexpected. By tokenizing the entire query we
can more accurately grab the fields.

Refs #3972
Fix issues with sqlite field parsing.

The previous attempt would still fail on unions or derived table join
queries. This new approach is a bit slower but more robust.

Refs #3972
Fix CS, remove extra space
Merge pull request #5146 from cakephp/issue-3972

Fix SQLite result sets failing with nested queries or unions