package osm.jp.api; import java.sql.Connection; import java.sql.PreparedStatement; public class DbCommand { Connection hsqldb; String tableName; boolean verbose; public DbCommand(Connection hsqldb, String tableName) { this.hsqldb = hsqldb; this.tableName = tableName; this.verbose = false; } public DbCommand setVerbose(boolean verbose) { this.verbose = verbose; return this; } public DbCommand dropTable() throws Exception { String sqlStr = "DROP TABLE IF EXISTS "+ tableName; try (PreparedStatement ps = hsqldb.prepareStatement(sqlStr)) { if (verbose) System.out.println(sqlStr); ps.executeUpdate(); } return this; } }