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.InsertStatement;
7   
8   /**
9    * The <code>SpatialInsertGeneratorH2</code> generates the SQL for <code>INSERT</code>ing geometries
10   * into Apache Derby and H2.
11   */
12  public class SpatialInsertGeneratorGeoDB extends AbstractSpatialInsertGenerator {
13     @Override
14     public boolean supports(final InsertStatement 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  }