BZ_1080171 - defer adding of "WHERE" keyword until we know that it is needed.
Updated checks after comments from @metlos.
Merge pull request #17 from pilhuhn/bz1080171

BZ_1080171 - defer adding of "WHERE" keyword until we know that it is needed.