Class PgRule
java.lang.Object
org.pgcodekeeper.core.database.base.schema.AbstractStatement
org.pgcodekeeper.core.database.pg.schema.PgAbstractStatement
org.pgcodekeeper.core.database.pg.schema.PgRule
- All Implemented Interfaces:
IRule,ISearchPath,IStatement,ISubElement,IHashable
PostgreSQL table rule implementation.
Rules define actions to be performed when certain operations (INSERT, UPDATE, DELETE)
are executed on a table, effectively implementing view-like behavior and query rewriting.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCommand(String command) Adds an action command to be executed when this rule fires.appendAlterSQL(IStatement newCondition, SQLScript script) Fill script with object changes and return change typevoidbooleanChecks if this statement can be dropped before being recreated.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.voidgetCreationSQL(SQLScript script) Generates the SQL statements needed to create this database object.voidsetCondition(String condition) voidsetEnabledState(String enabledState) voidvoidsetInstead(boolean instead) Methods 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, checkComments, clearPrivileges, compareChildren, deepCopy, equals, fillChildrenList, fillDescendantsList, getAuthor, getBareName, getChildren, getComment, getDependencies, getDescendants, getDropSQL, 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.IRule
getStatementTypeMethods inherited from interface org.pgcodekeeper.core.database.api.schema.ISearchPath
getDatabase, getSchemaNameMethods inherited from interface org.pgcodekeeper.core.database.api.schema.IStatement
addDependency, appendOwnerSQL, canDrop, clearPrivileges, deepCopy, formatSql, getAuthor, getBareName, getChildren, getComment, 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
-
PgRule
Creates a new PostgreSQL rule.- Parameters:
name- rule name
-
-
Method Details
-
getCreationSQL
Description copied from interface:IStatementGenerates the SQL statements needed to create this database object. This is an abstract method that must be implemented by subclasses to provide the specific CREATE SQL for each object type.- Specified by:
getCreationSQLin interfaceIStatement- Parameters:
script- the SQL script to append creation statements to
-
appendAlterSQL
Description copied from interface:IStatementFill script with object changes and return change type- Specified by:
appendAlterSQLin interfaceIStatement- Parameters:
newCondition- new object statescript- script to collect changes- Returns:
- object change type
-
appendFullName
-
canDropBeforeCreate
public boolean canDropBeforeCreate()Description copied from interface:IStatementChecks if this statement can be dropped before being recreated. Override in subclasses that support drop-before-create behavior.- Specified by:
canDropBeforeCreatein interfaceIStatement- Overrides:
canDropBeforeCreatein classAbstractStatement- Returns:
- true if the statement can be dropped before recreation
-
setEvent
-
setCondition
-
setInstead
public void setInstead(boolean instead) -
addCommand
Adds an action command to be executed when this rule fires.- Parameters:
command- SQL command to execute
-
setEnabledState
-
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- 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 classAbstractStatement
-