h2/src/test/org/h2/test/db/TestSpatial.java
/**
     * Test java alias with Geometry type.
     */
Test java alias with Geometry type.
Test java alias with Geometry type .
private void testJavaAlias() throws SQLException {
        deleteDb("spatial");
        Connection conn = getConnection(url);
        try {
            Statement stat = conn.createStatement();
            stat.execute("CREATE ALIAS T_GEOM_FROM_TEXT FOR \"" + TestSpatial.class.getName() + ".geomFromText\"");
            stat.execute("create table test(id int primary key auto_increment, the_geom geometry)");
            stat.execute("insert into test(the_geom) values(" +
                    "T_GEOM_FROM_TEXT('POLYGON ((62 48, 84 48, 84 42, 56 34, 62 48))',1488))");
            stat.execute("DROP ALIAS T_GEOM_FROM_TEXT");
            ResultSet rs = stat.executeQuery("select the_geom from test");
            assertTrue(rs.next());
            assertEquals("POLYGON ((62 48, 84 48, 84 42, 56 34, 62 48))", rs.getObject(1).toString());
        } finally {
            conn.close();
        }
        deleteDb("spatial");
    }
private void testJavaAlias ( ) throws SQLException { deleteDb ( "spatial" ) ; Connection conn = getConnection ( url ) ; try { Statement stat = conn . createStatement ( ) ; stat . execute ( "CREATE ALIAS T_GEOM_FROM_TEXT FOR \"" + TestSpatial . class . getName ( ) + ".geomFromText\"" ) ; stat . execute ( "create table test(id int primary key auto_increment, the_geom geometry)" ) ; stat . execute ( "insert into test(the_geom) values(" + "T_GEOM_FROM_TEXT('POLYGON ((62 48, 84 48, 84 42, 56 34, 62 48))',1488))" ) ; stat . execute ( "DROP ALIAS T_GEOM_FROM_TEXT" ) ; ResultSet rs = stat . executeQuery ( "select the_geom from test" ) ; assertTrue ( rs . next ( ) ) ; assertEquals ( "POLYGON ((62 48, 84 48, 84 42, 56 34, 62 48))" , rs . getObject ( 1 ) . toString ( ) ) ; } finally { conn . close ( ) ; } deleteDb ( "spatial" ) ; }
Test java alias with Geometry type.
Test java alias with Geometry type .