Package org.pgcodekeeper.core.schema.ch
Class ChView
java.lang.Object
org.pgcodekeeper.core.schema.PgStatement
org.pgcodekeeper.core.schema.PgStatementContainer
org.pgcodekeeper.core.schema.AbstractView
org.pgcodekeeper.core.schema.ch.ChView
- All Implemented Interfaces:
IHashable,IRelation,ISearchPath,IStatement,IStatementContainer
Represents a ClickHouse view (VIEW, MATERIALIZED VIEW, or LIVE VIEW).
Supports various ClickHouse-specific view features like refresh periods, engines, and security settings.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumEnumeration of ClickHouse view types. -
Field Summary
Fields inherited from class org.pgcodekeeper.core.schema.PgStatement
GO -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a column definition to this view.appendAlterSQL(PgStatement newCondition, SQLScript script) Fill script with object changes and return change typevoidappendComments(SQLScript script) Appends comment SQL to the script if this statement has comments.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.voidgetCreationSQL(SQLScript script) Generates the SQL statements needed to create this database object.voidsetDefiner(String definer) voidsetDestination(String destination) voidvoidSets the query and normalized query for this view.voidsetRefreshPeriod(int refreshPeriod) voidsetSqlSecurity(String sqlSecurity) voidsetType(ChView.ChViewType type) voidsetWithRefresh(boolean isWithRefresh) Methods inherited from class org.pgcodekeeper.core.schema.AbstractView
addConstraint, getConstraint, getConstraints, getRelationColumns, getStatementTypeMethods inherited from class org.pgcodekeeper.core.schema.PgStatementContainer
addChild, addIndex, addPolicy, addRule, addTrigger, compareChildren, computeChildrenHash, getChild, getContainingSchema, getIndex, getIndexes, getPolicies, getPolicy, getRule, getRules, getTrigger, getTriggers, isClustered, shallowCopyMethods inherited from class org.pgcodekeeper.core.schema.PgStatement
addAllDeps, addDep, addPrivilege, appendAlterComments, appendOwnerSQL, canDrop, canDropBeforeCreate, checkComments, clearPrivileges, deepCopy, equals, getAuthor, getBareName, getChildren, getComment, 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
-
Constructor Details
-
ChView
Creates a new ClickHouse view with the specified name.- Parameters:
name- the name of the view
-
-
Method Details
-
setType
-
setQuery
Sets the query and normalized query for this view.- Parameters:
query- the original query textnormalizedQuery- the normalized query text for comparison
-
setRefreshPeriod
public void setRefreshPeriod(int refreshPeriod) -
setWithRefresh
public void setWithRefresh(boolean isWithRefresh) -
addColumn
Adds a column definition to this view.- Parameters:
column- the column to add
-
setEngine
-
setDefiner
-
setSqlSecurity
-
setDestination
-
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
-
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
-
getDbType
- Overrides:
getDbTypein classPgStatement
-
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.- Parameters:
hasher- the hasher instance to use for hash computation
-
compare
Description copied from class:PgStatementThis method does not account for nested child PgStatements. Shallow version ofPgStatement.equals(Object)- Overrides:
comparein classAbstractView
-
appendComments
Description copied from class:PgStatementAppends comment SQL to the script if this statement has comments.- Overrides:
appendCommentsin classPgStatement- Parameters:
script- the SQL script to append comments to
-