View Javadoc

1   package liquibase.ext.spatial.sqlgenerator;
2   
3   import liquibase.database.Database;
4   import liquibase.database.core.DerbyDatabase;
5   import liquibase.database.core.H2Database;
6   import liquibase.statement.core.UpdateStatement;
7   
8   /**
9    * <code>SpatialUpdateGeneratorGeoDB</code> generates the SQL for <code>UPDATING</code>ing
10   * geometries in Apache Derby and H2.
11   */
12  public class SpatialUpdateGeneratorGeoDB extends AbstractSpatialUpdateGenerator {
13     @Override
14     public boolean supports(final UpdateStatement statement, final Database database) {
15        return database instanceof DerbyDatabase || database instanceof H2Database;
16     }
17  
18     /**
19      * Returns the name of the function that converts Well-Known Text to a database-specific
20      * geometry.
21      * 
22      * @return the name of the function that converts WKT to a geometry.
23      */
24     @Override
25     public String getGeomFromWktFunction() {
26        return "ST_GeomFromText";
27     }
28  
29     /**
30      * Always returns <code>true</code> for GeoDB.
31      * 
32      * @see AbstractSpatialInsertGenerator#isSridRequiredInFunction(Database)
33      */
34     @Override
35     public boolean isSridRequiredInFunction(final Database database) {
36        return true;
37     }
38  }