Class 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
    • Constructor Detail

      • H2GISFunctions

        public H2GISFunctions()
    • Method Detail

      • 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 - Database issue
      • load

        public static void load​(Connection connection)
                         throws SQLException
        Register GEOMETRY type and register H2GIS functions
        Parameters:
        connection - Active H2 connection
        Throws:
        SQLException - Database issue
      • 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 - Database issue
      • 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 - Database issue
      • 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