Class PgConstraintFk
java.lang.Object
org.pgcodekeeper.core.database.base.schema.AbstractStatement
org.pgcodekeeper.core.database.pg.schema.PgAbstractStatement
org.pgcodekeeper.core.database.pg.schema.PgConstraint
org.pgcodekeeper.core.database.pg.schema.PgConstraintFk
- All Implemented Interfaces:
IConstraint,IConstraintFk,ISearchPath,IStatement,ISubElement,IHashable
PostgreSQL FOREIGN KEY constraint implementation.
Foreign key constraints maintain referential integrity between tables
by ensuring values in one table match values in a referenced table.
-
Constructor Summary
ConstructorsConstructorDescriptionPgConstraintFk(String name) Creates a new PostgreSQL FOREIGN KEY constraint. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a column to this foreign key constraint.voidaddDelActCol(String col) voidaddForeignColumn(String referencedColumn) Adds a referenced column in the foreign table.booleancompare(IStatement obj) This method does not account for nested child PgStatements.voidcomputeHash(Hasher hasher) Computes the hash of the implementing object using the provided hasher.Gets the columns involved in this constraint.Gets the SQL definition of this constraint.Gets the foreign columns referenced by this foreign key.Gets the foreign schema containing the referenced table.Gets the foreign table referenced by this foreign key.voidsetDelAction(String delAction) voidsetForeignSchema(String foreignSchema) voidsetForeignTable(String foreignTable) voidvoidsetPeriodColumn(String periodColumn) voidsetPeriodRefColumn(String periodRefColumn) voidsetUpdAction(String updAction) Methods inherited from class org.pgcodekeeper.core.database.pg.schema.PgConstraint
appendAlterSQL, appendOptions, containsColumn, getCreationSQL, getDropSQL, getTableName, isNotValid, setDeferrable, setInitially, setNotEnforced, setNotValidMethods inherited from class org.pgcodekeeper.core.database.pg.schema.PgAbstractStatement
addPrivilege, appendDefaultPrivileges, appendOwnerSQL, formatSql, getQuoter, getRenameCommand, isOwnedMethods inherited from class org.pgcodekeeper.core.database.base.schema.AbstractStatement
addDependency, appendAlterComments, appendComments, appendPrivileges, canDrop, canDropBeforeCreate, checkComments, clearPrivileges, compareChildren, deepCopy, equals, fillChildrenList, fillDescendantsList, getAuthor, getBareName, getChildren, getComment, getDependencies, getDescendants, getDropSQL, getLibName, getLocation, getName, getObjectState, getObjectState, getOwner, getParent, getPrivileges, getQualifiedName, getSeparator, getSQL, getTwin, hasChildren, hashCode, isLib, setAuthor, setComment, setLibName, setLocation, setOwner, setParent, shallowCopy, toStringMethods inherited from interface org.pgcodekeeper.core.database.api.schema.IConstraint
containsColumn, getStatementType, getTableName, isPrimaryKeyMethods inherited from interface org.pgcodekeeper.core.database.api.schema.ISearchPath
getDatabase, getSchemaNameMethods inherited from interface org.pgcodekeeper.core.database.api.schema.IStatement
addDependency, appendAlterSQL, appendOwnerSQL, canDrop, canDropBeforeCreate, clearPrivileges, deepCopy, formatSql, getAuthor, getBareName, getChildren, getComment, getCreationSQL, getDependencies, getDescendants, getDropSQL, getLibName, getLocation, getName, getOwner, getParent, getPrivileges, getQualifiedName, getQuotedName, getQuoter, getRenameCommand, getSeparator, getSQL, getTwin, getTypeName, hasChildren, isLib, isOwned, quote, setComment, setLibName, setLocation, setOwner, shallowCopyMethods inherited from interface org.pgcodekeeper.core.database.api.schema.ISubElement
getContainingSchema, toObjectReference
-
Constructor Details
-
PgConstraintFk
Creates a new PostgreSQL FOREIGN KEY constraint.- Parameters:
name- constraint name
-
-
Method Details
-
getDefinition
Description copied from interface:IConstraintGets the SQL definition of this constraint.- Specified by:
getDefinitionin interfaceIConstraint- Returns:
- the constraint definition
-
getErrorCode
-
getColumns
Description copied from interface:IConstraintGets the columns involved in this constraint.- Specified by:
getColumnsin interfaceIConstraint- Overrides:
getColumnsin classPgConstraint- Returns:
- a collection of column names
-
addColumn
Adds a column to this foreign key constraint.- Parameters:
column- column name
-
addDelActCol
-
getForeignColumns
Description copied from interface:IConstraintFkGets the foreign columns referenced by this foreign key.- Specified by:
getForeignColumnsin interfaceIConstraintFk- Returns:
- a collection of foreign column names
-
addForeignColumn
Adds a referenced column in the foreign table.- Parameters:
referencedColumn- referenced column name
-
getForeignSchema
Description copied from interface:IConstraintFkGets the foreign schema containing the referenced table.- Specified by:
getForeignSchemain interfaceIConstraintFk- Returns:
- the foreign schema name
-
setForeignSchema
-
getForeignTable
Description copied from interface:IConstraintFkGets the foreign table referenced by this foreign key.- Specified by:
getForeignTablein interfaceIConstraintFk- Returns:
- the foreign table name
-
setForeignTable
-
setMatch
-
setDelAction
-
setUpdAction
-
setPeriodRefColumn
-
setPeriodColumn
-
computeHash
Description copied from interface:IHashableComputes the hash of the implementing object using the provided hasher. The implementation should call appropriateputmethods on the hasher for all fields that should contribute to the hash value.- Specified by:
computeHashin interfaceIHashable- Overrides:
computeHashin classPgConstraint- Parameters:
hasher- the hasher instance to use for hash computation
-
compare
Description copied from class:AbstractStatementThis method does not account for nested child PgStatements. Shallow version ofAbstractStatement.equals(Object)- Specified by:
comparein interfaceIStatement- Overrides:
comparein classPgConstraint
-