org.deegree.sqldialect.postgis
Class PostGISDialect

java.lang.Object
  extended by org.deegree.sqldialect.postgis.PostGISDialect
All Implemented Interfaces:
SQLDialect

public class PostGISDialect
extends Object
implements SQLDialect

SQLDialect for PostgreSQL / PostGIS databases.

Version:
$Revision: 31186 $, $Date: 2011-07-01 18:01:58 +0200 (Fr, 01. Jul 2011) $
Author:
Andreas Schmitz, Markus Schneider, last edited by: $Author: mschneider $

Constructor Summary
PostGISDialect(boolean useLegacyPredicates)
           
 
Method Summary
 String cast(String expr, String type)
           
 void createAutoColumn(StringBuffer currentStmt, List<StringBuffer> additionalSmts, String column, String table)
           
 void createDB(Connection adminConn, String dbName)
          Creates a new (spatially-enabled) database using the specified administrator connection.
 void dropDB(Connection adminConn, String dbName)
          Drops the specified database.
 String geometryMetadata(QTableName qTable, String column, boolean isGeographical)
           
 String getBBoxAggregateSnippet(String column)
          Returns an SQL snippet for SELECTing the aggregate bounding box of the given column.
 Envelope getBBoxAggregateValue(ResultSet rs, int colIdx, ICRS crs)
          Converts the value that has been SELECTed via SQLDialect.getBBoxAggregateSnippet(String) into an Envelope.
 ConnectionManager.Type getDBType()
          Returns the ConnectionManager.Type of JDBC connection that this dialect can handle.
 String getDefaultSchema()
           
 GeometryParticleConverter getGeometryConverter(String column, ICRS crs, String srid, boolean is2D)
           
 int getMaxColumnNameLength()
          Returns the maximum number of characters allowed for column names.
 int getMaxTableNameLength()
          Returns the maximum number of characters allowed for table names.
 PrimitiveParticleConverter getPrimitiveConverter(String column, PrimitiveType pt)
           
 ResultSet getTableColumnMetadata(DatabaseMetaData md, QTableName qTable)
           
 String getUndefinedSrid()
          Returns the SRID code for undefined.
 AbstractWhereBuilder getWhereBuilder(PropertyNameMapper mapper, OperatorFilter filter, SortProperty[] sortCrit, boolean allowPartialMappings)
          Returns an AbstractWhereBuilder instance for the given parameters.
 boolean requiresTransactionForCursorMode()
          See http://postgresql.1045698.n5.nabble.com/BUG-3383-Postmaster-Service-Problem-td2123537.html.
 String stringIndex(String pattern, String string)
           
 String stringPlus()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PostGISDialect

public PostGISDialect(boolean useLegacyPredicates)
Method Detail

getDBType

public ConnectionManager.Type getDBType()
Description copied from interface: SQLDialect
Returns the ConnectionManager.Type of JDBC connection that this dialect can handle.

Specified by:
getDBType in interface SQLDialect
Returns:
the db type, never null

getMaxColumnNameLength

public int getMaxColumnNameLength()
Description copied from interface: SQLDialect
Returns the maximum number of characters allowed for column names.

Specified by:
getMaxColumnNameLength in interface SQLDialect
Returns:
maximum number of characters

getMaxTableNameLength

public int getMaxTableNameLength()
Description copied from interface: SQLDialect
Returns the maximum number of characters allowed for table names.

Specified by:
getMaxTableNameLength in interface SQLDialect
Returns:
maximum number of characters

getDefaultSchema

public String getDefaultSchema()
Specified by:
getDefaultSchema in interface SQLDialect
Returns:
the default table schema to use for the database (eg. for requesting table metadata)

stringPlus

public String stringPlus()
Specified by:
stringPlus in interface SQLDialect
Returns:
the string concatenation operator

stringIndex

public String stringIndex(String pattern,
                          String string)
Specified by:
stringIndex in interface SQLDialect
Returns:
an expression that yields the string index

cast

public String cast(String expr,
                   String type)
Specified by:
cast in interface SQLDialect
Returns:
expr cast to type

geometryMetadata

public String geometryMetadata(QTableName qTable,
                               String column,
                               boolean isGeographical)
Specified by:
geometryMetadata in interface SQLDialect
Returns:
statement to determine the coordinate dimension, the srid and the geometry type of a given column (in this order)

getWhereBuilder

public AbstractWhereBuilder getWhereBuilder(PropertyNameMapper mapper,
                                            OperatorFilter filter,
                                            SortProperty[] sortCrit,
                                            boolean allowPartialMappings)
                                     throws UnmappableException,
                                            FilterEvaluationException
Description copied from interface: SQLDialect
Returns an AbstractWhereBuilder instance for the given parameters.

Specified by:
getWhereBuilder in interface SQLDialect
Parameters:
mapper - provides property name mappings, must not be null
filter - filter to use for generating the WHERE clause, can be null
sortCrit - criteria to use generating the ORDER BY clause, can be null
allowPartialMappings - if false, any unmappable expression will cause an UnmappableException to be thrown
Returns:
where builder, never null
Throws:
UnmappableException - if allowPartialMappings is false and an expression could not be mapped to the db
FilterEvaluationException

getUndefinedSrid

public String getUndefinedSrid()
Description copied from interface: SQLDialect
Returns the SRID code for undefined.

Specified by:
getUndefinedSrid in interface SQLDialect
Returns:
SRID code, can be null/code>

getBBoxAggregateSnippet

public String getBBoxAggregateSnippet(String column)
Description copied from interface: SQLDialect
Returns an SQL snippet for SELECTing the aggregate bounding box of the given column.

Specified by:
getBBoxAggregateSnippet in interface SQLDialect
Parameters:
column - name of the column that stores the bounding box, never null
Returns:
SQL snippet, never null

getBBoxAggregateValue

public Envelope getBBoxAggregateValue(ResultSet rs,
                                      int colIdx,
                                      ICRS crs)
                               throws SQLException
Description copied from interface: SQLDialect
Converts the value that has been SELECTed via SQLDialect.getBBoxAggregateSnippet(String) into an Envelope.

Specified by:
getBBoxAggregateValue in interface SQLDialect
Returns:
aggregate envelope, can be null
Throws:
SQLException

getGeometryConverter

public GeometryParticleConverter getGeometryConverter(String column,
                                                      ICRS crs,
                                                      String srid,
                                                      boolean is2D)
Specified by:
getGeometryConverter in interface SQLDialect

getPrimitiveConverter

public PrimitiveParticleConverter getPrimitiveConverter(String column,
                                                        PrimitiveType pt)
Specified by:
getPrimitiveConverter in interface SQLDialect

createDB

public void createDB(Connection adminConn,
                     String dbName)
              throws SQLException
Description copied from interface: SQLDialect
Creates a new (spatially-enabled) database using the specified administrator connection.

Specified by:
createDB in interface SQLDialect
Parameters:
adminConn - administrator JDBC connection, must not be null
dbName - name of the database to be created, must not be null
Throws:
SQLException

dropDB

public void dropDB(Connection adminConn,
                   String dbName)
            throws SQLException
Description copied from interface: SQLDialect
Drops the specified database.

Specified by:
dropDB in interface SQLDialect
Parameters:
adminConn - administrator JDBC connection, must not be null
dbName - name of the database to be created, must not be null
Throws:
SQLException

createAutoColumn

public void createAutoColumn(StringBuffer currentStmt,
                             List<StringBuffer> additionalSmts,
                             String column,
                             String table)
Specified by:
createAutoColumn in interface SQLDialect

getTableColumnMetadata

public ResultSet getTableColumnMetadata(DatabaseMetaData md,
                                        QTableName qTable)
                                 throws SQLException
Specified by:
getTableColumnMetadata in interface SQLDialect
Throws:
SQLException

requiresTransactionForCursorMode

public boolean requiresTransactionForCursorMode()
See http://postgresql.1045698.n5.nabble.com/BUG-3383-Postmaster-Service-Problem-td2123537.html.

Specified by:
requiresTransactionForCursorMode in interface SQLDialect
Returns:
true, if a transaction context is required, false otherwise


Copyright © 2011. All Rights Reserved.