MCPcopy Create free account
hub / github.com/cmu-db/benchbase / unload

Method unload

src/main/java/com/oltpbenchmark/api/Loader.java:98–111  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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 {

Callers 1

clearDatabaseMethod · 0.80

Calls 7

getDatabaseTypeMethod · 0.95
shouldEscapeNamesMethod · 0.80
getEscapedNameMethod · 0.80
formatMethod · 0.80
getTablesMethod · 0.65
getNameMethod · 0.65
executeMethod · 0.45

Tested by

no test coverage detected