| java.lang.Object org.geotools.data.jdbc.SQLBuilder
All known Subclasses: org.geotools.data.jdbc.DefaultSQLBuilder, org.geotools.data.jdbc.GeoAPISQLBuilder,
SQLBuilder | public class SQLBuilder implements ExpressionVisitor,FilterVisitor(Code) | | Builds raw sql statements.
This class should be subclasses to accomodate different dialects of sql.
This class maintains state and is not thread safe.
author: Justin Deoliveira, The Open Planning Project, jdeolive@openplans.org |
Method Summary | |
public String | bounds(FeatureType featureType) Builds a query which selects the envelope or bounding box of every
feature / row in a table. | public String | bounds(FeatureType featureType, Filter filter) Builds a query which selects the envelope or bounding box of a subset of
features / rows in a table. | public String | count(FeatureType featureType) Builds a query which selects the bound of all rows / features in a table. | public String | count(FeatureType featureType, Filter filter) Builds a query which selects the count of a subset of rows / features in
a table.
The filter argument can be used to filter those rows / features
included in the count, or null to include all rows.
A statement of the form "SELECT count(*) FROM ... | public String | createTable(FeatureType featureType) Builds a "CREATE TABLE" statement. | public void | delete(FeatureType featureType, Filter filter) Builds a statement of the form "DELETE FROM ... | public String | dropTable(FeatureType featureType) Builds a "DROP TABLE" statement. | String | encode(CoordinateReferenceSystem crs) Helper method to encode a crs. | protected void | from(FeatureType featureType) Encodes "FROM ".protected void | geometry(FeatureType featureType) Encodes the name of the default geometry in a statement. | protected void | geometry(Geometry geometry, String srid, StringBuffer sql) Encodes a geometry with a known srid to be used in an sql statement. | public FilterFactory | getFilterFactory() | protected StringBuffer | getSQL() | protected void | init() Initializes the state of the builder. | protected void | init(FeatureType featureType) Initializes the state of the builder setting the feature type being
worked on. | protected void | name(String raw) Encodes a name to be used in an sql statement. | protected void | nil(StringBuffer sql) Encodes nulL to be used in an sql statement. | public String | select(FeatureType featureType, Filter filter) Builds a statement of the form "SELECT att1,att2,...,attN FROM ... | protected void | select(FeatureType featureType, String[] propertyNames) Encodes the select clause of a query. | public void | setFilterFactory(FilterFactory filterFactory) | protected void | srid(String raw, StringBuffer sql) | protected void | string(String raw, StringBuffer sql) Encodes a string to be used in an sql statement. | protected void | table(String name) Encodes the table name of a query qualifying it with the database schema
name if set. | public Object | visit(PropertyName propertyName, Object data) Encodes a
PropertyName in an sql statement. | public Object | visit(Add add, Object data) | public Object | visit(Subtract subtract, Object data) | public Object | visit(Multiply multiply, Object data) | public Object | visit(Divide divide, Object data) | protected Object | visit(BinaryExpression expression, Object data, String operator) | public Object | visit(Literal literal, Object data) | public Object | visit(NilExpression expression, Object extraData) | public Object | visit(Function expression, Object extraData) | public Object | visit(ExcludeFilter exclude, Object data) | public Object | visit(IncludeFilter include, Object data) | public Object | visit(Not not, Object data) | public Object | visit(And and, Object data) | public Object | visit(Or or, Object data) | protected Object | visit(BinaryLogicOperator logic, Object data, String operator) | public Object | visit(Id id, Object data) | public Object | visit(PropertyIsBetween between, Object data) | public Object | visit(PropertyIsEqualTo equalTo, Object data) | public Object | visit(PropertyIsNotEqualTo notEqualTo, Object data) | public Object | visit(PropertyIsGreaterThan greaterThan, Object data) | public Object | visit(PropertyIsGreaterThanOrEqualTo greaterThanOrEqualTo, Object data) | public Object | visit(PropertyIsLessThan lessThan, Object data) | public Object | visit(PropertyIsLessThanOrEqualTo lessThanOrEqualTo, Object data) | protected Object | visit(BinaryComparisonOperator comparison, Object data, String operator) | public Object | visit(PropertyIsLike like, Object data) | public Object | visit(PropertyIsNull isNull, Object data) | public Object | visit(BBOX bbox, Object data) | protected Object | visit(PropertyName name, Geometry geometry, Object data) | public Object | visit(Beyond beyond, Object data) | public Object | visit(DWithin dwithin, Object data) | protected Object | visit(DistanceBufferOperator distance, Object data, String operator, boolean index) | public Object | visit(Disjoint disjoint, Object data) | public Object | visit(Contains contains, Object data) | public Object | visit(Crosses crosses, Object data) | public Object | visit(Equals equals, Object data) | public Object | visit(Intersects intersects, Object data) | public Object | visit(Overlaps overlaps, Object data) | public Object | visit(Touches touches, Object data) | public Object | visit(Within within, Object data) | protected Object | visit(BinarySpatialOperator comparison, Object data, String operator, boolean index) | public Object | visitNullFilter(Object data) | protected void | where(Filter filter) Encodes the WHERE clause of a query. |
filterFactory | FilterFactory filterFactory(Code) | | Filter factory used to create filters
|
postFilter | Filter postFilter(Code) | | Post-processing filter
|
bounds | public String bounds(FeatureType featureType)(Code) | | Builds a query which selects the envelope or bounding box of every
feature / row in a table.
Convenience for bounds(featureType,null) .
A statement of the form "SELECT envelope(...) FROM ..." |
bounds | public String bounds(FeatureType featureType, Filter filter)(Code) | | Builds a query which selects the envelope or bounding box of a subset of
features / rows in a table.
The filter argument can be used to filter those rows / features
returned or can be null to return all rows.
A statement of the form "SELECT envelope(...) FROM ... WHERE ..." |
count | public String count(FeatureType featureType)(Code) | | Builds a query which selects the bound of all rows / features in a table.
Convenience for count(null)
A statement of the form "SELECT count(*) FROM ..." |
count | public String count(FeatureType featureType, Filter filter)(Code) | | Builds a query which selects the count of a subset of rows / features in
a table.
The filter argument can be used to filter those rows / features
included in the count, or null to include all rows.
A statement of the form "SELECT count(*) FROM ... WHERE ..." |
createTable | public String createTable(FeatureType featureType)(Code) | | Builds a "CREATE TABLE" statement.
A statement of the form "CREATE TABLE ...". |
delete | public void delete(FeatureType featureType, Filter filter)(Code) | | Builds a statement of the form "DELETE FROM ... WHERE ...";
The filter parameter may be null to omit the where clause.
|
dropTable | public String dropTable(FeatureType featureType)(Code) | | Builds a "DROP TABLE" statement.
A statement of the form "DROP TABLE ...". |
encode | String encode(CoordinateReferenceSystem crs)(Code) | | Helper method to encode a crs. Can we have this on CRS?
|
from | protected void from(FeatureType featureType)(Code) | | Encodes "FROM
geometry | protected void geometry(FeatureType featureType)(Code) | | Encodes the name of the default geometry in a statement.
|
geometry | protected void geometry(Geometry geometry, String srid, StringBuffer sql)(Code) | | Encodes a geometry with a known srid to be used in an sql statement.
Parameters: geometry - The geometry to encode. Parameters: srid - The spatial reference id of the geometry Parameters: sql - HTe sql statement buffer |
getFilterFactory | public FilterFactory getFilterFactory()(Code) | | |
init | protected void init()(Code) | | Initializes the state of the builder.
|
init | protected void init(FeatureType featureType)(Code) | | Initializes the state of the builder setting the feature type being
worked on.
|
name | protected void name(String raw)(Code) | | Encodes a name to be used in an sql statement.
This implementation wraps the name in double quotes.
Parameters: raw - The raw name. |
nil | protected void nil(StringBuffer sql)(Code) | | Encodes nulL to be used in an sql statement.
Parameters: sql - The sql statement buffer |
select | public String select(FeatureType featureType, Filter filter)(Code) | | Builds a statement of the form "SELECT att1,att2,...,attN FROM ... WHERE ...";
The filter parameter may be null to omit the where clause.
|
select | protected void select(FeatureType featureType, String[] propertyNames)(Code) | | Encodes the select clause of a query.
If propertyNames is null or empty then "*" is used.
Parameters: propertyNames - The array of properties / columns in the select. |
setFilterFactory | public void setFilterFactory(FilterFactory filterFactory)(Code) | | |
srid | protected void srid(String raw, StringBuffer sql)(Code) | | Encodes a srid to be used in an sql statement
Parameters: srid - The raw spatial reference id of the geometry Parameters: sql - HTe sql statement buffer |
string | protected void string(String raw, StringBuffer sql)(Code) | | Encodes a string to be used in an sql statement.
Parameters: raw - The raw string. Parameters: sql - The sql statement buffer |
table | protected void table(String name)(Code) | | Encodes the table name of a query qualifying it with the database schema
name if set.
Parameters: name - The name of the table. |
visit | public Object visit(PropertyName propertyName, Object data)(Code) | | Encodes a
PropertyName in an sql statement.
If the AttributeType can be infered from
SQLBuilder.featureType then its name
is used directly.
The class binding of the attribute type, or null if unknown. |
visit | public Object visit(PropertyIsGreaterThanOrEqualTo greaterThanOrEqualTo, Object data)(Code) | | |
visit | public Object visit(PropertyIsLessThanOrEqualTo lessThanOrEqualTo, Object data)(Code) | | |
where | protected void where(Filter filter)(Code) | | Encodes the WHERE clause of a query.
Parameters: filter - The filter defining the where clause, non-null. |
|
|
|
|