Enum Class SQLReferenceOption

java.lang.Object
java.lang.Enum<SQLReferenceOption>
com.github.tadukoo.database.mysql.syntax.SQLReferenceOption
All Implemented Interfaces:
Serializable, Comparable<SQLReferenceOption>, Constable

public enum SQLReferenceOption extends Enum<SQLReferenceOption>
SQL Reference Option represents a Reference Option in MySQL
Version:
Alpha v.0.3
Author:
Logan Ferree (Tadukoo)
  • Enum Constant Details

    • RESTRICT

      public static final SQLReferenceOption RESTRICT
      Rejects the delete or update operation for the parent table. This is also the default operation - RESTRICT
    • CASCADE

      public static final SQLReferenceOption CASCADE
      Delete or update the row from the parent table and automatically delete or update the matching rows in the child table - CASCADE
    • SET_NULL

      public static final SQLReferenceOption SET_NULL
      Delete or update the row from the parent table and set the foreign key column or columns in the child table to NULL - SET NULL
    • NO_ACTION

      public static final SQLReferenceOption NO_ACTION
      Rejects the delete or update operation for the parent table. This is the same as RESTRICT - NO ACTION
    • SET_DEFAULT

      public static final SQLReferenceOption SET_DEFAULT
      This action is recognized by the MySQL parser, but both InnoDB and NDB reject table definitions containing this - SET DEFAULT
  • Field Details

    • option

      private final String option
      The option value
  • Constructor Details

    • SQLReferenceOption

      private SQLReferenceOption(String option)
      Constructs a new SQLReferenceOption with the given parameter
      Parameters:
      option - The option value
  • Method Details

    • values

      public static SQLReferenceOption[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static SQLReferenceOption valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • fromOption

      public static SQLReferenceOption fromOption(String option)
      Find a SQLReferenceOption with the given option value
      Parameters:
      option - The option value to find
      Returns:
      The found SQLReferenceOption or null
    • toString

      public String toString()
      Overrides:
      toString in class Enum<SQLReferenceOption>