Package org.geotools.data.db2
Class DB2FilterToSQL
Object
FilterToSQL
PreparedFilterToSQL
DB2FilterToSQL
- All Implemented Interfaces:
ExpressionVisitor
,FilterVisitor
Generate a WHERE clause for DB2 Spatial Extender based on a spatial filter.
The following spatial filter operations are supported:
- GEOMETRY_BBOX
- GEOMETRY_CONTAINS
- GEOMETRY_CROSSES
- GEOMETRY_DISJOINT
- GEOMETRY_EQUALS
- GEOMETRY_INTERSECTS
- GEOMETRY_OVERLAPS
- GEOMETRY_TOUCHES
- GEOMETRY_WITHIN
- GEOMETRY_DWITHIN
- Author:
- Mueller Christian
-
Nested Class Summary
Nested classes/interfaces inherited from class FilterToSQL
FilterToSQL.FieldEncoder
-
Field Summary
Fields inherited from class PreparedFilterToSQL
descriptors, dialect, dimensions, literalTypes, literalValues, SRIDs
Fields inherited from class FilterToSQL
capabilities, currentDimension, currentGeometry, currentSRID, databaseSchema, encodingFunction, escapeBackslash, featureType, fieldEncoder, filterFactory, inEncodingEnabled, inline, IO_ERROR, out, primaryKey, sqlNameEscape
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
protected FilterCapabilities
Sets the DB2 filter capabilities.Construct a geometry from the WKT representation of a geometryboolean
boolean
void
setFunctionEncodingEnabled
(boolean functionEncodingEnabled) void
setLooseBBOXEnabled
(boolean looseBBOXEnabled) void
setSelectivityClause
(String string) Sets a SELECTIVITY clause that can be included with the spatial predicate to influence the query optimizer to exploit a spatial index if it exists.visit
(ExcludeFilter filter, Object extraData) VisitFilter.EXCLUDE
(often used during data structure transformations).Writes sql for a function expression.visit
(IncludeFilter filter, Object extraData) VisitFilter.INCLUDE
(often used during data structure transformations).protected Object
visitBinarySpatialOperator
(BinarySpatialOperator filter, Expression e1, Expression e2, boolean swapped, Object extraData) protected Object
visitBinarySpatialOperator
(BinarySpatialOperator filter, Expression e1, Expression e2, Object extraData) Handles the more general case of two generic expressions.protected Object
visitBinarySpatialOperator
(BinarySpatialOperator filter, PropertyName property, Literal geometry, boolean swapped, Object extraData) Handles the common case of a PropertyName,Literal geometry binary spatial operator.boolean
visitFunction
(Function function, Object extraData) Performs custom visits for functions that cannot be encoded asfunctionName(p1, p2, ... pN).
void
visitLiteralGeometry
(Literal expression) Construct the appropriate geometry type from the WKT representation of a literal expressionprotected void
writeLiteral
(Object literal) Writes out a non null, non geometry literal.Methods inherited from class PreparedFilterToSQL
convertEnvelopeToPolygon, getDescriptors, getDimensions, getLiteralTypes, getLiteralValues, getSRIDs, isPrepareEnabled, setPrepareEnabled, visit, visit
Methods inherited from class FilterToSQL
cast, encode, encode, encodeBinaryComparisonOperator, encodeToString, encodeToString, escapeLiteral, escapeName, evaluateLiteral, getCapabilities, getDatabaseSchema, getDistanceInNativeUnits, getExpressionType, getFeatureType, getFunctionName, getFunctionReturnType, getParameter, getPrimaryKey, getSqlNameEscape, isBinaryExpression, isEscapeBackslash, isInEncodingEnabled, processLikeLeftOperand, setCapabilities, setDatabaseSchema, setEscapeBackslash, setFeatureType, setFieldEncoder, setInEncodingEnabled, setInline, setPrimaryKey, setSqlNameEscape, setWriter, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visitBinaryComparisonOperator, visitBinarySpatialOperator, visitBinaryTemporalOperator, visitBinaryTemporalOperator, visitBinaryTemporalOperator, visitInFunction, visitLiteralTimePeriod, visitNullFilter, writeBinaryExpression, writeBinaryExpressionMember
-
Constructor Details
-
DB2FilterToSQL
-
DB2FilterToSQL
-
-
Method Details
-
getPredicateMap
-
db2Geom
Construct a geometry from the WKT representation of a geometry- Parameters:
geom
- the constructor for the geometry.
-
createFilterCapabilities
Sets the DB2 filter capabilities.- Overrides:
createFilterCapabilities
in classFilterToSQL
- Returns:
- FilterCapabilities for DB2
-
setSelectivityClause
Sets a SELECTIVITY clause that can be included with the spatial predicate to influence the query optimizer to exploit a spatial index if it exists.The parameter should be of the form:
"SELECTIVITY 0.001"
where the numeric value is the fraction of rows that will be returned by using the index scan. This doesn't have to be true. The value 0.001 is typically used to force the use of the spatial in all cases if the spatial index exists.- Parameters:
string
- a selectivity clause
-
visitBinarySpatialOperator
protected Object visitBinarySpatialOperator(BinarySpatialOperator filter, PropertyName property, Literal geometry, boolean swapped, Object extraData) Description copied from class:FilterToSQL
Handles the common case of a PropertyName,Literal geometry binary spatial operator.- Overrides:
visitBinarySpatialOperator
in classFilterToSQL
-
visitBinarySpatialOperator
protected Object visitBinarySpatialOperator(BinarySpatialOperator filter, Expression e1, Expression e2, Object extraData) Description copied from class:FilterToSQL
Handles the more general case of two generic expressions.The most common case is two PropertyName expressions, which happens during a spatial join.
- Overrides:
visitBinarySpatialOperator
in classFilterToSQL
-
visitBinarySpatialOperator
protected Object visitBinarySpatialOperator(BinarySpatialOperator filter, Expression e1, Expression e2, boolean swapped, Object extraData) -
visitLiteralGeometry
Construct the appropriate geometry type from the WKT representation of a literal expression- Overrides:
visitLiteralGeometry
in classFilterToSQL
- Parameters:
expression
- the expression turn into a geometry constructor.- Throws:
IOException
- Passes back exception if generated by this.out.write()
-
addSelectivity
- Throws:
IOException
-
visit
Description copied from interface:FilterVisitor
VisitFilter.EXCLUDE
(often used during data structure transformations).- Specified by:
visit
in interfaceFilterVisitor
- Overrides:
visit
in classFilterToSQL
- Parameters:
filter
- the filter to be visitedextraData
- Value object provided to visitor- Returns:
- subclass supplied
-
visit
Description copied from interface:FilterVisitor
VisitFilter.INCLUDE
(often used during data structure transformations).- Specified by:
visit
in interfaceFilterVisitor
- Overrides:
visit
in classFilterToSQL
- Parameters:
filter
- the filter to be visitedextraData
- Value object provided to visitor- Returns:
- subclass supplied
-
isLooseBBOXEnabled
public boolean isLooseBBOXEnabled() -
setLooseBBOXEnabled
public void setLooseBBOXEnabled(boolean looseBBOXEnabled) -
writeLiteral
Description copied from class:FilterToSQL
Writes out a non null, non geometry literal. The base class properly handles null, numeric and booleans (true|false), and turns everything else into a string. Subclasses are expected to override this shall they need a different treatment (e.g. for dates)- Overrides:
writeLiteral
in classFilterToSQL
- Throws:
IOException
-
isFunctionEncodingEnabled
public boolean isFunctionEncodingEnabled() -
setFunctionEncodingEnabled
public void setFunctionEncodingEnabled(boolean functionEncodingEnabled) -
visitFunction
Performs custom visits for functions that cannot be encoded asfunctionName(p1, p2, ... pN).
- Throws:
IOException
-
visit
Description copied from class:FilterToSQL
Writes sql for a function expression. By default it will write the call by using the same arguments provided to the GeoTools function, subclasses should override on a case by case basis if this behavior is not the desired one.- Specified by:
visit
in interfaceExpressionVisitor
- Overrides:
visit
in classFilterToSQL
- Parameters:
function
- a function expression- Throws:
RuntimeException
- If an IO error occurs.- See Also:
-