Class ChDatabase
java.lang.Object
org.pgcodekeeper.core.database.base.schema.AbstractStatement
org.pgcodekeeper.core.database.ch.schema.ChAbstractStatement
org.pgcodekeeper.core.database.ch.schema.ChDatabase
- All Implemented Interfaces:
IDatabase,IStatement,IStatementContainer,IHashable
Represents a ClickHouse database with its schema objects. Contains
collections of ClickHouse-specific objects like functions, policies, users,
and roles in addition to the standard schemas.
-
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.voidCopies analysis launchers from another database to this one.voidfillChildrenList(List<Collection<? extends AbstractStatement>> l) voidfillDescendantsList(List<Collection<? extends AbstractStatement>> l) Gets a child statement by name and type.getChildrenByType(DbObjType type) get all children by typeGets the list of object overrides for this database.Gets a schema by name.Collection<? extends ISchema>Gets all schemas in this database.final IStatementgetStatement(ObjectReference reference) voidsetDefaultSchema(String name) Methods inherited from class org.pgcodekeeper.core.database.ch.schema.ChAbstractStatement
appendComments, appendOwnerSQL, formatSql, getQuoter, getRenameCommandMethods inherited from class org.pgcodekeeper.core.database.base.schema.AbstractStatement
addDependency, addPrivilege, appendAlterComments, 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, concat, 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
-
ChDatabase
public ChDatabase()
-
-
Method Details
-
clearAnalysisLaunchers
public void clearAnalysisLaunchers()Description copied from interface:IDatabaseClears all analysis launchers and trims the internal list to size.- Specified by:
clearAnalysisLaunchersin interfaceIDatabase
-
getStatement
- Specified by:
getStatementin interfaceIDatabase- Parameters:
reference- - object reference- Returns:
- object from database by reference, or null if not found
-
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
-
addChild
Description copied from interface:IStatementContainerAdds a child statement to this container.- Specified by:
addChildin interfaceIStatementContainer- Parameters:
st- the child statement to add
-
getOverrides
Description copied from interface:IDatabaseGets the list of object overrides for this database.- Specified by:
getOverridesin interfaceIDatabase- Returns:
- the list of overrides
-
getVersion
- Specified by:
getVersionin interfaceIDatabase- Returns:
- default database version
-
getObjReferences
- Specified by:
getObjReferencesin interfaceIDatabase- Returns:
- all object references for this database
-
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
-
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
-
fillDescendantsList
- Overrides:
fillDescendantsListin classAbstractStatement
-
setDefaultSchema
- Specified by:
setDefaultSchemain interfaceIDatabase
-
getDefaultSchema
- Specified by:
getDefaultSchemain interfaceIDatabase
-
getSchemas
Description copied from interface:IDatabaseGets all schemas in this database.- Specified by:
getSchemasin interfaceIDatabase- Returns:
- a collection of schemas
-
getSchema
Description copied from interface:IDatabaseGets a schema by name. -
addOverride
Description copied from interface:IDatabaseAdds object override- Specified by:
addOverridein interfaceIDatabase- Parameters:
override- object override
-
copyLaunchers
Copies analysis launchers from another database to this one.- Parameters:
db- the database to copy launchers from
-
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
-