Source:
public void testHost ( ) { testValidSql ( "Host: sortby cpu_usage desc" , "SELECT * FROM ((SELECT vds.* FROM vds ) ORDER BY usage_cpu_percent DESC NULLS LAST,vds_name ASC ) as T1 OFFSET (1 -1) LIMIT 0" ) ; testValidSql ( "Host: name =\"test1\" sortby cpu_usage desc" , "SELECT * FROM ((SELECT vds.* FROM vds WHERE vds.vds_name LIKE test1 ) ORDER BY usage_cpu_percent DESC NULLS LAST,vds_name ASC ) as T1 OFFSET (1 -1) LIMIT 0" ) ; testValidSql ( "Host: CPU_USAGE > 80 sortby cpu_usage desc" , "SELECT * FROM ((SELECT vds.* FROM vds WHERE vds.usage_cpu_percent > 80 ) ORDER BY usage_cpu_percent DESC NULLS LAST,vds_name ASC ) as T1 OFFSET (1 -1) LIMIT 0" ) ; testValidSql ( "Host: user.name = \"user1\" sortby cpu_usage desc" , "SELECT * FROM ((SELECT vds.* FROM vds LEFT OUTER JOIN vdc_users_with_tags ON vds.vds_id=vdc_users_with_tags.vm_guid WHERE vdc_users_with_tags.name LIKE user1 ) ORDER BY usage_cpu_percent DESC NULLS LAST,vds_name ASC ) as T1 OFFSET (1 -1) LIMIT 0" ) ; testValidSql ( "Host: STORAGE.name = \"pool1\" sortby cpu_usage desc" , "SELECT * FROM ((SELECT vds.* FROM vds LEFT OUTER JOIN storage_domains_with_hosts_view ON vds.storage_pool_id=storage_domains_with_hosts_view.storage_pool_id WHERE storage_domains_with_hosts_view.storage_name LIKE pool1 ) ORDER BY usage_cpu_percent DESC NULLS LAST,vds_name ASC ) as T1 OFFSET (1 -1) LIMIT 0" ) ; testValidSql ( "Host: EVENT.severity=error and CPU_USAGE > 80 sortby cpu_usage desc" , "SELECT * FROM ((SELECT vds.* FROM vds LEFT OUTER JOIN audit_log ON vds.vds_id=audit_log.vds_id WHERE ( audit_log.severity = '2' AND vds.usage_cpu_percent > 80 )) ORDER BY usage_cpu_percent DESC NULLS LAST,vds_name ASC ) as T1 OFFSET (1 -1) LIMIT 0" ) ; testValidSql ( "Host: EVENT.severity=error and tag=tag1 sortby cpu_usage desc" , "SELECT * FROM (SELECT * FROM vds WHERE ( vds_id IN (SELECT vds_with_tags.vds_id FROM vds_with_tags LEFT OUTER JOIN audit_log ON vds_with_tags.vds_id=audit_log.vds_id WHERE ( audit_log.severity = '2' AND vds_with_tags.tag_name IN (tag1) ))) ORDER BY usage_cpu_percent DESC NULLS LAST,vds_name ASC ) as T1 OFFSET (1 -1) LIMIT 0" ) ; testValidSql ( "Host: tag=\"tag1\"" , "SELECT * FROM (SELECT * FROM vds WHERE ( vds_id IN (SELECT vds_with_tags.vds_id FROM vds_with_tags WHERE vds_with_tags.tag_name IN (tag1) )) ORDER BY vds_name ASC ) as T1 OFFSET (1 -1) LIMIT 0" ) ; testValidSql ( "Host: vm.name=\"vm1\"" , "SELECT * FROM ((SELECT vds.* FROM vds LEFT OUTER JOIN vms_with_tags ON vds.vds_id=vms_with_tags.run_on_vds WHERE vms_with_tags.vm_name LIKE vm1 ) ORDER BY vds_name ASC ) as T1 OFFSET (1 -1) LIMIT 0" ) ; testValidSql ( "Vms: cluster = default and Templates.name = template_1 and Storage.name = storage_1" , "SELECT * FROM (SELECT * FROM vms WHERE ( vm_guid IN (SELECT vms_with_tags.vm_guid FROM vms_with_tags LEFT OUTER JOIN vm_templates_storage_domain ON vms_with_tags.vmt_guid=vm_templates_storage_domain.vmt_guid LEFT OUTER JOIN storage_domains_with_hosts_view ON vms_with_tags.storage_id=storage_domains_with_hosts_view.id WHERE ( ( vms.vds_group_name LIKE default AND vm_templates_storage_domain.name LIKE template\\_1 ) AND storage_domains_with_hosts_view.storage_name LIKE storage\\_1 ))) ORDER BY vm_name ASC ) as T1 OFFSET (1 -1) LIMIT 0" ) ; testValidSql ( "Vms: cluster = default and Templates.name = template_1 and Storage.name = storage_1 and Vnic.network_name = vnic_1" , "SELECT * FROM (SELECT * FROM vms WHERE ( vm_guid IN (SELECT vms_with_tags.vm_guid FROM vms_with_tags LEFT OUTER JOIN vm_templates_storage_domain ON vms_with_tags.vmt_guid=vm_templates_storage_domain.vmt_guid LEFT OUTER JOIN storage_domains_with_hosts_view ON vms_with_tags.storage_id=storage_domains_with_hosts_view.id LEFT OUTER JOIN vm_interface_view ON vms_with_tags.vm_guid=vm_interface_view.vm_guid WHERE ( ( ( vms.vds_group_name LIKE default AND vm_templates_storage_domain.name LIKE template\\_1 ) AND storage_domains_with_hosts_view.storage_name LIKE storage\\_1 ) AND vm_interface_view.network_name LIKE vnic\\_1 ))) ORDER BY vm_name ASC ) as T1 OFFSET (1 -1) LIMIT 0" ) ; }

Target:
public void testHost ( ) { testValidSql ( "Host: sortby cpu_usage desc" , "SELECT * FROM ((SELECT vds.* FROM vds ) ORDER BY usage_cpu_percent DESC NULLS LAST,vds_name ASC ) as T1 OFFSET (1 -1) LIMIT 0" ) ; testValidSql ( "Host: name =\"test1\" sortby cpu_usage desc" , "SELECT * FROM ((SELECT vds.* FROM vds WHERE vds.vds_name LIKE test1 ) ORDER BY usage_cpu_percent DESC NULLS LAST,vds_name ASC ) as T1 OFFSET (1 -1) LIMIT 0" ) ; testValidSql ( "Host: CPU_USAGE > 80 sortby cpu_usage desc" , "SELECT * FROM ((SELECT vds.* FROM vds WHERE vds.usage_cpu_percent > 80 ) ORDER BY usage_cpu_percent DESC NULLS LAST,vds_name ASC ) as T1 OFFSET (1 -1) LIMIT 0" ) ; testValidSql ( "Host: user.name = \"user1\" sortby cpu_usage desc" , "SELECT * FROM ((SELECT vds.* FROM vds LEFT OUTER JOIN vdc_users_with_tags ON vds.vds_id=vdc_users_with_tags.vm_guid WHERE vdc_users_with_tags.name LIKE user1 ) ORDER BY usage_cpu_percent DESC NULLS LAST,vds_name ASC ) as T1 OFFSET (1 -1) LIMIT 0" ) ; testValidSql ( "Host: STORAGE.name = \"sd1\" sortby cpu_usage desc" , "SELECT * FROM (SELECT * FROM vds WHERE ( vds_id IN (SELECT vds_with_tags.vds_id FROM vds_with_tags LEFT OUTER JOIN storage_domains_with_hosts_view ON vds_with_tags.storage_id=storage_domains_with_hosts_view.id WHERE storage_domains_with_hosts_view.storage_name LIKE sd1 )) ORDER BY usage_cpu_percent DESC NULLS LAST,vds_name ASC ) as T1 OFFSET (1 -1) LIMIT 0" ) ; testValidSql ( "Host: EVENT.severity=error and CPU_USAGE > 80 sortby cpu_usage desc" , "SELECT * FROM ((SELECT vds.* FROM vds LEFT OUTER JOIN audit_log ON vds.vds_id=audit_log.vds_id WHERE ( audit_log.severity = '2' AND vds.usage_cpu_percent > 80 )) ORDER BY usage_cpu_percent DESC NULLS LAST,vds_name ASC ) as T1 OFFSET (1 -1) LIMIT 0" ) ; testValidSql ( "Host: EVENT.severity=error and tag=tag1 sortby cpu_usage desc" , "SELECT * FROM (SELECT * FROM vds WHERE ( vds_id IN (SELECT vds_with_tags.vds_id FROM vds_with_tags LEFT OUTER JOIN audit_log ON vds_with_tags.vds_id=audit_log.vds_id WHERE ( audit_log.severity = '2' AND vds_with_tags.tag_name IN (tag1) ))) ORDER BY usage_cpu_percent DESC NULLS LAST,vds_name ASC ) as T1 OFFSET (1 -1) LIMIT 0" ) ; testValidSql ( "Host: tag=\"tag1\"" , "SELECT * FROM (SELECT * FROM vds WHERE ( vds_id IN (SELECT vds_with_tags.vds_id FROM vds_with_tags WHERE vds_with_tags.tag_name IN (tag1) )) ORDER BY vds_name ASC ) as T1 OFFSET (1 -1) LIMIT 0" ) ; testValidSql ( "Host: vm.name=\"vm1\"" , "SELECT * FROM ((SELECT vds.* FROM vds LEFT OUTER JOIN vms_with_tags ON vds.vds_id=vms_with_tags.run_on_vds WHERE vms_with_tags.vm_name LIKE vm1 ) ORDER BY vds_name ASC ) as T1 OFFSET (1 -1) LIMIT 0" ) ; testValidSql ( "Vms: cluster = default and Templates.name = template_1 and Storage.name = storage_1" , "SELECT * FROM (SELECT * FROM vms WHERE ( vm_guid IN (SELECT vms_with_tags.vm_guid FROM vms_with_tags LEFT OUTER JOIN vm_templates_storage_domain ON vms_with_tags.vmt_guid=vm_templates_storage_domain.vmt_guid LEFT OUTER JOIN storage_domains_with_hosts_view ON vms_with_tags.storage_id=storage_domains_with_hosts_view.id WHERE ( ( vms.vds_group_name LIKE default AND vm_templates_storage_domain.name LIKE template\\_1 ) AND storage_domains_with_hosts_view.storage_name LIKE storage\\_1 ))) ORDER BY vm_name ASC ) as T1 OFFSET (1 -1) LIMIT 0" ) ; testValidSql ( "Vms: cluster = default and Templates.name = template_1 and Storage.name = storage_1 and Vnic.network_name = vnic_1" , "SELECT * FROM (SELECT * FROM vms WHERE ( vm_guid IN (SELECT vms_with_tags.vm_guid FROM vms_with_tags LEFT OUTER JOIN vm_templates_storage_domain ON vms_with_tags.vmt_guid=vm_templates_storage_domain.vmt_guid LEFT OUTER JOIN storage_domains_with_hosts_view ON vms_with_tags.storage_id=storage_domains_with_hosts_view.id LEFT OUTER JOIN vm_interface_view ON vms_with_tags.vm_guid=vm_interface_view.vm_guid WHERE ( ( ( vms.vds_group_name LIKE default AND vm_templates_storage_domain.name LIKE template\\_1 ) AND storage_domains_with_hosts_view.storage_name LIKE storage\\_1 ) AND vm_interface_view.network_name LIKE vnic\\_1 ))) ORDER BY vm_name ASC ) as T1 OFFSET (1 -1) LIMIT 0" ) ; }