Ejemplo n.º 1
0
 /**
  * Release geometry type
  *
  * @param connection Active h2 connection with DROP DOMAIN and DROP ALIAS rights
  */
 public static void unRegisterGeometryType(Connection connection) throws SQLException {
   Statement st = connection.createStatement();
   DomainInfo[] domainInfos = getBuiltInsType();
   for (DomainInfo domainInfo : domainInfos) {
     st.execute("DROP DOMAIN IF EXISTS " + domainInfo.getDomainName());
   }
 }
Ejemplo n.º 2
0
 /**
  * Register geometry type in an OSGi environment
  *
  * @param connection Active H2 connection
  * @throws SQLException
  */
 public static void registerGeometryType(Connection connection) throws SQLException {
   Statement st = connection.createStatement();
   for (DomainInfo domainInfo : getBuiltInsType()) {
     // Check for byte array first, to not throw an enigmatic error CastException
     st.execute(
         "CREATE DOMAIN IF NOT EXISTS "
             + domainInfo.getDomainName()
             + " AS "
             + GEOMETRY_BASE_TYPE
             + " CHECK (ST_GeometryTypeCode(VALUE) = "
             + domainInfo.getGeometryTypeCode()
             + ");");
   }
 }