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, SRIDsFields 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 voidprotected FilterCapabilitiesSets the DB2 filter capabilities.Construct a geometry from the WKT representation of a geometrybooleanbooleanvoidsetFunctionEncodingEnabled(boolean functionEncodingEnabled) voidsetLooseBBOXEnabled(boolean looseBBOXEnabled) voidsetSelectivityClause(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 ObjectvisitBinarySpatialOperator(BinarySpatialOperator filter, Expression e1, Expression e2, boolean swapped, Object extraData) protected ObjectvisitBinarySpatialOperator(BinarySpatialOperator filter, Expression e1, Expression e2, Object extraData) Handles the more general case of two generic expressions.protected ObjectvisitBinarySpatialOperator(BinarySpatialOperator filter, PropertyName property, Literal geometry, boolean swapped, Object extraData) Handles the common case of a PropertyName,Literal geometry binary spatial operator.booleanvisitFunction(Function function, Object extraData) Performs custom visits for functions that cannot be encoded asfunctionName(p1, p2, ... pN).voidvisitLiteralGeometry(Literal expression) Construct the appropriate geometry type from the WKT representation of a literal expressionprotected voidwriteLiteral(Object literal) Writes out a non null, non geometry literal.Methods inherited from class PreparedFilterToSQL
convertEnvelopeToPolygon, getDescriptors, getDimensions, getLiteralTypes, getLiteralValues, getSRIDs, isPrepareEnabled, setPrepareEnabled, visit, visitMethods 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:
createFilterCapabilitiesin 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:FilterToSQLHandles the common case of a PropertyName,Literal geometry binary spatial operator.- Overrides:
visitBinarySpatialOperatorin classFilterToSQL
-
visitBinarySpatialOperator
protected Object visitBinarySpatialOperator(BinarySpatialOperator filter, Expression e1, Expression e2, Object extraData) Description copied from class:FilterToSQLHandles the more general case of two generic expressions.The most common case is two PropertyName expressions, which happens during a spatial join.
- Overrides:
visitBinarySpatialOperatorin 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:
visitLiteralGeometryin 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:FilterVisitorVisitFilter.EXCLUDE(often used during data structure transformations).- Specified by:
visitin interfaceFilterVisitor- Overrides:
visitin classFilterToSQL- Parameters:
filter- the filter to be visitedextraData- Value object provided to visitor- Returns:
- subclass supplied
-
visit
Description copied from interface:FilterVisitorVisitFilter.INCLUDE(often used during data structure transformations).- Specified by:
visitin interfaceFilterVisitor- Overrides:
visitin 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:FilterToSQLWrites 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:
writeLiteralin 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:FilterToSQLWrites 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:
visitin interfaceExpressionVisitor- Overrides:
visitin classFilterToSQL- Parameters:
function- a function expression- Throws:
RuntimeException- If an IO error occurs.- See Also:
-