| java.lang.Object org.geotools.data.jdbc.DefaultSQLBuilder
All known Subclasses: org.geotools.data.mysql.MySQLSQLBuilder, org.geotools.data.postgis.PostgisSQLBuilder, org.geotools.data.hsql.HsqlSQLBuilder,
DefaultSQLBuilder | public class DefaultSQLBuilder implements SQLBuilder(Code) | | Builds a complete SQL query to select the specified attributes for the
specified feature type, using a specified filter to generate a WHERE
clause.
The actual WHERE clause is generated by the SQLEncoder class or appropriate
subclass for a particular database. If a specific encoder is to be used,
it must be specified to the constructor for this class.
In order to implement the functionality of the application-specified Filter,
this is split into a 'preQueryFilter' which can be incorporated into the
SQL query itself and a 'postQueryFilter. The encoder capabilities are used
to determine how much of the function can be performed by the database
directly and how much has to be performed on the result set.
author: Sean Geoghegan, Defence Science and Technology Organisation. |
Method Summary | |
public String | buildSQLQuery(String typeName, FIDMapper mapper, AttributeType[] attrTypes, org.opengis.filter.Filter filter) Constructs the full SQL SELECT statement for the supplied Filter. | public Filter | getPostQueryFilter(Filter filter) Return the postQueryFilter that must be applied to the database query
result set. | public Filter | getPreQueryFilter(Filter filter) Return the preQueryFilter that can be used to generate the WHERE clause. | public synchronized boolean | isForce2D() | public void | setHints(Hints hints) | protected void | splitFilter(Filter filter) | public void | sqlColumns(StringBuffer sql, FIDMapper mapper, AttributeType[] attributes) Appends the names of the columns to be selected. | public void | sqlFrom(StringBuffer sql, String typeName) | public void | sqlGeometryColumn(StringBuffer sql, AttributeType geomAttribute) Generates the select column specification for a geometry column. | public void | sqlOrderBy(StringBuffer sql, SortBy[] sortBy) Generates the order by clause. | public void | sqlWhere(StringBuffer sql, Filter preFilter) Constructs WHERE clause, if needed, for FILTER. |
DefaultSQLBuilder | public DefaultSQLBuilder()(Code) | | Constructs an instance of this class with a default SQLEncoder
|
DefaultSQLBuilder | public DefaultSQLBuilder(SQLEncoder encoder)(Code) | | Constructs an instance of this class using the encoder class specified.
This will typically be from the getSqlBuilder method of a JDBCDataStore
subclass.
This constructor should not be used to obtain Pre/Post filters, as these
methods require a FeatureType to function properly.
Parameters: encoder - the specific encoder to be used. |
DefaultSQLBuilder | public DefaultSQLBuilder(SQLEncoder encoder, FeatureType featureType, ClientTransactionAccessor accessor)(Code) | | Constructs an instance of this class using the encoder class specified.
This will typically be from the getSqlBuilder method of a JDBCDataStore
subclass.
Parameters: encoder - the specific encoder to be used. Parameters: featureType - Parameters: accessor - client-side transaction handler; may be null. |
buildSQLQuery | public String buildSQLQuery(String typeName, FIDMapper mapper, AttributeType[] attrTypes, org.opengis.filter.Filter filter) throws SQLEncoderException(Code) | | Constructs the full SQL SELECT statement for the supplied Filter.
The statement is constructed by concatenating the SELECT column list,
FROM table specification and WHERE clause appropriate to the supplied
Filter.
Parameters: typeName - The name of the table (feature type) to be queried Parameters: mapper - FIDMapper to identify the FID columns in the table Parameters: attrTypes - The specific attribute columns to be selected Parameters: filter - The Filter that will be used by the encoder to constructthe WHERE clause The fully formed SQL SELECT statement throws: SQLEncoderException - Not thrown by this method but may be thrownby the encoder class |
getPostQueryFilter | public Filter getPostQueryFilter(Filter filter)(Code) | | Return the postQueryFilter that must be applied to the database query
result set.
Parameters: filter - the application filter which must be applied the filter representing the functionality that must be performedon the result set. |
getPreQueryFilter | public Filter getPreQueryFilter(Filter filter)(Code) | | Return the preQueryFilter that can be used to generate the WHERE clause.
Parameters: filter - the application filter which must be applied the filter representing the functionality that can be performedby the database. |
isForce2D | public synchronized boolean isForce2D()(Code) | | Check the hints to see if we are forced into 2D
|
splitFilter | protected void splitFilter(Filter filter)(Code) | | |
sqlColumns | public void sqlColumns(StringBuffer sql, FIDMapper mapper, AttributeType[] attributes)(Code) | | Appends the names of the columns to be selected.
sqlGeometryColumn is invoked for any special handling for geometry
columns.
Parameters: sql - StringBuffer to be appended to Parameters: mapper - FIDMapper to provide the name(s) of the FID columns Parameters: attributes - Array of columns to be selected See Also: postgisDataStore.SQLBuilder.sqlColumns(java.lang.StringBufferpostgisDataStore.FIDMapper.FIDMapperorg.geotools.feature.AttributeType[]) |
sqlFrom | public void sqlFrom(StringBuffer sql, String typeName)(Code) | | Constructs the FROM clause for a featureType
sql: FROM typeName
Parameters: sql - the StringBuffer that the WHERE clause should be appended to Parameters: typeName - the name of the table (feature type) to be queried |
sqlGeometryColumn | public void sqlGeometryColumn(StringBuffer sql, AttributeType geomAttribute)(Code) | | Generates the select column specification for a geometry column.
This should typically be overridden in the subclass to return a
meaningful value that the attribute i/o handler can process.
Parameters: sql - A StringBuffer that the column specification can be appendedto Parameters: geomAttribute - An AttributeType for a geometry attribute |
sqlOrderBy | public void sqlOrderBy(StringBuffer sql, SortBy[] sortBy) throws SQLEncoderException(Code) | | Generates the order by clause.
This uses the standard ASC,DESC sql keywords to denote ascending,descending
sort respectivley.
|
sqlWhere | public void sqlWhere(StringBuffer sql, Filter preFilter) throws SQLEncoderException(Code) | | Constructs WHERE clause, if needed, for FILTER.
sql: WHERE filter encoding
Parameters: sql - The StringBuffer that the WHERE clause should be appended to Parameters: preFilter - The filter to be used by the encoder class to generatethe WHERE clause throws: SQLEncoderException - Not thrown here but may be thrown by theencoder |
|
|