|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectGeoAPISQLBuilder
public class GeoAPISQLBuilder
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 FilterToSQL 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.
modules/library/jdbc (gt-jdbc.jar)
Field Summary | |
---|---|
protected ClientTransactionAccessor |
accessor
Deprecated. |
protected FilterToSQL |
encoder
Deprecated. |
protected SimpleFeatureType |
ft
Deprecated. |
Constructor Summary | |
---|---|
GeoAPISQLBuilder()
Deprecated. Constructs an instance of this class with a default FilterToSQL |
|
GeoAPISQLBuilder(FilterToSQL encoder,
SimpleFeatureType featureType,
ClientTransactionAccessor accessor)
Deprecated. Constructs an instance of this class using the encoder class specified. |
Method Summary | |
---|---|
String |
buildSQLQuery(String typeName,
FIDMapper mapper,
AttributeDescriptor[] attrTypes,
Filter filter)
Deprecated. use buildSQLQuery(String, FIDMapper, AttributeDescriptor[], Filter, SortBy[], Integer, Integer) |
String |
buildSQLQuery(String typeName,
FIDMapper mapper,
AttributeDescriptor[] attrTypes,
Filter filter,
SortBy[] sortBy,
Integer offset,
Integer limit)
Deprecated. Constructs the full SQL SELECT statement for the supplied Filter. |
void |
encode(StringBuffer sql,
Expression expression)
Deprecated. Lower level method allowing for the encoding of a single expession in sql |
void |
encode(StringBuffer sql,
Filter filter)
Deprecated. Lower level method allowing for the encoding of a single filter in sql |
protected SimplifyingFilterVisitor.FIDValidator |
getFidValidator()
Deprecated. Returns a fid validator to filter out the invalid fids from a Filter |
Filter |
getPostQueryFilter(Filter filter)
Deprecated. Return the postQueryFilter that must be applied to the database query result set. |
Filter |
getPreQueryFilter(Filter filter)
Deprecated. Return the preQueryFilter that can be used to generate the WHERE clause. |
boolean |
isForce2D()
Deprecated. Check the hints to see if we are forced into 2D |
void |
setHints(Hints hints)
Deprecated. Hints supplied by the user. |
protected void |
splitFilter(Filter filter)
Deprecated. |
void |
sqlColumns(StringBuffer sql,
FIDMapper mapper,
AttributeDescriptor[] attributes)
Deprecated. Appends the names of the columns to be selected. |
void |
sqlFrom(StringBuffer sql,
String typeName)
Deprecated. Constructs the FROM clause for a featureType sql: FROM typeName
|
void |
sqlGeometryColumn(StringBuffer sql,
AttributeDescriptor geomAttribute)
Deprecated. Generates the select column specification for a geometry column. |
void |
sqlOrderBy(StringBuffer sql,
FIDMapper mapper,
SortBy[] sortBy)
Deprecated. Generates the order by clause. |
void |
sqlOrderBy(StringBuffer sql,
SortBy[] sortBy)
Deprecated. |
void |
sqlWhere(StringBuffer sql,
Filter preFilter)
Deprecated. Constructs WHERE clause, if needed, for FILTER. |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected FilterToSQL encoder
protected SimpleFeatureType ft
protected ClientTransactionAccessor accessor
Constructor Detail |
---|
public GeoAPISQLBuilder()
public GeoAPISQLBuilder(FilterToSQL encoder, SimpleFeatureType featureType, ClientTransactionAccessor accessor)
encoder
- the specific encoder to be used.featureType
- accessor
- client-side transaction handler; may be null.Method Detail |
---|
public void setHints(Hints hints)
SQLBuilder
The following hints are of interest when working with Features:
setHints
in interface SQLBuilder
public boolean isForce2D()
public Filter getPostQueryFilter(Filter filter)
getPostQueryFilter
in interface SQLBuilder
filter
- the application filter which must be applied
public Filter getPreQueryFilter(Filter filter)
getPreQueryFilter
in interface SQLBuilder
filter
- the application filter which must be applied
protected void splitFilter(Filter filter)
protected SimplifyingFilterVisitor.FIDValidator getFidValidator()
encoder
's
FIDMapper.isValid(String)
splitFilter(Filter)
public void sqlFrom(StringBuffer sql, String typeName)
sql: FROM typeName
sqlFrom
in interface SQLBuilder
sql
- the StringBuffer that the WHERE clause should be appended totypeName
- the name of the table (feature type) to be queriedpublic void sqlWhere(StringBuffer sql, Filter preFilter) throws SQLEncoderException
sql: WHERE filter encoding
sqlWhere
in interface SQLBuilder
sql
- The StringBuffer that the WHERE clause should be appended topreFilter
- The filter to be used by the encoder class to generate
the WHERE clause
SQLEncoderException
- Not thrown here but may be thrown by the
encoder
FIXME: Throw FilterToSQLException when the parent interface is fixed.public String buildSQLQuery(String typeName, FIDMapper mapper, AttributeDescriptor[] attrTypes, Filter filter, SortBy[] sortBy, Integer offset, Integer limit) throws SQLEncoderException
The statement is constructed by concatenating the SELECT column list, FROM table specification and WHERE clause appropriate to the supplied Filter.
Subclasses that support startIndex
should override as
appropriate.
buildSQLQuery
in interface SQLBuilder
typeName
- The name of the table (feature type) to be queriedmapper
- FIDMapper to identify the FID columns in the tableattrTypes
- The specific attribute columns to be selectedfilter
- The Filter that will be used by the encoder to construct
the WHERE clause
SQLEncoderException
- Not thrown by this method but may be thrown
by the encoder class
FIXME: Throw FilterToSQLException when the parent interface is fixed.public String buildSQLQuery(String typeName, FIDMapper mapper, AttributeDescriptor[] attrTypes, Filter filter) throws SQLEncoderException
buildSQLQuery(String, FIDMapper, AttributeDescriptor[], Filter, SortBy[], Integer, Integer)
buildSQLQuery
in interface SQLBuilder
SQLEncoderException
public void sqlColumns(StringBuffer sql, FIDMapper mapper, AttributeDescriptor[] attributes)
sqlGeometryColumn is invoked for any special handling for geometry columns.
sqlColumns
in interface SQLBuilder
sql
- StringBuffer to be appended tomapper
- FIDMapper to provide the name(s) of the FID columnsattributes
- Array of columns to be selectedpublic void sqlGeometryColumn(StringBuffer sql, AttributeDescriptor geomAttribute)
This should typically be overridden in the subclass to return a meaningful value that the attribute i/o handler can process.
sql
- A StringBuffer that the column specification can be appended
togeomAttribute
- An AttributeDescriptor for a geometry attributepublic void sqlOrderBy(StringBuffer sql, SortBy[] sortBy) throws SQLEncoderException
SQLBuilder
sql: ORDER BY <property1> [ASC|DESC], ....
sqlOrderBy
in interface SQLBuilder
SQLEncoderException
public void sqlOrderBy(StringBuffer sql, FIDMapper mapper, SortBy[] sortBy) throws SQLEncoderException
This uses the standard ASC,DESC sql keywords to denote ascending,descending sort respectivley.
FIXME: Throw FilterToSQLException when the parent interface is fixed.
sqlOrderBy
in interface SQLBuilder
sql
- buffer where the complete query is being builtmapper
- 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
SQLEncoderException
public void encode(StringBuffer sql, Expression expression) throws SQLEncoderException
SQLBuilder
encode
in interface SQLBuilder
SQLEncoderException
public void encode(StringBuffer sql, Filter filter) throws SQLEncoderException
SQLBuilder
encode
in interface SQLBuilder
SQLEncoderException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |