Skip to content

Commit 9027511

Browse files
committed
Update SQL.java
1 parent 05b8efa commit 9027511

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

  • src/main/java/io/github/intisy/utils/custom

src/main/java/io/github/intisy/utils/custom/SQL.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,19 @@ private Connection initializeConnection() {
8686
}
8787
}
8888

89+
public void deleteTable(String tableName) {
90+
String sql = "DROP TABLE IF EXISTS " + tableName;
91+
92+
try (Connection connection = getConnection();
93+
Statement statement = connection.createStatement()) {
94+
95+
statement.execute(sql);
96+
logger.debug("Table '" + tableName + "' deleted successfully.");
97+
} catch (SQLException e) {
98+
logger.exception(e);
99+
}
100+
}
101+
89102
@Override
90103
public void close() {
91104
try {

0 commit comments

Comments
 (0)