core:  QueryData2 generates slow SQL for...

QueryData2 generates slow SQL for AuditLog with no parameters

This patch fixes two issues
When the inner query condition of getting the events is empty it omits
the inner query.
i.e.
Instead of
SELECT * FROM (SELECT * FROM audit_log WHERE ( audit_log_id > 0 and
audit_log_id IN (SELECT audit_log.audit_log_id FROM  audit_log  ) and
not deleted)  ORDER BY audit_log_id DESC ,audit_log_id DESC ) as T1
OFFSET (1 -1) LIMIT 100

Perform:
SELECT * FROM (SELECT * FROM audit_log WHERE ( audit_log_id > 0 and not
deleted)  ORDER BY audit_log_id DESC ,audit_log_id DESC ) as T1 OFFSET
(1 -1) LIMIT 100;

In addition, this patch fixes the redundancy in the SORT , so final
query is :

SELECT * FROM (SELECT * FROM audit_log WHERE ( audit_log_id > 0 and not
deleted)  ORDER BY audit_log_id DESC) as T1 OFFSET
(1 -1) LIMIT 100;

Change-Id: Id148adcc734c5742548c74ea754fb70252155e34
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=960831
Signed-off-by: Eli Mesika <emesika@redhat.com>