org.h2gis.h2spatial.internal.function.spatial.properties
Class ColumnSRID

java.lang.Object
  extended by org.h2gis.h2spatialapi.AbstractFunction
      extended by org.h2gis.h2spatial.internal.function.spatial.properties.ColumnSRID
All Implemented Interfaces:
Function, ScalarFunction

public class ColumnSRID
extends AbstractFunction
implements ScalarFunction

Get the column SRID from constraints and data.

Author:
Nicolas Fortin

Field Summary
 
Fields inherited from interface org.h2gis.h2spatialapi.ScalarFunction
PROP_DETERMINISTIC, PROP_NOBUFFER
 
Fields inherited from interface org.h2gis.h2spatialapi.Function
PROP_NAME, PROP_REMARKS
 
Constructor Summary
ColumnSRID()
           
 
Method Summary
static String fetchConstraint(Connection connection, String catalogName, String schemaName, String tableName)
          Read table constraints from database metadata.
 String getJavaStaticMethod()
           
static int getSRID(Connection connection, String catalogName, String schemaName, String tableName, String columnName, String constraint)
           
static int getSRIDFromConstraint(String constraint, String columnName)
           
 
Methods inherited from class org.h2gis.h2spatialapi.AbstractFunction
addProperty, getProperty, removeProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.h2gis.h2spatialapi.Function
getProperty
 

Constructor Detail

ColumnSRID

public ColumnSRID()
Method Detail

getJavaStaticMethod

public String getJavaStaticMethod()
Specified by:
getJavaStaticMethod in interface ScalarFunction

getSRIDFromConstraint

public static int getSRIDFromConstraint(String constraint,
                                        String columnName)
Parameters:
constraint - Constraint expression ex:"ST_SRID(the_geom) = 27572"
Returns:
The SRID or 0 if no constraint are found or constraint on other column

fetchConstraint

public static String fetchConstraint(Connection connection,
                                     String catalogName,
                                     String schemaName,
                                     String tableName)
                              throws SQLException
Read table constraints from database metadata.

Parameters:
connection - Active connection
catalogName - Catalog name or empty string
schemaName - Schema name or empty string
tableName - table name
Returns:
Found table constraints
Throws:
SQLException

getSRID

public static int getSRID(Connection connection,
                          String catalogName,
                          String schemaName,
                          String tableName,
                          String columnName,
                          String constraint)
Parameters:
connection - Active connection
tableName - Target table name
columnName - Spatial field name
constraint - Column constraint
Returns:
The column SRID from constraints and data.


Copyright © 2015 IRSTV CNRS-FR-2488. All Rights Reserved.