- java.lang.Object
-
- java.lang.Enum<ForeignKeyAction>
-
- org.tentackle.sql.metadata.ForeignKeyAction
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<ForeignKeyAction>
public enum ForeignKeyAction extends java.lang.Enum<ForeignKeyAction>
Enum for foreign key actions.- Author:
- harald
-
-
Enum Constant Summary
Enum Constants Enum Constant Description CASCADEWhen the primary key is updated, the foreign key (imported key) is changed to agree with it.INITIALLY_DEFERREDIndicates deferrability.INITIALLY_IMMEDIATEIndicates deferrability.NO_ACTIONIf the primary key has been imported, it cannot be updated or deleted.NOT_DEFERRABLEIndicates deferrability.RESTRICTThe primary key may not be updated if it has been imported by another table as a foreign key.SET_DEFAULTIf the primary key is updated or deleted, the foreign key (imported key) is set to the default value.SET_NULLWhen the primary key is updated or deleted, the foreign key (imported key) is changed toNULL..
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ForeignKeyActioncreateFromAction(int action)Creates a foreign key action from an action code.intgetAction()Gets the action code.java.lang.StringgetSql()Gets the SQL code.java.lang.StringtoString()static ForeignKeyActionvalueOf(java.lang.String name)Returns the enum constant of this type with the specified name.static ForeignKeyAction[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
CASCADE
public static final ForeignKeyAction CASCADE
When the primary key is updated, the foreign key (imported key) is changed to agree with it.
-
RESTRICT
public static final ForeignKeyAction RESTRICT
The primary key may not be updated if it has been imported by another table as a foreign key.
-
SET_NULL
public static final ForeignKeyAction SET_NULL
When the primary key is updated or deleted, the foreign key (imported key) is changed toNULL..
-
NO_ACTION
public static final ForeignKeyAction NO_ACTION
If the primary key has been imported, it cannot be updated or deleted.
-
SET_DEFAULT
public static final ForeignKeyAction SET_DEFAULT
If the primary key is updated or deleted, the foreign key (imported key) is set to the default value.
-
INITIALLY_DEFERRED
public static final ForeignKeyAction INITIALLY_DEFERRED
Indicates deferrability. See SQL-92 for a definition.
-
INITIALLY_IMMEDIATE
public static final ForeignKeyAction INITIALLY_IMMEDIATE
Indicates deferrability. See SQL-92 for a definition.
-
NOT_DEFERRABLE
public static final ForeignKeyAction NOT_DEFERRABLE
Indicates deferrability. See SQL-92 for a definition.
-
-
Method Detail
-
values
public static ForeignKeyAction[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (ForeignKeyAction c : ForeignKeyAction.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static ForeignKeyAction valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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:
java.lang.IllegalArgumentException- if this enum type has no constant with the specified namejava.lang.NullPointerException- if the argument is null
-
getAction
public int getAction()
Gets the action code.- Returns:
- the action code
-
getSql
public java.lang.String getSql()
Gets the SQL code.- Returns:
- the sql
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Enum<ForeignKeyAction>
-
createFromAction
public static ForeignKeyAction createFromAction(int action)
Creates a foreign key action from an action code.- Parameters:
action- the code- Returns:
- the foreign key action, null if invalid code
-
-