public class DBRelation extends DBObject
Modifier and Type | Class and Description |
---|---|
static class |
DBRelation.DBCascadeAction
DBCascadeAction enum
This enum specifies options for a relation when deleting records
(see DBRelation.setOnDeleteAction)
- NONE: No Action is performed and the operation will fail if depending records exist
|
static class |
DBRelation.DBReference |
Constructor and Description |
---|
DBRelation(DBDatabase db,
String name,
DBRelation.DBReference[] references)
Creates a DBRelation object for a foreing key relation.
|
DBRelation(DBDatabase db,
String name,
DBRelation.DBReference[] references,
DBRelation.DBCascadeAction onDeleteAction)
Creates a DBRelation object for a foreing key relation.
|
Modifier and Type | Method and Description |
---|---|
DBDatabase |
getDatabase()
Returns the database object to which this object belongs to.
|
String |
getEnableDisableStatement(boolean enable)
Appends the required DLL command to enable or disable a foreign key constraint to the supplied DBDQLScript.
|
String |
getEnableDisableStmt(boolean enable,
DBDatabaseDriver driver)
Appends the required DLL command to enable or disable a foreign key constraint to the supplied DBDQLScript.
|
DBTable |
getForeignKeyTable()
Returns the table that is containing the foreign key (source table)
|
String |
getFullName()
Returns the full qualified table name.
|
String |
getName()
Returns the name.
|
DBRelation.DBCascadeAction |
getOnDeleteAction()
return the action to perform when deleting affected records.
|
DBTable |
getReferencedTable()
Returns the table that is referenced by this foreign key relation (target table)
|
DBRelation.DBReference[] |
getReferences()
Returns the references.
|
void |
onDeleteCascade()
short for
setOnDeleteAction(DBCascadeAction.CASCADE);
See DBCascadeAction enum for details.
|
void |
onDeleteCascadeRecords()
short for
setOnDeleteAction(DBCascadeAction.CASCADE);
See DBCascadeAction enum for details.
|
void |
setOnDeleteAction(DBRelation.DBCascadeAction onDeleteAction)
sets the action taken when deleting records that affect this foreign key relation
See DBCascadeAction enum for details.
|
String |
toString() |
public DBRelation(DBDatabase db, String name, DBRelation.DBReference[] references, DBRelation.DBCascadeAction onDeleteAction)
db
- the database objectname
- the namereferences
- the references for this relationonDeleteAction
- specifies the action performed when deleting affected records.public DBRelation(DBDatabase db, String name, DBRelation.DBReference[] references)
db
- the database objectname
- the namereferences
- the references for this relationpublic String getName()
public String getFullName()
public DBRelation.DBReference[] getReferences()
public DBTable getForeignKeyTable()
public DBTable getReferencedTable()
public DBDatabase getDatabase()
DBObject
getDatabase
in class DBObject
public DBRelation.DBCascadeAction getOnDeleteAction()
public void setOnDeleteAction(DBRelation.DBCascadeAction onDeleteAction)
onDeleteAction
- the action to perform when deleting affected recordspublic void onDeleteCascade()
setOnDeleteAction(DBCascadeAction.CASCADE);See DBCascadeAction enum for details.
public void onDeleteCascadeRecords()
setOnDeleteAction(DBCascadeAction.CASCADE);See DBCascadeAction enum for details.
public String getEnableDisableStmt(boolean enable, DBDatabaseDriver driver)
enable
- true if the constraint should be enabled or false to disable the constraintdriver
- the driver for which to enable or disable the relationpublic final String getEnableDisableStatement(boolean enable)
enable
- true if the constraint should be enabled or false to disable the constraintCopyright © 2008–2018 Apache Software Foundation. All rights reserved.