| java.lang.Object org.geotools.data.h2.H2SQLBuilder
H2SQLBuilder | public class H2SQLBuilder implements FilterVisitor,ExpressionVisitor(Code) | | Encodes an sql statement.
This class is not thread safe.
author: Justin Deoliveira, The Open Planning Project |
Constructor Summary | |
public | H2SQLBuilder(JDBCState state, FilterFactory filterFactory) Creates the sql builder. |
Method Summary | |
public String | count(Filter filter) Encodes an entire sql SELECT statement of the form
"SELECT count(*) FROM ...". | public String | create() Encodes an entire "CREATE TABLE" statement. | public Statement | createTable() | public String | delete(Filter filter) Encodes an entire sql DELETE statement. | String | encode(CoordinateReferenceSystem crs) Helper method to encode a crs. | FeatureType | featureType() | public void | from() Encodes the FROM clause of a query. | protected void | geometry(Geometry geometry, String srid, StringBuffer sql) Encodes a geometry with a known srid to be used in an sql statement. | public StringBuffer | getSQL() | protected void | init() Initializes the state of the encoder. | public String | insert(String[] names, Object[] values) Encodes an entire sql INSERT statement. | 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(Query query) Encodes an entire sql SELECT statement. | public void | select(String[] propertyNames) Encodes the select clause of a query. | public void | sortBy(SortBy[] sortBy) Encodes the SORT BY clause of a query. | protected void | srid(String raw, StringBuffer sql) | protected void | string(String raw, StringBuffer sql) Encodes a string to be used in an sql statement. | public void | table() Encodes the table name of a query. | public String | update(Query query, Object[] values) Encodes an entire sql UPDATE statement. | 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 | visit(NilExpression nil, Object data) | 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(Function function, Object data) | public Object | visit(Literal literal, Object data) Encodes a literal. | public Object | visit(PropertyName propertyName, Object data) Encodes a
PropertyName in an sql statement. | public Object | visitNullFilter(Object data) | public 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
|
state | JDBCState state(Code) | | The state of the entry to create statements for
|
H2SQLBuilder | public H2SQLBuilder(JDBCState state, FilterFactory filterFactory)(Code) | | Creates the sql builder.
Parameters: state - The state of the entry the builder will create statements for. Parameters: filterFactory - A factory used to create filter objects. |
count | public String count(Filter filter)(Code) | | Encodes an entire sql SELECT statement of the form
"SELECT count(*) FROM ...".
Parameters: filter - The filter describing the where class of the select statement. |
create | public String create()(Code) | | Encodes an entire "CREATE TABLE" statement.
|
delete | public String delete(Filter filter)(Code) | | Encodes an entire sql DELETE statement.
In the event that the filter cannot be entirely encoded, no sql is encoded at all.
Parameters: filter - The filter dtermining what is to be deleted. |
encode | String encode(CoordinateReferenceSystem crs)(Code) | | Helper method to encode a crs. Can we have this on CRS?
|
from | public void from()(Code) | | Encodes the FROM clause of a query.
The encoded sql is of the form 'FROM
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 |
getSQL | public StringBuffer getSQL()(Code) | | The String buffer being used to encode the sql statement. |
init | protected void init()(Code) | | Initializes the state of the encoder.
|
insert | public String insert(String[] names, Object[] values)(Code) | | Encodes an entire sql INSERT statement.
Parameters: names - The names of attributes ( columns ) Parameters: values - The values to insert |
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(Query query)(Code) | | Encodes an entire sql SELECT statement.
Parameters: query - The query defining the select. |
select | public void select(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. |
sortBy | public void sortBy(SortBy[] sortBy)(Code) | | Encodes the SORT BY clause of a query.
Parameters: sortBy - The elements definining the columns to sort by. |
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 |
update | public String update(Query query, Object[] values)(Code) | | Encodes an entire sql UPDATE statement.
In the event that the query filter cannot be entirly encoded no sql is encoded at all.
Parameters: query - The query defining the properties to change and filter. Parameters: values - The new values. |
visit | public Object visit(PropertyIsGreaterThanOrEqualTo greaterThanOrEqualTo, Object data)(Code) | | |
visit | public Object visit(PropertyIsLessThanOrEqualTo lessThanOrEqualTo, Object data)(Code) | | |
visit | public Object visit(PropertyName propertyName, Object data)(Code) | | Encodes a
PropertyName in an sql statement.
If the AttributeType can be infered from
H2SQLBuilder.featureType then its name
is used directly.
The class binding of the attribute type, or null if unknown. |
where | public void where(Filter filter)(Code) | | Encodes the WHERE clause of a query.
Parameters: filter - The filter defining the where clause, non-null. |
|
|
|