Package org.pgcodekeeper.core.schema
Class AbstractFunction
java.lang.Object
org.pgcodekeeper.core.schema.PgStatement
org.pgcodekeeper.core.schema.AbstractFunction
- All Implemented Interfaces:
IHashable,IFunction,ISearchPath,IStatement
- Direct Known Subclasses:
AbstractMsClrFunction,AbstractMsFunction,AbstractPgFunction
Abstract base class for database functions, procedures, and aggregates.
Provides common functionality for callable database objects across different database types.
-
Field Summary
Fields inherited from class org.pgcodekeeper.core.schema.PgStatement
GO -
Method Summary
Modifier and TypeMethodDescriptionvoidaddArgument(Argument argument) Adds an argument to this function.appendAlterSQL(PgStatement newCondition, SQLScript script) Fill script with object changes and return change typebooleanChecks if this statement can be dropped before being recreated.booleancompare(PgStatement obj) This method does not account for nested child PgStatements.voidcomputeHash(Hasher hasher) Computes the hash of the implementing object using the provided hasher.Getter forarguments.Gets the schema that contains this object.voidgetCreationSQL(SQLScript script) Generates the SQL statements needed to create this database object.Gets the return type of this function.Gets the return columns for table-valued functions.abstract booleanneedDrop(AbstractFunction newFunction) Determines whether this function needs to be dropped before creating the new version.voidsetReturns(String returns) Sets the return type of this function.Copies all object properties into a new object and leaves all its children empty.Methods inherited from class org.pgcodekeeper.core.schema.PgStatement
addAllDeps, addDep, addPrivilege, appendAlterComments, appendComments, appendOwnerSQL, canDrop, checkComments, clearPrivileges, compareChildren, deepCopy, equals, getAuthor, getBareName, getChildren, getComment, getDbType, getDeps, getDescendants, getDropSQL, getDropSQL, getLibName, getLocation, getName, getObjectState, getObjectState, getOwner, getParent, getPrivileges, getQualifiedName, getSQL, getTwin, getTypeName, hasChildren, hashCode, isLib, isOwned, isSubElement, setAuthor, setComment, setLibName, setLocation, setOwner, setParent, toStringMethods inherited from interface org.pgcodekeeper.core.schema.ISearchPath
getDatabase, getSchemaNameMethods inherited from interface org.pgcodekeeper.core.schema.IStatement
getBareName, getComment, getName, getParent, getQualifiedName, getStatementType
-
Method Details
-
getContainingSchema
Description copied from interface:ISearchPathGets the schema that contains this object.- Specified by:
getContainingSchemain interfaceISearchPath- Returns:
- the containing schema
-
getReturns
Description copied from interface:IFunctionGets the return type of this function.- Specified by:
getReturnsin interfaceIFunction- Returns:
- the return type, or null if not applicable
-
setReturns
Description copied from interface:IFunctionSets the return type of this function.- Specified by:
setReturnsin interfaceIFunction- Parameters:
returns- the return type to set
-
getReturnsColumns
Description copied from interface:IFunctionGets the return columns for table-valued functions.- Specified by:
getReturnsColumnsin interfaceIFunction- Returns:
- a map of column names to their types
-
getCreationSQL
Description copied from class:PgStatementGenerates 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 classPgStatement- Parameters:
script- the SQL script to append creation statements to
-
canDropBeforeCreate
public boolean canDropBeforeCreate()Description copied from class:PgStatementChecks if this statement can be dropped before being recreated. Override in subclasses that support drop-before-create behavior.- Overrides:
canDropBeforeCreatein classPgStatement- Returns:
- true if the statement can be dropped before recreation
-
appendAlterSQL
Description copied from class:PgStatementFill script with object changes and return change type- Specified by:
appendAlterSQLin classPgStatement- Parameters:
newCondition- new object statescript- script to collect changes- Returns:
- object change type
-
getArguments
Getter forarguments. List cannot be modified.- Specified by:
getArgumentsin interfaceIFunction- Returns:
- the list of arguments
-
addArgument
Adds an argument to this function.- Parameters:
argument- the argument to add
-
compare
Description copied from class:PgStatementThis method does not account for nested child PgStatements. Shallow version ofPgStatement.equals(Object)- Overrides:
comparein classPgStatement
-
needDrop
Determines whether this function needs to be dropped before creating the new version.- Parameters:
newFunction- the new function version to compare against- Returns:
- true if the function needs to be dropped and recreated
-
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
-
shallowCopy
Description copied from class:PgStatementCopies all object properties into a new object and leaves all its children empty.- Specified by:
shallowCopyin classPgStatement- Returns:
- shallow copy of a DB object.
-