| java.lang.Object org.deegree.io.datastore.sql.wherebuilder.WhereBuilder
All known Subclasses: org.deegree.io.datastore.sql.postgis.PostGISWhereBuilder, org.deegree.io.datastore.sql.generic.GenericSQLWhereBuilder, org.deegree.io.datastore.sql.oracle.OracleSpatialWhereBuilder,
WhereBuilder | public class WhereBuilder (Code) | | Creates SQL-WHERE clauses from OGC filter expressions (to restrict SQL statements to all stored
features that match a given filter).
Also handles the creation of ORDER-BY clauses.
author: Torsten Friebe author: Markus Schneider author: last edited by: $Author: aschmitz $ version: $Revision: 10506 $, $Date: 2008-03-06 08:50:33 -0800 (Thu, 06 Mar 2008) $ |
Method Summary | |
protected void | appendArithmeticExpressionAsSQL(StatementBuffer query, ArithmeticExpression expression, int targetSqlType) Appends an SQL fragment for the given object to the given sql statement. | protected void | appendComparisonOperationAsSQL(StatementBuffer query, ComparisonOperation operation) Appends an SQL fragment for the given object to the given sql statement. | protected void | appendComplexFilterAsSQL(StatementBuffer query, ComplexFilter filter) Appends an SQL fragment for the given object. | protected void | appendExpressionAsSQL(StatementBuffer query, Expression expression, int targetSqlType) Appends an SQL fragment for the given object to the given sql statement. | protected void | appendFeatureFilterAsSQL(StatementBuffer query, FeatureFilter filter) Appends an SQL fragment for the given object to the given sql statement. | protected void | appendFunctionAsSQL(StatementBuffer query, Function function, int targetSqlType) Appends an SQL fragment for the given object to the given sql statement. | public void | appendJoinTableList(StatementBuffer query) Appends the alias-qualified, comma separated list of all tables to be joined in order to
represent the associated filter expression (and possibly feature type joins). | protected void | appendLiteralAsSQL(StatementBuffer query, Literal literal, int targetSqlType) Appends an SQL fragment for the given object to the given sql statement. | protected void | appendLogicalOperationAsSQL(StatementBuffer query, LogicalOperation operation) Appends an SQL fragment for the given object to the given sql statement. | protected void | appendOperationAsSQL(StatementBuffer query, Operation operation) Appends an SQL fragment for the given object to the given sql statement. | public void | appendOrderByCondition(StatementBuffer query) Appends an SQL "ORDER BY"-condition that corresponds to the sort properties of the query to
the given SQL statement. | protected void | appendPropertyIsBetweenOperationAsSQL(StatementBuffer query, PropertyIsBetweenOperation operation) Appends an SQL fragment for the given object to the given sql statement. | protected void | appendPropertyIsCOMPOperationAsSQL(StatementBuffer query, PropertyIsCOMPOperation operation) Appends an SQL fragment for the given object to the given sql statement. | protected void | appendPropertyIsLikeOperationAsSQL(StatementBuffer query, PropertyIsLikeOperation operation) Appends an SQL fragment for the given object to the given sql statement. | protected void | appendPropertyIsNullOperationAsSQL(StatementBuffer query, PropertyIsNullOperation operation) Appends an SQL fragment for the given object to the given sql statement. | protected void | appendPropertyNameAsSQL(StatementBuffer query, PropertyName propertyName) Appends an SQL fragment for the given object to the given sql statement. | protected void | appendPropertyPathAsSQL(StatementBuffer query, PropertyPath propertyPath) Appends an SQL fragment for the given object to the given sql statement. | protected void | appendSpatialOperationAsSQL(StatementBuffer query, SpatialOperation operation) Appends an SQL fragment for the given object to the given sql statement. | final public void | appendWhereCondition(StatementBuffer query) Appends an SQL WHERE-condition corresponding to the Filter to the given SQL
statement. | protected void | buildFilterPropertyNameMap() | protected void | fillFunctionNameMap() Prepares the function map for functions with implementation specific names, e.g. | public Filter | getFilter() Returns the associated Filter instance. | protected String | getFunctionName(String name) Get the function with the specified name. | protected MappedGeometryPropertyType | getGeometryProperty(PropertyName propName) | protected int | getPropertyNameSQLType(PropertyName propertyName) | public String | getRootTableAlias(int i) Returns the table alias used for the specified root feature type. |
SRS_UNDEFINED | final protected static int SRS_UNDEFINED(Code) | | |
filter | protected Filter filter(Code) | | Filter for which the corresponding WHERE-clause will be generated.
|
WhereBuilder | public WhereBuilder(MappedFeatureType[] rootFts, String[] aliases, Filter filter, SortProperty[] sortProperties, TableAliasGenerator aliasGenerator, VirtualContentProvider vcProvider) throws DatastoreException(Code) | | Creates a new WhereBuilder instance.
Parameters: rootFts - selected feature types, more than one type means that the types are joined Parameters: aliases - aliases for the feature types, may be null (must have same length as rootFtsotherwise) Parameters: filter - Parameters: sortProperties - Parameters: aliasGenerator - aliasGenerator to be used to generate table aliases, may be null Parameters: vcProvider - throws: DatastoreException - |
appendExpressionAsSQL | protected void appendExpressionAsSQL(StatementBuffer query, Expression expression, int targetSqlType) throws FilterEvaluationException(Code) | | Appends an SQL fragment for the given object to the given sql statement.
Parameters: query - Parameters: expression - Parameters: targetSqlType - sql type code to be used for literals at the bottom of the expression tree throws: FilterEvaluationException - |
appendJoinTableList | public void appendJoinTableList(StatementBuffer query)(Code) | | Appends the alias-qualified, comma separated list of all tables to be joined in order to
represent the associated filter expression (and possibly feature type joins).
The list consist of left outer joins ("x LEFT OUTER JOIN y") and cross-product joins ("x,y"):
- left outer joins are generated for each join that is necessary, because of filter
expressions that target properties stored in related tables (condition joins)
- cross-product joins are generated for all feature type root tables (feature type joins)
that have not joined by filter expression joins before
Parameters: query - the list is appended to this SQLStatement |
appendLiteralAsSQL | protected void appendLiteralAsSQL(StatementBuffer query, Literal literal, int targetSqlType)(Code) | | Appends an SQL fragment for the given object to the given sql statement.
Parameters: query - Parameters: literal - Parameters: targetSqlType - |
appendPropertyIsNullOperationAsSQL | protected void appendPropertyIsNullOperationAsSQL(StatementBuffer query, PropertyIsNullOperation operation)(Code) | | Appends an SQL fragment for the given object to the given sql statement.
Parameters: query - Parameters: operation - |
appendPropertyNameAsSQL | protected void appendPropertyNameAsSQL(StatementBuffer query, PropertyName propertyName)(Code) | | Appends an SQL fragment for the given object to the given sql statement.
Parameters: query - Parameters: propertyName - |
appendPropertyPathAsSQL | protected void appendPropertyPathAsSQL(StatementBuffer query, PropertyPath propertyPath)(Code) | | Appends an SQL fragment for the given object to the given sql statement.
Parameters: query - Parameters: propertyPath - |
appendSpatialOperationAsSQL | protected void appendSpatialOperationAsSQL(StatementBuffer query, SpatialOperation operation) throws DatastoreException(Code) | | Appends an SQL fragment for the given object to the given sql statement. As this depends on
the handling of geometry data by the concrete database in use, this method must be
overwritten by any datastore implementation that has spatial capabilities.
Parameters: query - Parameters: operation - throws: DatastoreException - |
fillFunctionNameMap | protected void fillFunctionNameMap()(Code) | | Prepares the function map for functions with implementation specific names, e.g. upper case
conversion in ORACLE = UPPER(string); POSTGRES = UPPER(string), and MS Access =
UCase(string). Default SQL-function name map function 'UPPER' is 'UPPER'. If this function
shall be used with user databases e.g. SQLServer a specialized WhereBuilder must override
this method.
|
getFilter | public Filter getFilter()(Code) | | Returns the associated Filter instance.
the associated Filter instance |
getFunctionName | protected String getFunctionName(String name)(Code) | | Get the function with the specified name.
Parameters: name - the function name the mapped function name |
getPropertyNameSQLType | protected int getPropertyNameSQLType(PropertyName propertyName)(Code) | | |
getRootTableAlias | public String getRootTableAlias(int i)(Code) | | Returns the table alias used for the specified root feature type.
Parameters: i - index of the requested root feature type the alias used for the root table |
|
|