Java Code Examples for liquibase.database.Database#getDefaultSchemaName()
The following examples show how to use
liquibase.database.Database#getDefaultSchemaName() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ImpalaLockDatabaseChangeLogGenerator.java From liquibase-impala with Apache License 2.0 | 6 votes |
@Override public Sql[] generateSql(LockDatabaseChangeLogStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) { String catalogName = database.getLiquibaseCatalogName(); String schemaName = database.getDefaultSchemaName(); String tableName = database.getDatabaseChangeLogLockTableName(); InsertStatement insertStatement = new InsertStatement(catalogName, schemaName, tableName) .addColumnValue("ID", 1) .addColumnValue("LOCKED", Boolean.TRUE) .addColumnValue("LOCKEDBY", hostname + " [" + hostaddress + "]") .addColumnValue("LOCKGRANTED", DateTimeUtils.getCurrentTS("yyyy-MM-dd HH:mm:ss")); return CustomSqlGenerator.generateSql(database, UserSessionSettings.syncDdlStart(), new TruncateTableStatement(catalogName, schemaName, tableName), insertStatement, UserSessionSettings.syncDdlStop()); }
Example 2
Source File: AddGeometryColumnGeneratorGeoDBTest.java From liquibase-spatial with Apache License 2.0 | 6 votes |
@DataProvider public Object[][] generateSqlTestData() { final Database database = new H2Database(); final AddColumnStatement notGeometry = new AddColumnStatement(null, null, null, null, "BOOLEAN", null); final AddColumnStatement nullSchema = new AddColumnStatement(null, null, "TEST", "COLUMN", "Geometry(Point, 4327)", null); final Sql nullSchemaExpected = new UnparsedSql("CALL AddGeometryColumn('" + database.getDefaultSchemaName() + "', 'TEST', 'COLUMN', 4327, 'Point', 2)"); final AddColumnStatement complete = new AddColumnStatement(null, database.getDefaultSchemaName(), "TEST", "COLUMN", "Geometry(Geometry,4326)", null); final Sql completeExpected = new UnparsedSql("CALL AddGeometryColumn('" + database.getDefaultSchemaName() + "', 'TEST', 'COLUMN', 4326, 'Geometry', 2)"); return new Object[][] { new Object[] { notGeometry, database, new Sql[0] }, new Object[] { nullSchema, database, new Sql[] { nullSchemaExpected } }, new Object[] { complete, database, new Sql[] { completeExpected } }, }; }
Example 3
Source File: DropSpatialTableGeneratorGeoDB.java From liquibase-spatial with Apache License 2.0 | 6 votes |
@Override public Sql[] generateSql(final DropTableStatement statement, final Database database, final SqlGeneratorChain sqlGeneratorChain) { final List<Sql> list = new ArrayList<Sql>(); String schemaName = statement.getSchemaName(); if (schemaName == null) { schemaName = database.getDefaultSchemaName(); } final String tableName = statement.getTableName(); // If the table has a geometry column, drop it first. if (GeometryColumnsUtils.hasGeometryColumn(database, schemaName, tableName)) { dropSpatialIndexIfExists(statement.getCatalogName(), schemaName, tableName, database, list); final String sql = "CALL DropGeometryColumns('" + schemaName + "', '" + tableName + "')"; final Sql addGeometryColumn = new UnparsedSql(sql); list.add(addGeometryColumn); } list.addAll(Arrays.asList(sqlGeneratorChain.generateSql(statement, database))); return list.toArray(new Sql[list.size()]); }
Example 4
Source File: DropGeometryColumnGeneratorGeoDB.java From liquibase-spatial with Apache License 2.0 | 6 votes |
@Override public Sql[] generateSql(final DropColumnStatement statement, final Database database, final SqlGeneratorChain sqlGeneratorChain) { String schemaName = statement.getSchemaName(); if (schemaName == null) { schemaName = database.getDefaultSchemaName(); } final String tableName = statement.getTableName(); final String columnName = statement.getColumnName(); final boolean isGeometryColumn = GeometryColumnsUtils.isGeometryColumn(database, schemaName, tableName, columnName); final List<Sql> list = new ArrayList<Sql>(); if (isGeometryColumn) { dropSpatialIndexIfExists(statement.getCatalogName(), schemaName, tableName, database, list); final String sql = "CALL DropGeometryColumn('" + schemaName + "', '" + tableName + "', '" + columnName + "')"; final Column column = getAffectedColumn(statement); final Sql dropGeometryColumn = new UnparsedSql(sql, column); list.add(dropGeometryColumn); } else { list.addAll(Arrays.asList(sqlGeneratorChain.generateSql(statement, database))); } return list.toArray(new Sql[list.size()]); }
Example 5
Source File: DropSpatialIndexGeneratorGeoDB.java From liquibase-spatial with Apache License 2.0 | 6 votes |
@Override public Sql[] generateSql(final DropSpatialIndexStatement statement, final Database database, final SqlGeneratorChain sqlGeneratorChain) { final String catalogName = statement.getTableCatalogName(); String schemaName = statement.getTableSchemaName(); if (schemaName == null) { schemaName = database.getDefaultSchemaName(); } final StringBuilder sql = new StringBuilder("CALL "); sql.append(schemaName).append(".DropSpatialIndex("); // Add the schema name parameter. sql.append("'").append(database.escapeStringForDatabase(schemaName)).append("'"); sql.append(", "); // Add the table name parameter. final String tableName = statement.getTableName(); sql.append("'").append(database.escapeStringForDatabase(tableName)).append("'"); sql.append(')'); final Table hatboxTable = new Table().setName(tableName + "_HATBOX"); hatboxTable.setSchema(catalogName, schemaName); final UnparsedSql spatialize = new UnparsedSql(sql.toString(), hatboxTable); return new Sql[] { spatialize }; }
Example 6
Source File: ImpalaRemoveChangeSetRanStatusGenerator.java From liquibase-impala with Apache License 2.0 | 6 votes |
@Override public Sql[] generateSql(RemoveChangeSetRanStatusStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) { ChangeSet changeSet = statement.getChangeSet(); String tmpTable = UUID.randomUUID().toString().replaceAll("-", ""); String catalogName = database.getLiquibaseCatalogName(); String schemaName = database.getDefaultSchemaName(); String tableName = database.getDatabaseChangeLogTableName(); CreateTableAsSelectStatement createTableAsSelectStatement = new CreateTableAsSelectStatement(catalogName, schemaName, tableName, tmpTable) .addColumnNames("ID", "AUTHOR", "FILENAME", "DATEEXECUTED", "ORDEREXECUTED", "EXECTYPE", "MD5SUM", "DESCRIPTION", "COMMENTS", "TAG", "LIQUIBASE", "CONTEXTS", "LABELS", "DEPLOYMENT_ID") .setWhereCondition(" NOT (" + database.escapeObjectName("ID", Column.class) + " = ? " + "AND " + database.escapeObjectName("FILENAME", Column.class) + " = ?)") .addWhereParameters(changeSet.getId(), changeSet.getFilePath()); return CustomSqlGenerator.generateSql(database, UserSessionSettings.syncDdlStart(), createTableAsSelectStatement, new DropTableStatement(catalogName, schemaName, tableName, false), new RenameTableStatement(catalogName, schemaName, tmpTable, tableName), UserSessionSettings.syncDdlStop()); }
Example 7
Source File: HiveTagDatabaseGenerator.java From liquibase-impala with Apache License 2.0 | 6 votes |
@Override public Sql[] generateSql(TagDatabaseStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) { String catalogName = database.getLiquibaseCatalogName(); String schemaName = database.getDefaultSchemaName(); String tableName = database.getDatabaseChangeLogTableName(); String tableNameEscaped = database.escapeObjectName(tableName, Table.class); String dateColumnNameEscaped = database.escapeObjectName("DATEEXECUTED", Column.class); String tagColumnNameEscaped = database.escapeObjectName("TAG", Column.class); String tempTable = UUID.randomUUID().toString().replaceAll("-", ""); CreateTableAsSelectStatement createTableAsSelectStatement = new CreateTableAsSelectStatement(catalogName, schemaName, tableName, tempTable) .addColumnNames("ID", "AUTHOR", "FILENAME", "DATEEXECUTED", "ORDEREXECUTED", "EXECTYPE", "MD5SUM", "DESCRIPTION", "COMMENTS", "TAG", "LIQUIBASE", "CONTEXTS", "LABELS", "DEPLOYMENT_ID") .setWhereCondition(tableNameEscaped + "." + dateColumnNameEscaped + " NOT IN (SELECT MAX(" + tableNameEscaped + "." + dateColumnNameEscaped + ") " + "FROM " + tableNameEscaped + ")"); InsertAsSelectStatement insertAsSelectStatement = new InsertAsSelectStatement(catalogName, schemaName, tableName, tempTable) .addColumnNames("ID", "AUTHOR", "FILENAME", "DATEEXECUTED", "ORDEREXECUTED", "EXECTYPE", "MD5SUM", "DESCRIPTION", "COMMENTS", "'" + statement.getTag() + "'", "LIQUIBASE", "CONTEXTS", "LABELS", "DEPLOYMENT_ID") .setWhereCondition(tableNameEscaped + "." + dateColumnNameEscaped + " IN (SELECT MAX(" + tableNameEscaped + "." + dateColumnNameEscaped + ") FROM " + tableNameEscaped + ") AND (" + tableNameEscaped + "." + tagColumnNameEscaped + " IS NULL OR " + tableNameEscaped + "." + tagColumnNameEscaped + " != ?)").addWhereParameters(statement.getTag()); return CustomSqlGenerator.generateSql(database, createTableAsSelectStatement, insertAsSelectStatement, new DropTableStatement(catalogName, schemaName, tableName, false), new RenameTableStatement(catalogName, schemaName, tempTable, tableName)); }
Example 8
Source File: HiveRemoveChangeSetRanStatusGenerator.java From liquibase-impala with Apache License 2.0 | 6 votes |
@Override public Sql[] generateSql(RemoveChangeSetRanStatusStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) { ChangeSet changeSet = statement.getChangeSet(); String tmpTable = UUID.randomUUID().toString().replaceAll("-", ""); String catalogName = database.getLiquibaseCatalogName(); String schemaName = database.getDefaultSchemaName(); String tableName = database.getDatabaseChangeLogTableName(); CreateTableAsSelectStatement createTableAsSelectStatement = new CreateTableAsSelectStatement(catalogName, schemaName, tableName, tmpTable) .addColumnNames("ID", "AUTHOR", "FILENAME", "DATEEXECUTED", "ORDEREXECUTED", "EXECTYPE", "MD5SUM", "DESCRIPTION", "COMMENTS", "TAG", "LIQUIBASE", "CONTEXTS", "LABELS", "DEPLOYMENT_ID") .setWhereCondition(database.escapeObjectName("ID", Column.class) + " != ? " + "AND " + database.escapeObjectName("FILENAME", Column.class) + " != ?") .addWhereParameters(changeSet.getId(), changeSet.getFilePath()); return CustomSqlGenerator.generateSql(database, createTableAsSelectStatement, new DropTableStatement(catalogName, schemaName, tableName, false), new RenameTableStatement(catalogName, schemaName, tmpTable, tableName)); }
Example 9
Source File: ImpalaInitializeDatabaseChangeLogLockTableGenerator.java From liquibase-impala with Apache License 2.0 | 5 votes |
@Override public Sql[] generateSql(InitializeDatabaseChangeLogLockTableStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) { String catalogName = database.getLiquibaseCatalogName(); String schemaName = database.getDefaultSchemaName(); String tableName = database.getDatabaseChangeLogLockTableName(); InsertStatement insertStatement = new InsertStatement(catalogName, schemaName, tableName) .addColumnValue("ID", 1) .addColumnValue("LOCKED", Boolean.FALSE); return CustomSqlGenerator.generateSql(database, UserSessionSettings.syncDdlStart(), new TruncateTableStatement(catalogName, schemaName, tableName), insertStatement, UserSessionSettings.syncDdlStop()); }
Example 10
Source File: ImpalaTagDatabaseGenerator.java From liquibase-impala with Apache License 2.0 | 5 votes |
@Override public Sql[] generateSql(TagDatabaseStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) { String catalogName = database.getLiquibaseCatalogName(); String schemaName = database.getDefaultSchemaName(); String tableName = database.getDatabaseChangeLogTableName(); String tableNameEscaped = database.escapeTableName(catalogName, schemaName, tableName); String dateColumnNameEscaped = database.escapeObjectName("DATEEXECUTED", Column.class); String tagColumnNameEscaped = database.escapeObjectName("TAG", Column.class); String tmpTable = UUID.randomUUID().toString().replaceAll("-", ""); CreateTableAsSelectStatement createTableAsSelectStatement = new CreateTableAsSelectStatement(catalogName, schemaName, tableName, tmpTable) .addColumnNames("ID", "AUTHOR", "FILENAME", "DATEEXECUTED", "ORDEREXECUTED", "EXECTYPE", "MD5SUM", "DESCRIPTION", "COMMENTS", "TAG", "LIQUIBASE", "CONTEXTS", "LABELS", "DEPLOYMENT_ID") .setWhereCondition(dateColumnNameEscaped + " != (SELECT MAX(" + dateColumnNameEscaped + ") " + "FROM " + tableNameEscaped + ")"); InsertAsSelectStatement insertAsSelectStatement = new InsertAsSelectStatement(database.getLiquibaseCatalogName(), database.getLiquibaseSchemaName(), database.getDatabaseChangeLogTableName(), tmpTable) .addColumnNames("ID", "AUTHOR", "FILENAME", "DATEEXECUTED", "ORDEREXECUTED", "EXECTYPE", "MD5SUM", "DESCRIPTION", "COMMENTS", "'" + statement.getTag() + "'", "LIQUIBASE", "CONTEXTS", "LABELS", "DEPLOYMENT_ID") .setWhereCondition(dateColumnNameEscaped + " = (SELECT MAX(" + dateColumnNameEscaped + ") FROM " + tableNameEscaped + ") AND (" + tagColumnNameEscaped + " IS NULL OR " + tagColumnNameEscaped + " != ?)") .addWhereParameters(statement.getTag()); return CustomSqlGenerator.generateSql(database, UserSessionSettings.syncDdlStart(), createTableAsSelectStatement, insertAsSelectStatement, new DropTableStatement(catalogName, schemaName, tableName, false), new RenameTableStatement(catalogName, schemaName, tmpTable, tableName), UserSessionSettings.syncDdlStop()); }
Example 11
Source File: ImpalaUnlockDatabaseChangeLogGenerator.java From liquibase-impala with Apache License 2.0 | 5 votes |
@Override public Sql[] generateSql(UnlockDatabaseChangeLogStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) { String catalogName = database.getLiquibaseCatalogName(); String schemaName = database.getDefaultSchemaName(); String tableName = database.getDatabaseChangeLogLockTableName(); InsertStatement insertStatement = new InsertStatement(catalogName, schemaName, tableName) .addColumnValue("ID", 1) .addColumnValue("LOCKED", Boolean.FALSE); return CustomSqlGenerator.generateSql(database, UserSessionSettings.syncDdlStart(), new TruncateTableStatement(catalogName, schemaName, tableName), insertStatement, UserSessionSettings.syncDdlStop()); }
Example 12
Source File: HiveLockDatabaseChangeLogGenerator.java From liquibase-impala with Apache License 2.0 | 5 votes |
@Override public Sql[] generateSql(LockDatabaseChangeLogStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) { String catalogName = database.getLiquibaseCatalogName(); String schemaName = database.getDefaultSchemaName(); String tableName = database.getDatabaseChangeLogLockTableName(); HiveInsertStatement hiveInsertStatement = new HiveInsertStatement(catalogName, schemaName, tableName); hiveInsertStatement.addColumnValue(1); hiveInsertStatement.addColumnValue(Boolean.TRUE); hiveInsertStatement.addColumnValue(hostname + " (" + hostaddress + ")"); hiveInsertStatement.addColumnValue(DateTimeUtils.getCurrentTS("yyyy-MM-dd HH:mm:ss")); return CustomSqlGenerator.generateSql(database, new TruncateTableStatement(catalogName, schemaName, tableName), hiveInsertStatement); }
Example 13
Source File: DefaultTenantProvisioningService.java From cloud-s4-sdk-examples with Apache License 2.0 | 5 votes |
@Override public void subscribeTenant(final String tenantId) { String defaultSchemaName; try { Validate.isTrue(isValidTenantId(tenantId), String.format("Invalid tenant id: \"%s\"", tenantId)); final String schemaName = TenantUtil.createSchemaName(tenantId); final Connection connection = dataSource.getConnection(); final Database database = DatabaseFactory.getInstance().findCorrectDatabaseImplementation(new JdbcConnection(connection)); try (Statement statement = connection.createStatement()) { statement.execute(String.format("CREATE SCHEMA IF NOT EXISTS \"%s\"", schemaName)); connection.commit(); defaultSchemaName = database.getDefaultSchemaName(); database.setDefaultSchemaName(schemaName); final String filePath = LIQUIBASE_PATH; final Liquibase liquibase = new liquibase.Liquibase(filePath, new ClassLoaderResourceAccessor(), database); liquibase.update(new Contexts(), new LabelExpression()); database.setDefaultSchemaName(defaultSchemaName); } } catch (SQLException | LiquibaseException | IllegalArgumentException e) { final BadRequestException badRequestException = new BadRequestException(); logger.error("Tenant subscription failed for {}.", tenantId, e); throw badRequestException; } }
Example 14
Source File: HiveInitializeDatabaseChangeLogLockTableGenerator.java From liquibase-impala with Apache License 2.0 | 5 votes |
@Override public Sql[] generateSql(InitializeDatabaseChangeLogLockTableStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) { String catalogName = database.getLiquibaseCatalogName(); String schemaName = database.getDefaultSchemaName(); String tableName = database.getDatabaseChangeLogLockTableName(); HiveInsertStatement insertStatementHive = new HiveInsertStatement(catalogName, schemaName, tableName) .addColumnValue(1) .addColumnValue(Boolean.FALSE) .addColumnValue("NULL") .addColumnValue("NULL"); return CustomSqlGenerator.generateSql(database, new TruncateTableStatement(catalogName, schemaName, tableName), insertStatementHive); }
Example 15
Source File: CreateSpatialIndexGeneratorGeoDB.java From liquibase-spatial with Apache License 2.0 | 5 votes |
/** * @see liquibase.sqlgenerator.SqlGenerator#generateSql(liquibase.statement.SqlStatement, * liquibase.database.Database, liquibase.sqlgenerator.SqlGeneratorChain) */ @Override public Sql[] generateSql(final CreateSpatialIndexStatement statement, final Database database, final SqlGeneratorChain sqlGeneratorChain) { final String catalogName = statement.getTableCatalogName(); String schemaName = statement.getTableSchemaName(); if (schemaName == null) { schemaName = database.getDefaultSchemaName(); } final StringBuilder sql = new StringBuilder("CALL "); sql.append(schemaName).append(".CreateSpatialIndex("); // Add the schema name parameter. sql.append("'").append(schemaName).append("'"); sql.append(", "); // Add the table name parameter. final String tableName = statement.getTableName(); sql.append("'").append(tableName).append("'"); sql.append(", "); // Add the column name parameter. final String columnName = statement.getColumns()[0]; sql.append("'").append(columnName).append("'"); sql.append(", "); // Add the SRID parameter. final int srid = statement.getSrid(); sql.append("'").append(srid).append("'"); sql.append(')'); final Table hatboxTable = new Table().setName(database.correctObjectName(tableName + "_HATBOX", Table.class)); hatboxTable.setSchema(catalogName, schemaName); final UnparsedSql spatialize = new UnparsedSql(sql.toString(), hatboxTable); return new Sql[] { spatialize }; }
Example 16
Source File: HiveUnlockDatabaseChangeLogGenerator.java From liquibase-impala with Apache License 2.0 | 5 votes |
@Override public Sql[] generateSql(UnlockDatabaseChangeLogStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) { String catalogName = database.getLiquibaseCatalogName(); String schemaName = database.getDefaultSchemaName(); String tableName = database.getDatabaseChangeLogLockTableName(); HiveInsertStatement hiveInsertStatement = new HiveInsertStatement(catalogName, schemaName, tableName) .addColumnValue(1) .addColumnValue(Boolean.FALSE) .addColumnValue("NULL") .addColumnValue("NULL"); return CustomSqlGenerator.generateSql(database, new TruncateTableStatement(catalogName, schemaName, tableName), hiveInsertStatement); }
Example 17
Source File: GeometryColumnsUtils.java From liquibase-spatial with Apache License 2.0 | 5 votes |
/** * Determines if the given table is in <code>GEOMETRY_COLUMNS</code> and, * therefore, has a geometry column. * * @param database * the database to query. * @param schemaName * the schema name. * @param tableName * the table name to check. * @return <code>true</code> if the table has a geometry column. */ public static boolean hasGeometryColumn(final Database database, final String schemaName, final String tableName) { boolean isSpatialColumn = false; Statement jdbcStatement = null; try { if (geometryColumnsExists(database)) { final String query = "SELECT * FROM geometry_columns WHERE f_table_schema = '" + (schemaName == null ? database.getDefaultSchemaName() : schemaName) + "' AND f_table_name = '" + tableName + "'"; final DatabaseConnection databaseConnection = database .getConnection(); final JdbcConnection jdbcConnection = (JdbcConnection) databaseConnection; jdbcStatement = jdbcConnection.getUnderlyingConnection() .createStatement(); final ResultSet rs = jdbcStatement.executeQuery(query); isSpatialColumn = rs.next(); } } catch (final SQLException e) { throw new UnexpectedLiquibaseException( "Failed to determine if the table has a geometry column", e); } finally { if (jdbcStatement != null) { try { jdbcStatement.close(); } catch (final SQLException ignore) { } } } return isSpatialColumn; }
Example 18
Source File: GeometryColumnsUtils.java From liquibase-spatial with Apache License 2.0 | 5 votes |
/** * Determines if the given column is in <code>GEOMETRY_COLUMNS</code>. * * @param database * the database to query. * @param schemaName * the schema name. * @param tableName * the table name. * @param columnName * the column name. * @return <code>true</code> if the column is a geometry column. */ public static boolean isGeometryColumn(final Database database, final String schemaName, final String tableName, final String columnName) { boolean isSpatialColumn = false; Statement jdbcStatement = null; try { if (geometryColumnsExists(database)) { final String query = "SELECT * FROM geometry_columns WHERE f_table_schema = '" + (schemaName == null ? database.getDefaultSchemaName() : schemaName) + "' AND f_table_name = '" + tableName + "' AND upper(f_geometry_column) = '" + columnName.toUpperCase() + "'"; final DatabaseConnection databaseConnection = database .getConnection(); final JdbcConnection jdbcConnection = (JdbcConnection) databaseConnection; jdbcStatement = jdbcConnection.getUnderlyingConnection() .createStatement(); final ResultSet rs = jdbcStatement.executeQuery(query); isSpatialColumn = rs.next(); } } catch (final SQLException e) { throw new UnexpectedLiquibaseException( "Failed to determine if the column to be dropped is a geometry column", e); } finally { if (jdbcStatement != null) { try { jdbcStatement.close(); } catch (final SQLException ignore) { } } } return isSpatialColumn; }
Example 19
Source File: AddGeometryColumnGeneratorGeoDB.java From liquibase-spatial with Apache License 2.0 | 4 votes |
@Override public Sql[] generateSql(final AddColumnStatement statement, final Database database, final SqlGeneratorChain sqlGeneratorChain) { GeometryType geometryType = null; final LiquibaseDataType dataType = DataTypeFactory.getInstance() .fromDescription(statement.getColumnType(), database); if (dataType instanceof GeometryType) { geometryType = (GeometryType) dataType; } final boolean isGeometryColumn = geometryType != null; // The AddGeometryColumn procedure handles the column already being // present, so let a // downstream SQL generator handle the typical column addition logic (e.g. // placement in the // table) then invoke the procedure. final List<Sql> list = new ArrayList<Sql>(); list.addAll(Arrays.asList(sqlGeneratorChain.generateSql(statement, database))); if (isGeometryColumn) { String schemaName = statement.getSchemaName(); if (schemaName == null) { schemaName = database.getDefaultSchemaName(); } final String tableName = statement.getTableName(); final String columnName = statement.getColumnName(); final int srid = geometryType.getSRID(); final String geomType = StringUtils.trimToNull(geometryType .getGeometryType()) == null ? "'Geometry'" : "'" + database.escapeStringForDatabase(geometryType .getGeometryType()) + "'"; final String sql = "CALL AddGeometryColumn('" + schemaName + "', '" + tableName + "', '" + columnName + "', " + srid + ", " + geomType + ", 2)"; final Sql addGeometryColumn = new UnparsedSql(sql); list.add(addGeometryColumn); } return list.toArray(new Sql[list.size()]); }