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 StringGEOMETRY_BASE_TYPEH2 base type for geometry columnResultSetMetaData.getColumnTypeName(int)
-
Constructor Summary
Constructors Constructor Description H2GISFunctions()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringgetAlias(org.h2gis.api.Function function)Return the alias name of the functionstatic org.h2gis.api.Function[]getBuiltInsFunctions()static voidload(Connection connection)Register GEOMETRY type and register H2GIS functionsstatic voidload(Connection connection, String BundleSymbolicName, String BundleVersion)Register GEOMETRY type and register H2GIS functionsstatic voidregisterFunction(Statement st, org.h2gis.api.Function function, String packagePrepend)Register a H2GIS java code functionstatic voidregisterFunction(Statement st, org.h2gis.api.Function function, String packagePrepend, boolean dropAlias)Register a H2GIS java code functionstatic voidregisterSpatialTables(Connection connection)Register view in order to create GEOMETRY_COLUMNS standard table.static voidunRegisterFunction(Statement st, org.h2gis.api.Function function)Remove the specified function from the provided DataBase connectionstatic voidunRegisterH2GISFunctions(Connection connection)Unregister spatial type and H2GIS functions from the current connection.
-
-
-
Field Detail
-
GEOMETRY_BASE_TYPE
public static final String GEOMETRY_BASE_TYPE
H2 base type for geometry columnResultSetMetaData.getColumnTypeName(int)- See Also:
- Constant Field Values
-
-
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 connectionBundleSymbolicName- OSGi Bundle symbolic nameBundleVersion- 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 Statementfunction- Function instancepackagePrepend- 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 Statementfunction- Function instancepackagePrepend- 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 statementfunction- 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
-
-