org.geotools.jdbc
Class PreparedStatementSQLDialect

java.lang.Object
  extended by org.geotools.jdbc.SQLDialect
      extended by org.geotools.jdbc.PreparedStatementSQLDialect
Direct Known Subclasses:
DB2SQLDialectPrepared, H2DialectPrepared, MySQLDialectPrepared, OracleDialect, PostGISPSDialect

public abstract class PreparedStatementSQLDialect
extends SQLDialect

SQL dialect which uses prepared statements for database interaction.

Author:
Justin Deoliveira, OpenGEO

Field Summary
 
Fields inherited from class org.geotools.jdbc.SQLDialect
BASE_DBMS_CAPABILITIES, dataStore, LOGGER
 
Constructor Summary
protected PreparedStatementSQLDialect(JDBCDataStore dataStore)
           
 
Method Summary
 PreparedFilterToSQL createPreparedFilterToSQL()
           
 void prepareFunctionArgument(java.lang.Class clazz, java.lang.StringBuffer sql)
          Prepares a function argument for a prepared statement.
 void prepareGeometryValue(com.vividsolutions.jts.geom.Geometry g, int srid, java.lang.Class binding, java.lang.StringBuffer sql)
          Prepares the geometry value for a prepared statement.
abstract  void setGeometryValue(com.vividsolutions.jts.geom.Geometry g, int srid, java.lang.Class binding, java.sql.PreparedStatement ps, int column)
          Sets the geometry value into the prepared statement.
 void setValue(java.lang.Object value, java.lang.Class binding, java.sql.PreparedStatement ps, int column, java.sql.Connection cx)
          Sets a value in a prepared statement, for "basic types" (non-geometry).
 
Methods inherited from class org.geotools.jdbc.SQLDialect
addSupportedHints, applyLimitOffset, createCRS, decodeGeometryEnvelope, decodeGeometryValue, decodeGeometryValue, encodeColumnAlias, encodeColumnName, encodeColumnType, encodeGeometryColumn, encodeGeometryColumnGeneralized, encodeGeometryColumnSimplified, encodeGeometryEnvelope, encodePostColumnCreateTable, encodePostCreateTable, encodePrimaryKey, encodeSchemaName, encodeTableAlias, encodeTableName, getGeometrySRID, getGeometryTypeName, getLastAutoGeneratedValue, getMapping, getNameEscape, getNextAutoGeneratedValue, getNextSequenceValue, getSequenceForColumn, includeTable, initializeConnection, isLimitOffsetSupported, lookupGeneratedValuesPostInsert, ne, postCreateAttribute, postCreateFeatureType, postCreateTable, registerAggregateFunctions, registerClassToSqlMappings, registerSqlTypeNameToClassMappings, registerSqlTypeToClassMappings, registerSqlTypeToSqlTypeNameOverrides
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PreparedStatementSQLDialect

protected PreparedStatementSQLDialect(JDBCDataStore dataStore)
Method Detail

prepareGeometryValue

public void prepareGeometryValue(com.vividsolutions.jts.geom.Geometry g,
                                 int srid,
                                 java.lang.Class binding,
                                 java.lang.StringBuffer sql)
Prepares the geometry value for a prepared statement.

This method should be overridden if the implementation needs to wrap the geometry placeholder in the function. The default implementation just appends the default placeholder: '?'.

Parameters:
g - The geometry value.
srid - The spatial reference system of the geometry.
binding - The class of the geometry.
sql - The prepared sql statement buffer.

prepareFunctionArgument

public void prepareFunctionArgument(java.lang.Class clazz,
                                    java.lang.StringBuffer sql)
Prepares a function argument for a prepared statement.

Parameters:
clazz - The mapped class of the argument.
sql - The prepared sql statement buffer

setGeometryValue

public abstract void setGeometryValue(com.vividsolutions.jts.geom.Geometry g,
                                      int srid,
                                      java.lang.Class binding,
                                      java.sql.PreparedStatement ps,
                                      int column)
                               throws java.sql.SQLException
Sets the geometry value into the prepared statement.

Parameters:
g - The geometry
srid - the geometry native srid (should be forced into the encoded geometry)
binding - the geometry type
ps - the prepared statement
column - the column index where the geometry is to be set
Throws:
java.sql.SQLException

setValue

public void setValue(java.lang.Object value,
                     java.lang.Class binding,
                     java.sql.PreparedStatement ps,
                     int column,
                     java.sql.Connection cx)
              throws java.sql.SQLException
Sets a value in a prepared statement, for "basic types" (non-geometry).

Subclasses should override this method if they need to do something custom or they wish to support non-standard types.

Parameters:
value - the value.
binding - The class of the value.
ps - The prepared statement.
column - The column the value maps to.
cx - The database connection.
Throws:
java.sql.SQLException

createPreparedFilterToSQL

public PreparedFilterToSQL createPreparedFilterToSQL()


Copyright © 1996-2010 Geotools. All Rights Reserved.