org.geotools.data.jdbc
Class DefaultSQLBuilder

java.lang.Object
  extended byorg.geotools.data.jdbc.DefaultSQLBuilder
All Implemented Interfaces:
SQLBuilder

public class DefaultSQLBuilder
extends java.lang.Object
implements SQLBuilder

Provides ...

Author:
Sean Geoghegan, Defence Science and Technology Organisation.

Field Summary
protected  SQLEncoder encoder
           
 
Constructor Summary
DefaultSQLBuilder()
           
DefaultSQLBuilder(SQLEncoder encoder)
          DOCUMENT ME!
 
Method Summary
 java.lang.String buildSQLQuery(java.lang.String typeName, java.lang.String fidColumnName, AttributeType[] attrTypes, Filter filter)
          Makes an SQL Select statement.
 Filter getPostQueryFilter(Filter filter)
          Returns the Filter required for post processing.
 Filter getPreQueryFilter(Filter filter)
           
 void sqlColumns(java.lang.StringBuffer sql, java.lang.String fidColumnName, AttributeType[] attributes)
          Produces the select information required.
 void sqlFrom(java.lang.StringBuffer sql, java.lang.String typeName)
          Consutrcts FROM clause for featureType
 void sqlWhere(java.lang.StringBuffer sql, Filter preFilter)
          Constructs WHERE clause, if needed, for FILTER.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

encoder

protected SQLEncoder encoder
Constructor Detail

DefaultSQLBuilder

public DefaultSQLBuilder()

DefaultSQLBuilder

public DefaultSQLBuilder(SQLEncoder encoder)
DOCUMENT ME!

Parameters:
encoder -
Method Detail

buildSQLQuery

public java.lang.String buildSQLQuery(java.lang.String typeName,
                                      java.lang.String fidColumnName,
                                      AttributeType[] attrTypes,
                                      Filter filter)
                               throws SQLEncoderException
Description copied from interface: SQLBuilder
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.

Specified by:
buildSQLQuery in interface SQLBuilder
Parameters:
attrTypes - The Attribute types for the select statement
filter - The filter to convert to a where statement.
Returns:
An SQL statement.
Throws:
SQLEncoderException - If an error occurs encoding the SQL

getPostQueryFilter

public Filter getPostQueryFilter(Filter filter)
Description copied from interface: SQLBuilder
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

Specified by:
getPostQueryFilter in interface SQLBuilder
Parameters:
filter -
Returns:
Filter requried for post processing, or null

getPreQueryFilter

public Filter getPreQueryFilter(Filter filter)
Specified by:
getPreQueryFilter in interface SQLBuilder

sqlColumns

public void sqlColumns(java.lang.StringBuffer sql,
                       java.lang.String fidColumnName,
                       AttributeType[] attributes)
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.

Specified by:
sqlColumns in interface SQLBuilder
Parameters:
sql -
fidColumnName -
attributes -

sqlFrom

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

sql: FROM typeName

Specified by:
sqlFrom in interface SQLBuilder
Parameters:
sql -
typeName -

sqlWhere

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

sql: WHERE filter encoding

Specified by:
sqlWhere in interface SQLBuilder
Parameters:
sql - DOCUMENT ME!
preFilter - DOCUMENT ME!
Throws:
SQLEncoderException - DOCUMENT ME!


Copyright © 1996-2003 GeoTools. All Rights Reserved.