Class DropTable


public class DropTable extends MySqlPart

Generates a DROP TABLE statement for MySQL.


Sample Generated SQL:

DROP TABLE IF EXISTS person, address CASCADE
  • Constructor Details

    • DropTable

      public DropTable()
    • DropTable

      public DropTable(String... tableNames)
  • Method Details

    • setPretty

      public DropTable setPretty(boolean pretty)
      Description copied from class: SqlPart
      Indicates if SqlPart.getSqlFragment() adds line breaks and indentation instead of using one line (default is false).
      Overrides:
      setPretty in class SqlPart
    • collectSqlFragment

      public void collectSqlFragment(CodeWriter writer)
      Description copied from class: SqlPart
      Writes this part's SQL to the writer; used by SqlPart.getSqlFragment() and by enclosing parts.
      Specified by:
      collectSqlFragment in class SqlPart
    • getTableNames

      public List<String> getTableNames()
    • setTableNames

      public DropTable setTableNames(Collection<String> tableNames)
      Replaces the tables to drop with a copy of the given names; null is ignored.
    • setTableNames

      public DropTable setTableNames(String... tableNames)
      Replaces the tables to drop with the given names; null or an empty array is ignored.
    • isCheckIfExists

      public boolean isCheckIfExists()
      Indicates if IF EXISTS clause should be included in the DROP TABLE statement (default true).
    • setCheckIfExists

      public DropTable setCheckIfExists(boolean checkIfExists)
      Indicates if IF EXISTS clause should be included in the DROP TABLE statement (default true).
    • isCascade

      public boolean isCascade()
    • setCascade

      public DropTable setCascade(boolean cascade)
    • isRestrict

      public boolean isRestrict()
      Returns the inverse of isCascade(); no RESTRICT keyword is ever written.