Class DropTable


public class DropTable extends H2SqlPart

Generates a DROP TABLE statement for H2.


Sample Generated SQL:

DROP TABLE IF EXISTS person, address CASCADE
  • Constructor Details

    • DropTable

      public DropTable()
    • DropTable

      public DropTable(String... tableNames)
      Constructs a DropTable with the specified table names.
      Parameters:
      tableNames - the table names to drop
  • 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()
      Returns the table names.
      Returns:
      the table names
    • setTableNames

      public DropTable setTableNames(Collection<String> tableNames)
      Sets the table names from a collection.
      Parameters:
      tableNames - the table names
      Returns:
      this instance
    • setTableNames

      public DropTable setTableNames(String... tableNames)
      Sets the table names.
      Parameters:
      tableNames - the table names
      Returns:
      this instance
    • 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)
      Sets whether IF EXISTS clause should be included in the DROP TABLE statement.
      Parameters:
      checkIfExists - true to include IF EXISTS clause
      Returns:
      this instance
    • isCascade

      public boolean isCascade()
      Returns whether CASCADE is enabled.
      Returns:
      true if CASCADE is enabled
    • setCascade

      public DropTable setCascade(boolean cascade)
      Sets whether CASCADE is enabled.
      Parameters:
      cascade - true to enable CASCADE
      Returns:
      this instance
    • isRestrict

      public boolean isRestrict()
      Returns whether RESTRICT is enabled.
      Returns:
      true if RESTRICT is enabled