# WHERE Clause

Copyright (c) 2008, 2020 SAP AG and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which accompanies this distribution, and is available at https://www.eclipse.org/legal/epl-2.0/

The WHERE clause specifies search conditions, that remove unwanted data from the query result. The following operators, are in order of precedence. The operators are evaluated in the specified order:

# >=, <=, >, <, [ NOT ] LIKE, [ NOT ] IN, IMPLEMENTS (relational operations)

SELECT * FROM java.lang.String s WHERE s.count >= 100
SELECT * FROM java.lang.String s WHERE toString(s) LIKE ".*day"

SELECT * FROM java.lang.String s WHERE s.value NOT IN dominators(s) The right hand side of IN can be a Java java.util.List, Java Object[] array, a Java int[] array, or a result table from another SELECT, in which case the item is searched among the entries in the first column. If the right hand side is a Java int[] array and the left hand side is an IObject then the object ID is searched for in the array.

SELECT * FROM java.lang.Class c WHERE c IMPLEMENTS org.eclipse.mat.snapshot.model.IClass IMPLEMENTS works when the left hand side is any object or an integer which is considered as an object ID and the actual IObject is used for the test.

# =, != (equality operations)

SELECT * FROM java.lang.String s WHERE toString(s) = "monday"

# AND (conditional AND operation)

SELECT * FROM java.lang.String s WHERE s.count > 100 AND s.@retainedHeapSize > s.@usedHeapSize

# OR (conditional OR operation)

SELECT * FROM java.lang.String s WHERE s.count > 1000 OR s.value.@length > 1000

Operators can be applied to expressions, constant literals and sub queries. Valid expressions are explained in the next sections.

# Literal Expression

Boolean, String, Integer, Long, Character, Float, Double and null literals:

SELECT * FROM java.lang.String s WHERE ( s.count > 1000 ) = true OR toString(s) = "monday" OR dominators(s).size() = 0 OR s.@retainedHeapSize > 1024L OR s.value != null AND s.value.@valueArray.@length >= 1 AND s.value.@valueArray.get(0) = 'j'
SELECT * FROM instanceof java.lang.Number s WHERE s.value > -1 OR s.value > -1L OR s.value > 0.1 OR s.value > -0.1E-2F OR s.value > 0.1D OR s.value > -0.1E-2D OR s.value > 0.1 OR s.value > -0.1E-2F OR s.value > 0.1D OR s.value > -0.1E-2D