org.geotools.data.postgis
Class PostgisSQLBuilder

java.lang.Object
  extended byorg.geotools.data.jdbc.DefaultSQLBuilder
      extended byorg.geotools.data.postgis.PostgisSQLBuilder
All Implemented Interfaces:
SQLBuilder

public class PostgisSQLBuilder
extends DefaultSQLBuilder

Builds sql for postgis.

Author:
Chris Holmes

Field Summary
protected  boolean byteaEnabled
          If true, ByteA function is used to transfer WKB data
protected  JDBCDataStoreConfig config
          the datastore
protected  boolean WKBEnabled
          If true, WKB format is used instead of WKT
 
Fields inherited from class org.geotools.data.jdbc.DefaultSQLBuilder
encoder
 
Constructor Summary
PostgisSQLBuilder(int srid, JDBCDataStoreConfig config)
           
PostgisSQLBuilder(SQLEncoder encoder, JDBCDataStoreConfig config)
          Constructor with encoder.
 
Method Summary
 java.lang.String encodeColumnName(java.lang.String columnName)
           
 java.lang.String encodeTableName(java.lang.String tableName)
           
 boolean isByteaEnabled()
          Enables the use of the bytea function to transfer faster WKB geometries
 boolean isWKBEnabled()
          Returns true if the WKB format is used to transfer geometries, false otherwise
 void setByteaEnabled(boolean byteaEnable)
          Enables/disables the use of the bytea function
 void setWKBEnabled(boolean enabled)
          If turned on, WKB will be used to transfer geometry data instead of WKT
 void sqlColumns(java.lang.StringBuffer sql, FIDMapper mapper, AttributeType[] attributes)
          Produces the select information required.
 void sqlFrom(java.lang.StringBuffer sql, java.lang.String typeName)
          Consutrcts FROM clause for featureType sql: FROM typeName
 void sqlWhere(java.lang.StringBuffer sql, Filter preFilter)
          Constructs WHERE clause, if needed, for FILTER.
 
Methods inherited from class org.geotools.data.jdbc.DefaultSQLBuilder
buildSQLQuery, getPostQueryFilter, getPreQueryFilter, sqlGeometryColumn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WKBEnabled

protected boolean WKBEnabled
If true, WKB format is used instead of WKT


byteaEnabled

protected boolean byteaEnabled
If true, ByteA function is used to transfer WKB data


config

protected JDBCDataStoreConfig config
the datastore

Constructor Detail

PostgisSQLBuilder

public PostgisSQLBuilder(int srid,
                         JDBCDataStoreConfig config)

PostgisSQLBuilder

public PostgisSQLBuilder(SQLEncoder encoder,
                         JDBCDataStoreConfig config)
Constructor with encoder.

Parameters:
encoder -
Method Detail

sqlColumns

public void sqlColumns(java.lang.StringBuffer sql,
                       FIDMapper mapper,
                       AttributeType[] attributes)
Produces the select information required.

The featureType, if known, is always requested.

sql: featureID (,attributeColumn)

We may need to provide AttributeReaders with a hook so they can request a wrapper function.

Specified by:
sqlColumns in interface SQLBuilder
Overrides:
sqlColumns in class DefaultSQLBuilder
Parameters:
sql -
mapper -
attributes -
See Also:
postgisDataStore.SQLBuilder#sqlColumns(java.lang.StringBuffer, postgisDataStore.FIDMapper.FIDMapper, org.geotools.feature.AttributeType[])

sqlFrom

public void sqlFrom(java.lang.StringBuffer sql,
                    java.lang.String typeName)
Consutrcts FROM clause for featureType

sql: FROM typeName

Specified by:
sqlFrom in interface SQLBuilder
Overrides:
sqlFrom in class DefaultSQLBuilder
Parameters:
sql -
typeName -

sqlWhere

public void sqlWhere(java.lang.StringBuffer sql,
                     Filter preFilter)
              throws SQLEncoderException
Constructs WHERE clause, if needed, for FILTER.

sql: WHERE filter encoding

Specified by:
sqlWhere in interface SQLBuilder
Overrides:
sqlWhere in class DefaultSQLBuilder
Parameters:
sql - DOCUMENT ME!
preFilter - DOCUMENT ME!
Throws:
SQLEncoderException - DOCUMENT ME!

isWKBEnabled

public boolean isWKBEnabled()
Returns true if the WKB format is used to transfer geometries, false otherwise

Returns:

setWKBEnabled

public void setWKBEnabled(boolean enabled)
If turned on, WKB will be used to transfer geometry data instead of WKT

Parameters:
enabled -

isByteaEnabled

public boolean isByteaEnabled()
Enables the use of the bytea function to transfer faster WKB geometries

Returns:

setByteaEnabled

public void setByteaEnabled(boolean byteaEnable)
Enables/disables the use of the bytea function

Parameters:
byteaEnable -

encodeTableName

public java.lang.String encodeTableName(java.lang.String tableName)

encodeColumnName

public java.lang.String encodeColumnName(java.lang.String columnName)


Copyright © GeoTools. All Rights Reserved.