public class SQLForeignKey extends SQLConstraint
| Modifier and Type | Field and Description |
|---|---|
protected static String |
FOREIGN_KEY |
protected List |
foreignColumns
The list of columns of the referenced table in where the constraint is
applied.
|
protected static String |
REFERENCES |
protected String |
secondaryTable
The name of the referenced table
|
columns, CONSTRAINT, constraintName| Constructor and Description |
|---|
SQLForeignKey(String constraintName) |
SQLForeignKey(String secondaryTable,
Hashtable keys) |
SQLForeignKey(String constraintName,
String secondaryTable,
Hashtable keys) |
| Modifier and Type | Method and Description |
|---|---|
List |
getForeignColumns()
This method returns the list of column/s of the referenced table that are
going to be used into the constraint.
|
String |
getSecondaryTable()
Returns the name of the referenced table.
|
void |
setKeys(Hashtable keys) |
void |
setSecondaryTable(String secondaryTable)
This method sets the name of the referenced table of the Foreign key.
|
String |
toString()
This method returns the SQL Statement to add a Foreign Key constraint to
a database table.
|
getColumnList, getColumns, getConstraintName, setConstraintNameprotected static final String FOREIGN_KEY
protected static final String REFERENCES
protected String secondaryTable
protected List foreignColumns
public SQLForeignKey(String secondaryTable, Hashtable keys)
secondaryTable - The table, in which the restriction is made,keys - Must contains a pair key-value, where key is the table column
and value is the name of reference column.public SQLForeignKey(String constraintName, String secondaryTable, Hashtable keys)
constraintName - The name of the constraint.secondaryTable - The table, in which the restriction is made,keys - Must contains a pair key-value, where key is the table column
and value is the name of reference column.public SQLForeignKey(String constraintName)
constraintName - The name of the constraint.public List getForeignColumns()
String with the column/s between parenthesispublic void setKeys(Hashtable keys)
keys - Must contains a pair key-value, where key is the table column
and value is the name of reference column.public String getSecondaryTable()
String with the name of the referenced table.public void setSecondaryTable(String secondaryTable)
secondaryTable - String with the name of the referenced table.Copyright © 2016 Imatia Innovation S.L.. All rights reserved.