Class BasicSQLDialect
- Object
-
- SQLDialect
-
- BasicSQLDialect
-
- Direct Known Subclasses:
DB2SQLDialectBasic
,H2DialectBasic
,H2GISDialect
,InformixDialect
,MySQLDialectBasic
,PostGISDialect
,SQLServerDialect
public abstract class BasicSQLDialect extends SQLDialect
-
-
Field Summary
-
Fields inherited from class SQLDialect
BASE_DBMS_CAPABILITIES, dataStore, forceLongitudeFirst, LOGGER, UNWRAPPER_NOT_FOUND, uwMap
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
BasicSQLDialect(JDBCDataStore dataStore)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description FilterToSQL
createFilterToSQL()
Creates the filter encoder to be used by the datastore when encoding query predicates.abstract void
encodeGeometryValue(Geometry value, int dimension, int srid, StringBuffer sql)
Encodes a geometry value in an sql statement.void
encodeValue(Object value, Class type, StringBuffer sql)
Encodes a value in an sql statement.void
onDelete(Statement delete, Connection cx, SimpleFeatureType featureType)
Callback invoked before a DELETE statement is executed against the database.void
onInsert(Statement insert, Connection cx, SimpleFeatureType featureType)
Callback invoked before an INSERT statement is executed against the database.void
onSelect(Statement select, Connection cx, SimpleFeatureType featureType)
Callback invoked before a SELECT statement is executed against the database.void
onUpdate(Statement update, Connection cx, SimpleFeatureType featureType)
Callback invoked before an UPDATE statement is executed against the database.-
Methods inherited from class SQLDialect
addSupportedHints, applyHintsOnVirtualTables, applyLimitOffset, canGroupOnGeometry, canSimplifyPoints, convertValue, createCRS, createIndex, decodeGeometryEnvelope, decodeGeometryValue, decodeGeometryValue, dropIndex, encodeColumnAlias, encodeColumnName, encodeColumnType, encodeCreateTable, encodeGeometryColumn, encodeGeometryColumnGeneralized, encodeGeometryColumnSimplified, encodeGeometryEnvelope, encodeJoin, encodeNextSequenceValue, encodePostColumnCreateTable, encodePostCreateTable, encodePostSelect, encodePrimaryKey, encodeSchemaName, encodeTableAlias, encodeTableName, escapeName, getAggregateConverter, getDefaultVarcharSize, getDesiredTablesType, getGeometryDimension, getGeometrySRID, getGeometryTypeName, getIndexes, getLastAutoGeneratedValue, getLastAutoGeneratedValue, getMapping, getMapping, getNameEscape, getNextAutoGeneratedValue, getNextSequenceValue, getOptimizedBounds, getPkColumnValue, getPrimaryKey, getRestrictions, getResultTypes, getSequenceForColumn, getSQLType, handleSelectHints, handleUserDefinedType, includeTable, initializeConnection, isAggregatedSortSupported, isArray, isAutoCommitQuery, isGroupBySupported, isLimitOffsetSupported, lookupGeneratedValuesPostInsert, ne, postCreateAttribute, postCreateFeatureType, postCreateTable, postDropTable, preDropTable, registerAggregateFunctions, registerClassToSqlMappings, registerSqlTypeNameToClassMappings, registerSqlTypeToClassMappings, registerSqlTypeToSqlTypeNameOverrides, splitFilter, supportsSchemaForIndex, unwrapConnection
-
-
-
-
Constructor Detail
-
BasicSQLDialect
protected BasicSQLDialect(JDBCDataStore dataStore)
-
-
Method Detail
-
encodeValue
public void encodeValue(Object value, Class type, StringBuffer sql)
Encodes a value in an sql statement.Subclasses may wish to override or extend this method to handle specific types. This default implementation does the following:
- The value is encoded via its
Object.toString()
representation. - If type is a character type (extends
CharSequence
), it is wrapped in single quotes (').
- The value is encoded via its
-
encodeGeometryValue
public abstract void encodeGeometryValue(Geometry value, int dimension, int srid, StringBuffer sql) throws IOException
Encodes a geometry value in an sql statement.An implementations should serialize value into some exchange format which will then be transported to the underlying database. For example, consider an implementation which converts a geometry into its well known text representation:
sql.append( "GeomFromText('" ); sql.append( new WKTWriter().write( value ) ); sql.append( ")" );
The srid parameter is the spatial reference system identifier of the geometry, or 0 if not known.
Attention should be paid to emtpy geometries (
g.isEmtpy() == true
) as they cannot be encoded in WKB and several databases fail to handle them property. Common treatment is to equate them to NULL- Throws:
IOException
-
createFilterToSQL
public FilterToSQL createFilterToSQL()
Creates the filter encoder to be used by the datastore when encoding query predicates.Sublcasses can override this method to return a subclass of
FilterToSQL
if need be.
-
onSelect
public void onSelect(Statement select, Connection cx, SimpleFeatureType featureType) throws SQLException
Callback invoked before a SELECT statement is executed against the database.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.
- Parameters:
select
- The select statement being executedcx
- The database connectionfeatureType
- The feature type the select is executing against.- Throws:
SQLException
-
onDelete
public void onDelete(Statement delete, Connection cx, SimpleFeatureType featureType) throws SQLException
Callback invoked before a DELETE statement is executed against the database.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.
- Parameters:
delete
- The delete statement being executedcx
- The database connectionfeatureType
- The feature type the delete is executing against.- Throws:
SQLException
-
onInsert
public void onInsert(Statement insert, Connection cx, SimpleFeatureType featureType) throws SQLException
Callback invoked before an INSERT statement is executed against the database.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.
- Parameters:
insert
- The delete statement being executedcx
- The database connectionfeatureType
- The feature type the insert is executing against.- Throws:
SQLException
-
onUpdate
public void onUpdate(Statement update, Connection cx, SimpleFeatureType featureType) throws SQLException
Callback invoked before an UPDATE statement is executed against the database.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.
- Parameters:
update
- The delete statement being executedcx
- The database connectionfeatureType
- The feature type the update is executing against.- Throws:
SQLException
-
-