org.geotools.data.jdbc
Interface SQLBuilder

All Known Implementing Classes:
DefaultSQLBuilder, GeoAPISQLBuilder, MySQLSQLBuilder, PostgisSQLBuilder

Deprecated. scheduled for removal in 2.7, use classes in org.geotools.jdbc

public interface SQLBuilder

Provides an interface for SQL statement construction.

Currently just doing query building, but obviously this can be extended.

Author:
Sean Geoghegan, Defence Science and Technology Organisation.

Method Summary
 java.lang.String buildSQLQuery(java.lang.String typeName, FIDMapper mapper, org.opengis.feature.type.AttributeDescriptor[] attrTypes, org.opengis.filter.Filter filter)
          Deprecated. use buildSQLQuery(String, FIDMapper, AttributeDescriptor[], Filter, SortBy[], Integer, Integer)
 java.lang.String buildSQLQuery(java.lang.String typeName, FIDMapper mapper, org.opengis.feature.type.AttributeDescriptor[] attrTypes, org.opengis.filter.Filter filter, org.opengis.filter.sort.SortBy[] sortBy, java.lang.Integer offset, java.lang.Integer limit)
          Deprecated. Makes an SQL Select statement.
 void encode(java.lang.StringBuffer sql, org.opengis.filter.expression.Expression expression)
          Deprecated. Lower level method allowing for the encoding of a single expession in sql
 void encode(java.lang.StringBuffer sql, org.opengis.filter.Filter filter)
          Deprecated. Lower level method allowing for the encoding of a single filter in sql
 org.opengis.filter.Filter getPostQueryFilter(org.opengis.filter.Filter filter)
          Deprecated. Returns the Filter required for post processing.
 org.opengis.filter.Filter getPreQueryFilter(org.opengis.filter.Filter filter)
          Deprecated.  
 void setHints(Hints hints)
          Deprecated. Hints supplied by the user.
 void sqlColumns(java.lang.StringBuffer sql, FIDMapper mapper, org.opengis.feature.type.AttributeDescriptor[] attributes)
          Deprecated. Produces the select information required.
 void sqlFrom(java.lang.StringBuffer sql, java.lang.String typeName)
          Deprecated. Consutrcts FROM clause for featureType
 void sqlOrderBy(java.lang.StringBuffer sql, FIDMapper mapper, org.opengis.filter.sort.SortBy[] sortBy)
          Deprecated. Constructs ORDER BY clause.
 void sqlOrderBy(java.lang.StringBuffer sql, org.opengis.filter.sort.SortBy[] sortBy)
          Deprecated. use sqlOrderBy(StringBuffer, FIDMapper, SortBy[])
 void sqlWhere(java.lang.StringBuffer sql, org.opengis.filter.Filter preFilter)
          Deprecated. Constructs WHERE clause, if needed, for FILTER.
 

Method Detail

setHints

void setHints(Hints hints)
Deprecated. 
Hints supplied by the user.

The following hints are of interest when working with Features:

Parameters:
hints -
Since:
2.4.1

buildSQLQuery

java.lang.String buildSQLQuery(java.lang.String typeName,
                               FIDMapper mapper,
                               org.opengis.feature.type.AttributeDescriptor[] attrTypes,
                               org.opengis.filter.Filter filter,
                               org.opengis.filter.sort.SortBy[] sortBy,
                               java.lang.Integer offset,
                               java.lang.Integer limit)
                               throws SQLEncoderException
Deprecated. 
Makes an SQL Select statement. Constructs an SQL statement that will select the features from the table based on the filter. The default implementation creates a select statement for the table with the name typeName, selecting all the columns with the names in the attrTypes array using the filter as a WHERE clause. The default implementation ignores the maxFeature parameter since this requires DB dependant SQL. Subclasses can override this to provide the maxFeatures functionality specific to their DB.

Parameters:
typeName - a String with the typeName used as the table to query
mapper - an FIDMapper
attrTypes - the array of AttributeType elements for the select statement
filter - the filter to convert to a where statement
sortBy -
offset -
limit -
Returns:
a String representing an SQL statement
Throws:
SQLEncoderException - If an error occurs encoding the SQL FIXME: This should change to a FilterToSQLException after SQLEncoder is dropped

buildSQLQuery

java.lang.String buildSQLQuery(java.lang.String typeName,
                               FIDMapper mapper,
                               org.opengis.feature.type.AttributeDescriptor[] attrTypes,
                               org.opengis.filter.Filter filter)
                               throws SQLEncoderException
Deprecated. use buildSQLQuery(String, FIDMapper, AttributeDescriptor[], Filter, SortBy[], Integer, Integer)

Throws:
SQLEncoderException

getPostQueryFilter

org.opengis.filter.Filter getPostQueryFilter(org.opengis.filter.Filter filter)
Deprecated. 
Returns the Filter required for post processing.

The result will be null if no post processing is required.

This method is used by DefaultJDBCFeatureSource to see if the a Query can be optimized

Parameters:
filter -
Returns:
Filter required for post processing, or null

getPreQueryFilter

org.opengis.filter.Filter getPreQueryFilter(org.opengis.filter.Filter filter)
Deprecated. 

sqlColumns

void sqlColumns(java.lang.StringBuffer sql,
                FIDMapper mapper,
                org.opengis.feature.type.AttributeDescriptor[] attributes)
Deprecated. 
Produces the select information required.

The featureType, if known, is always requested.

sql: featureID (,attributeColumn)*

We may need to provide AttributeReaders with a hook so they can request a wrapper function.

Parameters:
sql -
mapper -
attributes -

sqlFrom

void sqlFrom(java.lang.StringBuffer sql,
             java.lang.String typeName)
Deprecated. 
Consutrcts FROM clause for featureType

sql: FROM typeName

Parameters:
sql -
typeName -

sqlWhere

void sqlWhere(java.lang.StringBuffer sql,
              org.opengis.filter.Filter preFilter)
              throws SQLEncoderException
Deprecated. 
Constructs WHERE clause, if needed, for FILTER.

sql: WHERE filter encoding

FIXME: This should change to a FilterToSQLException after SQLEncoder is dropped

Throws:
SQLEncoderException

sqlOrderBy

void sqlOrderBy(java.lang.StringBuffer sql,
                org.opengis.filter.sort.SortBy[] sortBy)
                throws SQLEncoderException
Deprecated. use sqlOrderBy(StringBuffer, FIDMapper, SortBy[])

Constructs ORDER BY clause.

sql: ORDER BY <property1> [ASC|DESC], ....

FIXME: This should change to a FilterToSQLException after SQLEncoder is dropped

Throws:
SQLEncoderException

encode

void encode(java.lang.StringBuffer sql,
            org.opengis.filter.expression.Expression expression)
            throws SQLEncoderException
Deprecated. 
Lower level method allowing for the encoding of a single expession in sql

Throws:
SQLEncoderException

encode

void encode(java.lang.StringBuffer sql,
            org.opengis.filter.Filter filter)
            throws SQLEncoderException
Deprecated. 
Lower level method allowing for the encoding of a single filter in sql

Throws:
SQLEncoderException

sqlOrderBy

void sqlOrderBy(java.lang.StringBuffer sql,
                FIDMapper mapper,
                org.opengis.filter.sort.SortBy[] sortBy)
                throws SQLEncoderException
Deprecated. 
Constructs ORDER BY clause.

sql: ORDER BY <property1> [ASC|DESC], ....

Parameters:
sql - buffer where the complete query is being built
mapper - where to inferr the primary key fields from in case the sortBy list contains SortBy.NATURAL_ORDER or SortBy.REVERSE_ORDER
sortBy - the order by criteria, possibly null FIXME: This should change to a FilterToSQLException after SQLEncoder is dropped
Throws:
SQLEncoderException


Copyright © 1996-2010 Geotools. All Rights Reserved.