protected String generateCreateIndexSql ( final CreateSpatialIndexStatement statement , final Database database ) { final StringBuilder sql = new StringBuilder ( ) ; sql . append ( "CREATE INDEX " ) ; final String schemaName = statement . getTableSchemaName ( ) ; final String catalogName = statement . getTableCatalogName ( ) ; final String indexName = statement . getIndexName ( ) ; sql . append ( database . escapeIndexName ( catalogName , schemaName , indexName ) ) ; sql . append ( " ON " ) ; final String tableName = statement . getTableName ( ) ; sql . append ( database . escapeTableName ( catalogName , schemaName , tableName ) ) . append ( " (" ) ; final Iterator < String > iterator = Arrays . asList ( statement . getColumns ( ) ) . iterator ( ) ; final String column = iterator . next ( ) ; sql . append ( database . escapeColumnName ( catalogName , statement . getTableSchemaName ( ) , tableName , column ) ) ; sql . append ( ") INDEXTYPE IS mdsys.spatial_index" ) ; // Generate and add the optional parameters. final Collection < String > parameters = getParameters ( statement ) ; if ( parameters != null && ! parameters . isEmpty ( ) ) { sql . append ( " PARAMETERS ('" ) ; sql . append ( StringUtils . join ( parameters , " " ) ) ; sql . append ( "')" ) ; } return sql . toString ( ) ; }
Generates the SQL for creating the spatial index .