Java Utililty Methods SQL Table Drop

List of utility methods to do SQL Table Drop

  1. HOME
  2. Java
  3. S
  4. SQL Table Drop

Description

The list of methods to do SQL Table Drop are organized into topic(s).

Method

boolean delete(Connection conn, String table, Serializable id)
delete
int ret = 0;
try {
 Statement statement = conn.createStatement();
 String sql = String.format("DELETE FROM %s WHERE id = %s;", table, id);
 ret = statement.executeUpdate(sql);
 statement.close();
} catch (SQLException e) {
 e.printStackTrace();
...
void deleteMySqlTable(String tableName, Statement stmt)
delete My Sql Table
stmt.executeUpdate("TRUNCATE " + tableName);
void deleteTable(Connection con, String tableName)
delete Table
Statement stmt = null;
try {
 stmt = con.createStatement();
 stmt.executeUpdate("delete " + tableName);
} finally {
 if (stmt != null) {
 stmt.close();
void dropTable(Connection con, String table)
drop Table
Statement stmt = con.createStatement();
try {
 String sql = "DROP TABLE " + table + " CASCADE ";
 stmt.executeUpdate(sql);
} catch (SQLException ex) {
 if (!con.getAutoCommit()) {
 throw ex;
void dropTable(Connection con, String tableName)
Drop d'une table.
Statement stmt = null;
try {
 stmt = con.createStatement();
 stmt.executeUpdate("drop table " + tableName);
} catch (SQLException ex) {
 ; 
} finally {
 if (stmt != null) {
...
void dropTable(Connection conn, String table)
drop Table
Statement stmt = null;
try {
 stmt = conn.createStatement();
 stmt.executeUpdate("drop table " + table);
} catch (SQLException e) {
 Logger.global.log(Level.FINE, "Drop table failed for = " + table);
 Logger.global.log(Level.FINE, "==============\n\n");
} finally {
...
void dropTable(Connection conn, String tablename)
drop Table
StringBuilder sb = new StringBuilder();
sb.append("DROP TABLE IF EXISTS ");
sb.append(tablename);
String sql = sb.toString();
Statement stmt = null;
try {
 stmt = conn.createStatement();
 stmt.executeUpdate(sql);
...
void dropTable(Connection conn, String tableName)
drop Table
executeStatement(conn, String.format("DROP TABLE IF EXISTS %s", tableName));
void dropTable(Connection connection)
drop Table
Statement statement = connection.createStatement();
statement.execute(DROP_TABLE_QUERY);
void dropTable(Connection connection)
drop Table
try (Statement statement = connection.createStatement()) {
 statement.execute("drop table METRICS_TEST");


AltStyle によって変換されたページ (->オリジナル) /