Method that can be overriden to specifically unload the tables of the database. In the default implementation it checks for tables from the catalog to delete them using SQL. Any subclass can inject custom behavior here. @param catalog The catalog containing all loaded tables @throws SQLException
(Connection conn, AbstractCatalog catalog)
| 96 | * @throws SQLException |
| 97 | */ |
| 98 | public void unload(Connection conn, AbstractCatalog catalog) throws SQLException { |
| 99 | |
| 100 | boolean shouldEscapeNames = this.getDatabaseType().shouldEscapeNames(); |
| 101 | |
| 102 | try (Statement st = conn.createStatement()) { |
| 103 | for (Table catalog_tbl : catalog.getTables()) { |
| 104 | String tableName = shouldEscapeNames ? catalog_tbl.getEscapedName() : catalog_tbl.getName(); |
| 105 | LOG.debug(String.format("Deleting data from table [%s]", tableName)); |
| 106 | |
| 107 | String sql = "DELETE FROM " + tableName; |
| 108 | st.execute(sql); |
| 109 | } |
| 110 | } |
| 111 | } |
| 112 | |
| 113 | protected void updateAutoIncrement(Connection conn, Column catalog_col, int value) |
| 114 | throws SQLException { |
no test coverage detected