Class DropTableConstraint


public class DropTableConstraint extends H2SqlPart

Generates a ALTER TABLE...DROP CONSTRAINT statement for H2.


Sample Generated SQL:

ALTER TABLE person DROP CONSTRAINT email_check
  • Constructor Details

    • DropTableConstraint

      public DropTableConstraint()
    • DropTableConstraint

      public DropTableConstraint(String tableName, String constraintName)
      Constructs a DropTableConstraint with the specified table and constraint names.
      Parameters:
      tableName - the table name
      constraintName - the constraint name
  • Method Details

    • setPretty

      public DropTableConstraint 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
    • getTableName

      public String getTableName()
      Returns the table name.
      Returns:
      the table name
    • setTableName

      public DropTableConstraint setTableName(String tableName)
      Sets the table name.
      Parameters:
      tableName - the table name
      Returns:
      this instance
    • getConstraintName

      public String getConstraintName()
      Returns the constraint name.
      Returns:
      the constraint name
    • setConstraintName

      public DropTableConstraint setConstraintName(String constraintName)
      Sets the constraint name.
      Parameters:
      constraintName - the constraint name
      Returns:
      this instance