|Delegation Rules: WHERE Clause / WHERE Clause Examples for Delegation|
Contains is a boolean spatial operator that evaluates whether an object, such as a polygon, contains all of another geometry.
SELECT city FROM table WHERE obj Contains <geometry>
If the data source provider supports Contains, the entire query is delegated to the data source provider.
If the data source provider does not support Contains, the query is converted to an EnvelopesIntersect and delegated to the data source provider. If the envelopes do not intersect, then they cannot satisfy a contains operation and the result returns false.
SELECT city, obj FROM table WHERE obj EnvelopesIntersect <geometry>
Spectrum Spatial evaluates Contains using the results from the data source provider.
SELECT city FROM <results of the delegation> WHERE obj Contains <geometry>
SELECT city FROM table WHERE <geometry> Contains obj
This example is the opposite of the first example. It is also the inverse of the Within operator with the operands reversed. As written, this query does not meet the rules of the WHERE clause, where boolean operators must be in the form WHERE <column> operator <geometry>. The query is rephrased as a Within operation and delegated according to the rules for Within.
SELECT city FROM table WHERE obj Within <geometry>