Package org.h2gis.functions.factory

# Class H2GISFunctions

java.lang.Object
org.h2gis.functions.factory.H2GISFunctions

public class H2GISFunctions extends Object
Add H2GIS features to an H2 database Execute the following sql to init spatial features :

     CREATE ALIAS IF NOT EXISTS H2GIS_FUNCTIONS FOR
          "H2GISFunctions.load";
     CALL H2GIS_FUNCTIONS();

Author:
  Erwan Bocher, Nicolas Fortin

## Field Summary

Fields
Modifier and Type
Field
Description
`static final String`
`GEOMETRY_BASE_TYPE`
H2 base type for geometry column `ResultSetMetaData.getColumnTypeName(int)`

## Constructor Summary

Constructors
Constructor
Description
`H2GISFunctions()`

## Method Summary

Modifier and Type
Method
Description
`static String`
`getAlias(org.h2gis.api.Function function)`
Return the alias name of the function
`static org.h2gis.api.Function[]`
`getBuiltInsFunctions()`
`static void`
`load(Connection connection)`
Register GEOMETRY type and register H2GIS functions
`static void`
`load(Connection connection, String BundleSymbolicName, String BundleVersion)`
Register GEOMETRY type and register H2GIS functions
`static void`
`registerFunction(Statement st, org.h2gis.api.Function function, String packagePrepend)`
Register a H2GIS java code function
`static void`
`registerFunction(Statement st, org.h2gis.api.Function function, String packagePrepend, boolean dropAlias)`
Register a H2GIS java code function
`static void`
`registerSpatialTables(Connection connection)`
Register view in order to create GEOMETRY_COLUMNS standard table.
`static void`
`unRegisterFunction(Statement st, org.h2gis.api.Function function)`
Remove the specified function from the provided DataBase connection
`static void`
`unRegisterH2GISFunctions(Connection connection)`
Unregister spatial type and H2GIS functions from the current connection.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### GEOMETRY_BASE_TYPE

public static final String GEOMETRY_BASE_TYPE
H2 base type for geometry column `ResultSetMetaData.getColumnTypeName(int)`

See Also:
  - Constant Field Values

## Constructor Details

### H2GISFunctions

public H2GISFunctions()

## Method Details

### getBuiltInsFunctions

public static org.h2gis.api.Function[] getBuiltInsFunctions()

Returns:
  instance of all built-ins functions

### load

public static void load(Connection connection, String BundleSymbolicName, String BundleVersion) throws SQLException
Register GEOMETRY type and register H2GIS functions

Parameters:
  `connection` - Active H2 connection
  `BundleSymbolicName` - OSGi Bundle symbolic name
  `BundleVersion` - OSGi Bundle version
Throws:
  `SQLException`

### load

public static void load(Connection connection) throws SQLException
Register GEOMETRY type and register H2GIS functions

Parameters:
  `connection` - Active H2 connection
Throws:
  `SQLException`

### registerSpatialTables

public static void registerSpatialTables(Connection connection) throws SQLException
Register view in order to create GEOMETRY_COLUMNS standard table.

Parameters:
  `connection` - Open connection
Throws:
  `SQLException`

### registerFunction

public static void registerFunction(Statement st, org.h2gis.api.Function function, String packagePrepend) throws SQLException
Register a H2GIS java code function

Parameters:
  `st` - SQL Statement
  `function` - Function instance
  `packagePrepend` - For OSGi environment only, use Bundle-SymbolicName:Bundle-Version:
Throws:
  `SQLException`

### registerFunction

public static void registerFunction(Statement st, org.h2gis.api.Function function, String packagePrepend, boolean dropAlias) throws SQLException
Register a H2GIS java code function

Parameters:
  `st` - SQL Statement
  `function` - Function instance
  `packagePrepend` - For OSGi environment only, use Bundle-SymbolicName:Bundle-Version:
  `dropAlias` - Drop alias if exists before define it.
Throws:
  `SQLException`

### getAlias

public static String getAlias(org.h2gis.api.Function function)
Return the alias name of the function

Parameters:
  `function` - Function instance
Returns:
  the function ALIAS, name of the function in SQL engine

### unRegisterFunction

public static void unRegisterFunction(Statement st, org.h2gis.api.Function function) throws SQLException
Remove the specified function from the provided DataBase connection

Parameters:
  `st` - Active statement
  `function` - function to remove
Throws:
  `SQLException`

### unRegisterH2GISFunctions

public static void unRegisterH2GISFunctions(Connection connection) throws SQLException
Unregister spatial type and H2GIS functions from the current connection.

Parameters:
  `connection` - Active H2 connection with DROP ALIAS rights
Throws:
  `SQLException`