Class PgDatabase
java.lang.Object
org.pgcodekeeper.core.database.base.schema.AbstractStatement
org.pgcodekeeper.core.database.pg.schema.PgAbstractStatement
org.pgcodekeeper.core.database.pg.schema.PgDatabase
- All Implemented Interfaces:
IDatabase,IStatement,IStatementContainer,IHashable
PostgreSQL database implementation.
Manages database-level objects such as schemas, extensions, event triggers,
foreign data wrappers, servers, user mappings, and casts.
- Author:
- fordfrog
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAnalysisLauncher(IAnalysisLauncher launcher) Add 'analysis launcher' for deferred analyze.voidaddChild(IStatement st) Adds a child statement to this container.voidaddOverride(ObjectOverride override) Adds object overridevoidaddReference(String fileName, ObjectLocation loc) Adds an object reference to the specified file.voidClears all analysis launchers and trims the internal list to size.booleancompare(IStatement obj) This method does not account for nested child PgStatements.booleanDeep part ofAbstractStatement.equals(Object).voidcomputeChildrenHash(Hasher hasher) voidcomputeHash(Hasher hasher) Computes the hash of the implementing object using the provided hasher.voidconcat(IStatement st) Adds library object to database with overridevoidfillChildrenList(List<Collection<? extends AbstractStatement>> l) voidfillDescendantsList(List<Collection<? extends AbstractStatement>> l) Returns cast of given name or null if the cast has not been found.Gets a child statement by name and type.getChildrenByType(DbObjType type) get all children by typegetEventTrigger(String name) getExtension(String name) Returns extension of given name or null if the extension has not been found.getForeignDW(String name) Returns foreign data wrapper of given name or null if the foreign data wrapper has not been found.Gets the list of object overrides for this database.Returns schema of given name or null if the schema has not been found.Getter forschemas.final AbstractStatementgetStatement(ObjectReference reference) voidsetDefaultSchema(String name) voidSorts columns in all tables within all schemas of this database.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, canDropBeforeCreate, checkComments, clearPrivileges, deepCopy, equals, 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.IDatabase
addLib, appendAlterSQL, containsSchema, getCreationSQL, getDatabase, getDropSQL, getStatementType, listObjectsMethods inherited from interface org.pgcodekeeper.core.database.api.schema.IStatement
addDependency, appendOwnerSQL, canDrop, canDropBeforeCreate, clearPrivileges, deepCopy, formatSql, getAuthor, getBareName, getChildren, getComment, getDependencies, getDescendants, getLibName, getLocation, getName, getOwner, getParent, getPrivileges, getQualifiedName, getQuotedName, getQuoter, getRenameCommand, getSeparator, getSQL, getTwin, getTypeName, hasChildren, isLib, isOwned, quote, setComment, setLibName, setLocation, setOwner, shallowCopy, toObjectReference
-
Constructor Details
-
PgDatabase
public PgDatabase()Creates a new PostgreSQL database.
-
-
Method Details
-
concat
Description copied from interface:IDatabaseAdds library object to database with override -
sortColumns
public void sortColumns()Sorts columns in all tables within all schemas of this database. This is used to ensure consistent column ordering in inherited tables. -
getStatement
- Specified by:
getStatementin interfaceIDatabase- Parameters:
reference- - object reference- Returns:
- object from database by reference, or null if not found
-
fillDescendantsList
- Overrides:
fillDescendantsListin classAbstractStatement
-
fillChildrenList
- Overrides:
fillChildrenListin classAbstractStatement
-
getChild
Description copied from interface:IStatementContainerGets a child statement by name and type.- Specified by:
getChildin interfaceIStatementContainer- Parameters:
name- the name of the child to findtype- the type of the child to find- Returns:
- the child statement, or null if not found
-
getChildrenByType
Description copied from interface:IStatementContainerget all children by type- Specified by:
getChildrenByTypein interfaceIStatementContainer- Parameters:
type- the type of the children- Returns:
- unmodifiable collection of child statement, or empty list
-
getSchema
Returns schema of given name or null if the schema has not been found. If schema name is null then default schema is returned. -
getDefaultSchema
- Specified by:
getDefaultSchemain interfaceIDatabase
-
setDefaultSchema
- Specified by:
setDefaultSchemain interfaceIDatabase
-
addChild
Description copied from interface:IStatementContainerAdds a child statement to this container.- Specified by:
addChildin interfaceIStatementContainer- Parameters:
st- the child statement to add
-
getExtension
Returns extension of given name or null if the extension has not been found.- Parameters:
name- extension name- Returns:
- found extension or null
-
getEventTrigger
-
getForeignDW
Returns foreign data wrapper of given name or null if the foreign data wrapper has not been found.- Parameters:
name- foreign data wrapper name- Returns:
- found foreign data wrapper or null
-
getServer
-
getCast
Returns cast of given name or null if the cast has not been found.- Parameters:
name- cast name- Returns:
- found cast or null
-
getSchemas
Getter forschemas. The list cannot be modified.- Specified by:
getSchemasin interfaceIDatabase- Returns:
schemas
-
getVersion
- Specified by:
getVersionin interfaceIDatabase- Returns:
- default database version
-
addOverride
Description copied from interface:IDatabaseAdds object override- Specified by:
addOverridein interfaceIDatabase- Parameters:
override- object override
-
getOverrides
Description copied from interface:IDatabaseGets the list of object overrides for this database.- Specified by:
getOverridesin interfaceIDatabase- Returns:
- the list of overrides
-
getObjReferences
- Specified by:
getObjReferencesin interfaceIDatabase- Returns:
- all object references for this database
-
getAnalysisLaunchers
- Specified by:
getAnalysisLaunchersin interfaceIDatabase- Returns:
- all analysis launcher for this database
-
addAnalysisLauncher
Description copied from interface:IDatabaseAdd 'analysis launcher' for deferred analyze.- Specified by:
addAnalysisLauncherin interfaceIDatabase- Parameters:
launcher- launcher that contains almost everything needed to analyze a statement contained in it
-
addReference
Description copied from interface:IDatabaseAdds an object reference to the specified file.- Specified by:
addReferencein interfaceIDatabase- Parameters:
fileName- the file name to associate with the locationloc- the object location to add
-
clearAnalysisLaunchers
public void clearAnalysisLaunchers()Clears all analysis launchers and trims the internal list to size.- Specified by:
clearAnalysisLaunchersin interfaceIDatabase
-
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
-
computeChildrenHash
-
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
-
compareChildren
Description copied from class:AbstractStatementDeep part ofAbstractStatement.equals(Object). Compares all object's child PgStatements for equality.- Overrides:
compareChildrenin classAbstractStatement
-