(PDB-658) Moving events querying to the new query engine

This commit moves over the existing event and node querying features into the
query engine. This required extending the query engine to support
>,>=,<,<= on dates, fact subqueries and some additional validation on subqueries.

This does NOT include moving over event distinct-resources? to the new query
engine. Queries against the node's certname must now use "certname" as
the field (as previously "name"). Docs change related to that will be
made separately.