org.geotools.jdbc
Class PreparedFilterToSQL

java.lang.Object
  extended by org.geotools.data.jdbc.FilterToSQL
      extended by org.geotools.jdbc.PreparedFilterToSQL
All Implemented Interfaces:
org.opengis.filter.expression.ExpressionVisitor, org.opengis.filter.FilterVisitor
Direct Known Subclasses:
DB2FilterToSQL, OracleFilterToSQL, PostgisPSFilterToSql

public class PreparedFilterToSQL
extends FilterToSQL

Extension of FilterToSQL intended for use with prepared statements.

Each time a Literal is visited, a '?' is encoded, and the value and type of the literal are stored, available after the fact via getLiteralValues() and getLiteralTypes().

Author:
Justin Deoliveira, OpenGEO, Andrea Aime, OpenGEO

Field Summary
protected  PreparedStatementSQLDialect dialect
           
protected  java.util.List<java.lang.Class> literalTypes
           
protected  java.util.List<java.lang.Object> literalValues
          ordered list of literal values encountered and their types
protected  java.util.List<java.lang.Integer> SRIDs
           
 
Fields inherited from class org.geotools.data.jdbc.FilterToSQL
capabilities, currentGeometry, currentSRID, databaseSchema, encodingFunction, featureType, IO_ERROR, mapper, out, primaryKey
 
Constructor Summary
PreparedFilterToSQL()
          Deprecated. Use PreparedFilterToSQL(PreparedStatementSQLDialect) instead
PreparedFilterToSQL(PreparedStatementSQLDialect dialect)
          Contructor taking a reference to the SQL dialect, will use it to encode geometry placeholders
PreparedFilterToSQL(java.io.Writer out)
           
 
Method Summary
 java.util.List<java.lang.Class> getLiteralTypes()
           
 java.util.List<java.lang.Object> getLiteralValues()
           
 java.util.List<java.lang.Integer> getSRIDs()
          Returns the list of native SRID for each literal that happens to be a geometry, or null otherwise
 boolean isPrepareEnabled()
          If true (default) a sql statement with literal placemarks is created, otherwise a normal statement is created
 void setPrepareEnabled(boolean prepareEnabled)
           
 java.lang.Object visit(org.opengis.filter.Id filter, java.lang.Object extraData)
          Encodes an Id filter
 java.lang.Object visit(org.opengis.filter.expression.Literal expression, java.lang.Object context)
          Export the contents of a Literal Expresion
 
Methods inherited from class org.geotools.data.jdbc.FilterToSQL
createFilterCapabilities, encode, encode, encodeToString, encodeToString, escapeName, evaluateLiteral, getCapabilities, getDatabaseSchema, getFIDMapper, getPrimaryKey, setCapabilities, setDatabaseSchema, setFeatureType, setFIDMapper, 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, visitBinaryComparisonOperator, visitBinarySpatialOperator, visitBinarySpatialOperator, visitLiteralGeometry, visitNullFilter, writeLiteral
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

literalValues

protected java.util.List<java.lang.Object> literalValues
ordered list of literal values encountered and their types


literalTypes

protected java.util.List<java.lang.Class> literalTypes

SRIDs

protected java.util.List<java.lang.Integer> SRIDs

dialect

protected PreparedStatementSQLDialect dialect
Constructor Detail

PreparedFilterToSQL

public PreparedFilterToSQL()
Deprecated. Use PreparedFilterToSQL(PreparedStatementSQLDialect) instead

Default constructor


PreparedFilterToSQL

public PreparedFilterToSQL(PreparedStatementSQLDialect dialect)
Contructor taking a reference to the SQL dialect, will use it to encode geometry placeholders

Parameters:
dialect -

PreparedFilterToSQL

public PreparedFilterToSQL(java.io.Writer out)
Method Detail

isPrepareEnabled

public boolean isPrepareEnabled()
If true (default) a sql statement with literal placemarks is created, otherwise a normal statement is created

Returns:

setPrepareEnabled

public void setPrepareEnabled(boolean prepareEnabled)

visit

public java.lang.Object visit(org.opengis.filter.expression.Literal expression,
                              java.lang.Object context)
                       throws java.lang.RuntimeException
Description copied from class: FilterToSQL
Export the contents of a Literal Expresion

Specified by:
visit in interface org.opengis.filter.expression.ExpressionVisitor
Overrides:
visit in class FilterToSQL
Parameters:
expression - the Literal to export
Throws:
java.lang.RuntimeException - for io exception with writer

visit

public java.lang.Object visit(org.opengis.filter.Id filter,
                              java.lang.Object extraData)
Encodes an Id filter

Specified by:
visit in interface org.opengis.filter.FilterVisitor
Overrides:
visit in class FilterToSQL
Parameters:
filter - the
Throws:
java.lang.RuntimeException - If there's a problem writing output

getLiteralValues

public java.util.List<java.lang.Object> getLiteralValues()

getLiteralTypes

public java.util.List<java.lang.Class> getLiteralTypes()

getSRIDs

public java.util.List<java.lang.Integer> getSRIDs()
Returns the list of native SRID for each literal that happens to be a geometry, or null otherwise

Returns:


Copyright © 1996-2010 Geotools. All Rights Reserved.