org.geotools.data.db2
Class DB2SQLBuilder

java.lang.Object
  extended byorg.geotools.data.jdbc.DefaultSQLBuilder
      extended byorg.geotools.data.db2.DB2SQLBuilder
All Implemented Interfaces:
SQLBuilder

public class DB2SQLBuilder
extends DefaultSQLBuilder

A DB2-specific subclass of DefaultSQLBuilder, which supports DB2 Spatial Extender geometry datatypes.

Author:
David Adler - IBM Corporation

Field Summary
 
Fields inherited from class org.geotools.data.jdbc.DefaultSQLBuilder
encoder
 
Constructor Summary
DB2SQLBuilder(SQLEncoder encoder, java.lang.String tableSchema, java.lang.String tableName)
          Creates a DB2SQLBuilder that will provide a table schema to qualify table names.
 
Method Summary
 java.lang.String buildSQLBoundsQuery(java.lang.String typeName, AttributeType geomAttr, Filter filter)
          Builds the SQL query to get the bounds (min-max coordinate values) of a geometry column for a given filter.
 void sqlFrom(java.lang.StringBuffer sql, java.lang.String typeName)
          Construct the FROM clause for a feature type.
 void sqlGeometryColumn(java.lang.StringBuffer sql, AttributeType geomAttribute)
          Generates the select column specification for a DB2 geometry column.
 
Methods inherited from class org.geotools.data.jdbc.DefaultSQLBuilder
buildSQLQuery, getPostQueryFilter, getPreQueryFilter, sqlColumns, sqlWhere
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DB2SQLBuilder

public DB2SQLBuilder(SQLEncoder encoder,
                     java.lang.String tableSchema,
                     java.lang.String tableName)
Creates a DB2SQLBuilder that will provide a table schema to qualify table names. The table schema is provided by the DB2DataStore which means that a given DataStore can only access tables within a single schema.

It would be better if the table schema was managed by FeatureTypeHandler or FeatureType.

Parameters:
encoder - an SQLEncoder
tableSchema - table schema to qualify table names
tableName - the table name to be used by this SQL builder
Method Detail

sqlGeometryColumn

public void sqlGeometryColumn(java.lang.StringBuffer sql,
                              AttributeType geomAttribute)
Generates the select column specification for a DB2 geometry column.

Overrides sqlGeometryColumn in DefaultSQLBuilder

Overrides:
sqlGeometryColumn in class DefaultSQLBuilder
Parameters:
sql - A StringBuffer that the column specification can be appended to.
geomAttribute - An AttributeType for a geometry attribute

sqlFrom

public void sqlFrom(java.lang.StringBuffer sql,
                    java.lang.String typeName)
Construct the FROM clause for a feature type. Prefixes the typeName with the table schema provided when this class was constructed.

This method could be promoted to DefaultSQLBuilder if the table schema was propagated up.

Overrides sqlFrom in DefaultSQLBuilder

Specified by:
sqlFrom in interface SQLBuilder
Overrides:
sqlFrom in class DefaultSQLBuilder
Parameters:
sql - StringBuffer to be appended to
typeName - Name of the type (table)

buildSQLBoundsQuery

public java.lang.String buildSQLBoundsQuery(java.lang.String typeName,
                                            AttributeType geomAttr,
                                            Filter filter)
                                     throws SQLEncoderException
Builds the SQL query to get the bounds (min-max coordinate values) of a geometry column for a given filter.

Parameters:
typeName - the feature type name.
geomAttr - the geometry attribute.
filter - the filter expression.
Returns:
the string to perform the SQL query.
Throws:
SQLEncoderException


Copyright © GeoTools. All Rights Reserved.