View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0001153 | SymmetricDS | Bug | public | 2013-03-31 09:27 | 2019-04-11 19:21 |
Reporter | borball | Assigned To | |||
Priority | normal | ||||
Status | closed | Resolution | won't fix | ||
Product Version | 3.3.4 | ||||
Summary | 0001153: Drop tables in Database failed | ||||
Description | Can not drop tables when call API: public void alterDatabase(Database desiredDatabase, boolean continueOnError) in org.jumpmind.db.platform.IDatabasePlatform | ||||
Steps To Reproduce | 1. create one table in datasource with IDatabasePlatform.createTables() 2. drop the table with : Database oldDatabase = readDatabase(dataSource); for (Table table : tables) { oldDatabase.removeTable(table); } getDatabasePlatform(dataSource).alterDatabase(oldDatabase, false); 3. The table is still there. | ||||
Additional Information | Potension issues in Code: org.jumpmind.db.platform.AbstractDatabasePlatform public void alterTables(boolean continueOnError, Table... desiredTables) { Database currentDatabase = new Database(); Database desiredDatabase = new Database(); StringBuilder tablesProcessed = new StringBuilder(); for (Table table : desiredTables) { tablesProcessed.append(table.getFullyQualifiedTableName()); tablesProcessed.append(", "); desiredDatabase.addTable(table); Table currentTable = ddlReader.readTable(table.getCatalog(), table.getSchema(), table.getName()); if (currentTable != null) { currentDatabase.addTable(currentTable); } } if (tablesProcessed.length() > 1) { tablesProcessed.replace(tablesProcessed.length() - 2, tablesProcessed.length(), ""); } String alterSql = ddlBuilder.alterDatabase(currentDatabase, desiredDatabase); if (StringUtils.isNotBlank(alterSql.trim())) { log.info("Running alter sql:\n{}", alterSql); String delimiter = getDdlBuilder().getDatabaseInfo().getSqlCommandDelimiter(); new SqlScript(alterSql, getSqlTemplate(), !continueOnError, false, false, delimiter, null).execute(); } else { log.info("Tables up to date. No alters found for {}", tablesProcessed); } } | ||||
Tags | No tags attached. | ||||