public class DB2FilterToSQL extends PreparedFilterToSQL
The following spatial filter operations are supported:
FilterToSQL.FieldEncoder
descriptors, dialect, dimensions, literalTypes, literalValues, SRIDs
capabilities, currentDimension, currentGeometry, currentSRID, databaseSchema, encodingFunction, escapeBackslash, featureType, fieldEncoder, filterFactory, inEncodingEnabled, inline, IO_ERROR, out, primaryKey, sqlNameEscape
Constructor and Description |
---|
DB2FilterToSQL(PreparedStatementSQLDialect dialect) |
DB2FilterToSQL(Writer out) |
Modifier and Type | Method and Description |
---|---|
protected void |
addSelectivity() |
protected FilterCapabilities |
createFilterCapabilities()
Sets the DB2 filter capabilities.
|
String |
db2Geom(Geometry geom)
Construct a geometry from the WKT representation of a geometry
|
HashMap<Class<?>,String> |
getPredicateMap() |
boolean |
isFunctionEncodingEnabled() |
boolean |
isLooseBBOXEnabled() |
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.
|
Object |
visit(ExcludeFilter filter,
Object extraData)
Visit
Filter.EXCLUDE (often used during data structure transformations). |
Object |
visit(Function function,
Object extraData)
Writes sql for a function expression.
|
Object |
visit(IncludeFilter filter,
Object extraData)
Visit
Filter.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 as
functionName(p1, p2, ... pN). |
void |
visitLiteralGeometry(Literal expression)
Construct the appropriate geometry type from the WKT representation of a literal expression
|
protected void |
writeLiteral(Object literal)
Writes out a non null, non geometry literal.
|
convertEnvelopeToPolygon, getDescriptors, getDimensions, getLiteralTypes, getLiteralValues, getSRIDs, isPrepareEnabled, setPrepareEnabled, visit, visit
cast, encode, encode, encodeBinaryComparisonOperator, encodeToString, encodeToString, escapeLiteral, escapeName, evaluateLiteral, getCapabilities, getDatabaseSchema, getDistanceInMeters, getDistanceInNativeUnits, getExpressionType, getFeatureType, getFunctionName, getFunctionReturnType, getParameter, getPrimaryKey, getReferenceGeometryCentroid, getSqlNameEscape, isBinaryExpression, isEscapeBackslash, isInEncodingEnabled, 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
public DB2FilterToSQL(PreparedStatementSQLDialect dialect)
public DB2FilterToSQL(Writer out)
public String db2Geom(Geometry geom)
geom
- the constructor for the geometry.protected FilterCapabilities createFilterCapabilities()
createFilterCapabilities
in class FilterToSQL
public void setSelectivityClause(String string)
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.
string
- a selectivity clauseprotected Object visitBinarySpatialOperator(BinarySpatialOperator filter, PropertyName property, Literal geometry, boolean swapped, Object extraData)
FilterToSQL
visitBinarySpatialOperator
in class FilterToSQL
protected Object visitBinarySpatialOperator(BinarySpatialOperator filter, Expression e1, Expression e2, Object extraData)
FilterToSQL
The most common case is two PropertyName expressions, which happens during a spatial join.
visitBinarySpatialOperator
in class FilterToSQL
protected Object visitBinarySpatialOperator(BinarySpatialOperator filter, Expression e1, Expression e2, boolean swapped, Object extraData)
public void visitLiteralGeometry(Literal expression) throws IOException
visitLiteralGeometry
in class FilterToSQL
expression
- the expression turn into a geometry constructor.IOException
- Passes back exception if generated by this.out.write()protected void addSelectivity() throws IOException
IOException
public Object visit(ExcludeFilter filter, Object extraData)
FilterVisitor
Filter.EXCLUDE
(often used during data structure transformations).visit
in interface FilterVisitor
visit
in class FilterToSQL
filter
- the filter to be visitedextraData
- Value object provided to visitorFilterVisitor#visit(ExcludeFilter, Object)}
Writes the SQL for the IncludeFilter by writing "FALSE".
public Object visit(IncludeFilter filter, Object extraData)
FilterVisitor
Filter.INCLUDE
(often used during data structure transformations).visit
in interface FilterVisitor
visit
in class FilterToSQL
filter
- the filter to be visitedextraData
- Value object provided to visitorFilterVisitor#visit(IncludeFilter, Object)}
Writes the SQL for the IncludeFilter by writing "TRUE".
public boolean isLooseBBOXEnabled()
public void setLooseBBOXEnabled(boolean looseBBOXEnabled)
protected void writeLiteral(Object literal) throws IOException
FilterToSQL
writeLiteral
in class FilterToSQL
IOException
public boolean isFunctionEncodingEnabled()
public void setFunctionEncodingEnabled(boolean functionEncodingEnabled)
public boolean visitFunction(Function function, Object extraData) throws IOException
functionName(p1, p2, ... pN).
IOException
public Object visit(Function function, Object extraData) throws RuntimeException
FilterToSQL
visit
in interface ExpressionVisitor
visit
in class FilterToSQL
function
- a function expressionRuntimeException
- If an IO error occurs.FilterToSQL.getFunctionName(Function)
Copyright © 1996–2023 Geotools. All rights reserved.