Package org.apache.empire.db
Class DBRelation
java.lang.Object
org.apache.empire.db.DBObject
org.apache.empire.db.DBRelation
This class creates a DBReferene object for a foreing key relation.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumDBCascadeAction enumstatic class -
Constructor Summary
ConstructorsConstructorDescriptionDBRelation(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. -
Method Summary
Modifier and TypeMethodDescriptionfinal DBDatabaseReturns the database object to which this object belongs to.getEnableDisableStmt(boolean enable, DBContext context) Appends the required DLL command to enable or disable a foreign key constraint to the supplied DBDQLScript.Returns the table that is containing the foreign key (source table)Returns the full qualified table name.getName()Returns the name.return the action to perform when deleting affected records.Returns the table that is referenced by this foreign key relation (target table)Returns the references.booleanisOnColumns(DBColumn[] keyColumns) Checks if the relation references the given keyvoidshort forvoidshort forvoidsetOnDeleteAction(DBRelation.DBCascadeAction onDeleteAction) sets the action taken when deleting records that affect this foreign key relation See DBCascadeAction enum for details.toString()Methods inherited from class org.apache.empire.db.DBObject
checkParamNull
-
Constructor Details
-
DBRelation
public DBRelation(DBDatabase db, String name, DBRelation.DBReference[] references, DBRelation.DBCascadeAction onDeleteAction) Creates a DBRelation object for a foreing key relation.- Parameters:
db- the database objectname- the namereferences- the references for this relationonDeleteAction- specifies the action performed when deleting affected records.
-
DBRelation
Creates a DBRelation object for a foreing key relation.- Parameters:
db- the database objectname- the namereferences- the references for this relation
-
-
Method Details
-
getName
Returns the name.- Returns:
- Returns the name
-
getFullName
Returns the full qualified table name.- Returns:
- the full qualified table name
-
getReferences
Returns the references.- Returns:
- the references
-
isOnColumns
Checks if the relation references the given key- Parameters:
keyColumns- the key columns (primary key)- Returns:
- true if the relation references the given key or false otherwise
-
getForeignKeyTable
Returns the table that is containing the foreign key (source table)- Returns:
- true if the relation's source table is the given table
-
getReferencedTable
Returns the table that is referenced by this foreign key relation (target table)- Returns:
- true if the relation's target table
-
getDatabase
Description copied from class:DBObjectReturns the database object to which this object belongs to. For the database object itself this function will return the this pointer.- Specified by:
getDatabasein classDBObject- Returns:
- the database object
-
getOnDeleteAction
return the action to perform when deleting affected records. See DBCascadeAction enum for details.- Returns:
- the action to perform when deleting affected records
-
setOnDeleteAction
sets the action taken when deleting records that affect this foreign key relation See DBCascadeAction enum for details.- Parameters:
onDeleteAction- the action to perform when deleting affected records
-
onDeleteCascade
public void onDeleteCascade()short forsetOnDeleteAction(DBCascadeAction.CASCADE);
See DBCascadeAction enum for details. -
onDeleteCascadeRecords
public void onDeleteCascadeRecords()short forsetOnDeleteAction(DBCascadeAction.CASCADE);
See DBCascadeAction enum for details. -
getEnableDisableStmt
Appends the required DLL command to enable or disable a foreign key constraint to the supplied DBDQLScript.- Parameters:
enable- true if the constraint should be enabled or false to disable the constraintcontext- the context for which to enable or disable the relation- Returns:
- the sql statement
-
toString
-