org.h2gis.functions.spatial.properties

## Class ColumnSRID

- java.lang.Object
- - org.h2gis.api.AbstractFunction
  - - org.h2gis.functions.spatial.properties.ColumnSRID

All Implemented Interfaces:
  org.h2gis.api.Function, org.h2gis.api.ScalarFunction

    public class ColumnSRID
    extends org.h2gis.api.AbstractFunction
    implements org.h2gis.api.ScalarFunction

Get the column SRID from constraints and data.

Author:
  Nicolas Fortin

### Field Summary

### Fields inherited from interface org.h2gis.api.ScalarFunction

`PROP_DETERMINISTIC, PROP_NOBUFFER`

### Fields inherited from interface org.h2gis.api.Function

`PROP_NAME, PROP_REMARKS`

### Constructor Summary

Constructors
Constructor and Description
`ColumnSRID()`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`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.api.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.api.Function

`getProperty`

### Constructor Detail

#### ColumnSRID

    public ColumnSRID()

### Method Detail

#### getJavaStaticMethod

    public String getJavaStaticMethod()

Specified by:
  `getJavaStaticMethod` in interface `org.h2gis.api.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.