public abstract class PreparedStatementSQLDialect extends SQLDialect
BASE_DBMS_CAPABILITIES, dataStore, LOGGER
Modifier | Constructor and Description |
---|---|
protected |
PreparedStatementSQLDialect(JDBCDataStore dataStore) |
Modifier and Type | Method and Description |
---|---|
protected <T> T |
convert(Object value,
Class<T> binding) |
protected Object |
convertArrayElement(Object value,
Class target)
Converts a given array element to the desired type, throws an exception in case conversion
failed
|
protected Array |
convertToArray(Object value,
String componentTypeName,
Class componentType,
Connection connection)
Converts a given array value into a
Array |
PreparedFilterToSQL |
createPreparedFilterToSQL() |
protected String |
getArrayComponentTypeName(AttributeDescriptor att)
Given the full information about the attribute being transformed, figure out the native SQL
Type Name to use when creating a SQL Array object· The default implementation just scans
JDBCDataStore.getSqlTypeNameToClassMappings() backwards, and will fail in case there
are ambiguities. |
void |
onDelete(PreparedStatement delete,
Connection cx,
SimpleFeatureType featureType)
Callback invoked before a DELETE statement is executed against the database.
|
void |
onInsert(PreparedStatement insert,
Connection cx,
SimpleFeatureType featureType)
Callback invoked before an INSERT statement is executed against the database.
|
void |
onSelect(PreparedStatement select,
Connection cx,
SimpleFeatureType featureType)
Callback invoked before a SELECT statement is executed against the database.
|
void |
onUpdate(PreparedStatement update,
Connection cx,
SimpleFeatureType featureType)
Callback invoked before an UPDATE statement is executed against the database.
|
void |
prepareFunctionArgument(Class clazz,
StringBuffer sql)
Prepares a function argument for a prepared statement.
|
void |
prepareGeometryValue(Class<? extends Geometry> gClass,
int dimension,
int srid,
Class binding,
StringBuffer sql)
Prepares the geometry value for a prepared statement.
|
void |
prepareGeometryValue(Geometry g,
int dimension,
int srid,
Class binding,
StringBuffer sql)
Prepares the geometry value for a prepared statement.
|
void |
setArrayValue(Object value,
AttributeDescriptor att,
PreparedStatement ps,
int i,
Connection cx)
Sets a value in a prepared statement, for the specific case of
Array
This method uses the standard SQL Array handling, subclasses can override to add special
behavior |
abstract void |
setGeometryValue(Geometry g,
int dimension,
int srid,
Class binding,
PreparedStatement ps,
int column)
Sets the geometry value into the prepared statement.
|
void |
setValue(Object value,
Class binding,
PreparedStatement ps,
int column,
Connection cx)
Sets a value in a prepared statement, for "basic types" (non-geometry).
|
addSupportedHints, applyLimitOffset, createCRS, createIndex, decodeGeometryEnvelope, decodeGeometryValue, decodeGeometryValue, dropIndex, encodeAggregateFunction, encodeAggregateFunctionPostfix, encodeAggregateFunctionPrefix, encodeColumnAlias, encodeColumnName, encodeColumnName, encodeColumnType, encodeCreateTable, encodeGeometryColumn, encodeGeometryColumn, encodeGeometryColumn, encodeGeometryColumnGeneralized, encodeGeometryColumnGeneralized, encodeGeometryColumnSimplified, encodeGeometryColumnSimplified, encodeGeometryEnvelope, encodeJoin, encodeNextSequenceValue, encodePostColumnCreateTable, encodePostCreateTable, encodePostSelect, encodePrimaryKey, encodeSchemaName, encodeTableAlias, encodeTableName, getDefaultVarcharSize, getDesiredTablesType, getGeometryDimension, getGeometrySRID, getGeometryTypeName, getIndexes, getLastAutoGeneratedValue, getLastAutoGeneratedValue, getMapping, getNameEscape, getNextAutoGeneratedValue, getNextSequenceValue, getOptimizedBounds, getPkColumnValue, getPrimaryKey, getSequenceForColumn, handleSelectHints, handleUserDefinedType, includeTable, initializeConnection, isAggregatedSortSupported, isAutoCommitQuery, isGroupBySupported, isLimitOffsetSupported, lookupGeneratedValuesPostInsert, ne, postCreateAttribute, postCreateFeatureType, postCreateTable, postDropTable, preDropTable, registerAggregateFunctions, registerClassToSqlMappings, registerFunctions, registerSqlTypeNameToClassMappings, registerSqlTypeToClassMappings, registerSqlTypeToSqlTypeNameOverrides, splitFilter, supportsSchemaForIndex
protected PreparedStatementSQLDialect(JDBCDataStore dataStore)
public void prepareGeometryValue(Class<? extends Geometry> gClass, int dimension, int srid, Class binding, StringBuffer sql)
This method should be overridden if the implementation needs to wrap the geometry placeholder in the function. The default implementationg just appends the default placeholder: '?'.
gClass
- The geometry class.srid
- The spatial reference system of the geometry, or -1 if unknowndimension
- The dimensions (2,3,4) of the coordinates, or -1 if unknownbinding
- The class of the geometry.sql
- The prepared sql statement buffer.public final void prepareGeometryValue(Geometry g, int dimension, int srid, Class binding, StringBuffer sql)
This method should be overridden if the implementation needs to wrap the geometry placeholder in the function. The default implementationg just appends the default placeholder: '?'.
g
- The geometry value.srid
- The spatial reference system of the geometry, or -1 if unknowndimension
- The dimensions (2,3,4) of the coordinates, or -1 if unknownbinding
- The class of the geometry.sql
- The prepared sql statement buffer.public void prepareFunctionArgument(Class clazz, StringBuffer sql)
clazz
- The mapped class of the argument.sql
- The prepared sql statement bufferpublic abstract void setGeometryValue(Geometry g, int dimension, int srid, Class binding, PreparedStatement ps, int column) throws SQLException
g
- The geometrysrid
- the geometry native srid (should be forced into the encoded geometry)binding
- the geometry typeps
- the prepared statementcolumn
- the column index where the geometry is to be setSQLException
public void setValue(Object value, Class binding, PreparedStatement ps, int column, Connection cx) throws SQLException
Subclasses should override this method if they need to do something custom or they wish to support non-standard types.
value
- the value.binding
- The class of the value.ps
- The prepared statement.column
- The column the value maps to.cx
- The database connection.SQLException
public void setArrayValue(Object value, AttributeDescriptor att, PreparedStatement ps, int i, Connection cx) throws SQLException
Array
This method uses the standard SQL Array handling, subclasses can override to add special behavior
value
- the value.att
- The full attribute descriptionps
- The prepared statement.column
- The column the value maps to.cx
- The database connection.SQLException
protected String getArrayComponentTypeName(AttributeDescriptor att) throws SQLException
JDBCDataStore.getSqlTypeNameToClassMappings()
backwards, and will fail in case there
are ambiguities. Subclasses can implement their own logic and eventually use information
contained in the attribute's PropertyDescriptor.getUserData()
, stored at attribute
creation time.att
- SQLException
protected Array convertToArray(Object value, String componentTypeName, Class componentType, Connection connection) throws SQLException
Array
value
- The non null value to be convertedbinding
- The attribute binding (of array typeconnection
- The connection used to create an Array
SQLException
protected Object convertArrayElement(Object value, Class target) throws SQLException
value
- The value to be converted. Must be non null.target
- The target classSQLException
- In case the conversion failed.public PreparedFilterToSQL createPreparedFilterToSQL()
public void onSelect(PreparedStatement select, Connection cx, SimpleFeatureType featureType) throws SQLException
The callback is provided with both the statement being executed and the database connection. Neither should be closed. Any statements created from the connection however in this method should be closed.
select
- The select statement being executedcx
- The database connectionfeatureType
- The feature type the select is executing against.SQLException
public void onDelete(PreparedStatement delete, Connection cx, SimpleFeatureType featureType) throws SQLException
The callback is provided with both the statement being executed and the database connection. Neither should be closed. Any statements created from the connection however in this method should be closed.
delete
- The delete statement being executedcx
- The database connectionfeatureType
- The feature type the delete is executing against.SQLException
public void onInsert(PreparedStatement insert, Connection cx, SimpleFeatureType featureType) throws SQLException
The callback is provided with both the statement being executed and the database connection. Neither should be closed. Any statements created from the connection however in this method should be closed.
insert
- The delete statement being executedcx
- The database connectionfeatureType
- The feature type the insert is executing against.SQLException
public void onUpdate(PreparedStatement update, Connection cx, SimpleFeatureType featureType) throws SQLException
The callback is provided with both the statement being executed and the database connection. Neither should be closed. Any statements created from the connection however in this method should be closed.
update
- The delete statement being executedcx
- The database connectionfeatureType
- The feature type the update is executing against.SQLException
Copyright © 1996–2019 Geotools. All rights reserved.