Class ChPolicy

All Implemented Interfaces:
IHashable, IStatement

public final class ChPolicy extends AbstractPolicy
Represents a ClickHouse row-level security policy. Supports role-based access control with EXCEPT clauses for role exclusions.
  • Constructor Details

    • ChPolicy

      public ChPolicy(String name)
      Creates a new ClickHouse policy with the specified name.
      Parameters:
      name - the name of the policy
  • Method Details

    • addExcept

      public void addExcept(String except)
      Adds a role to the EXCEPT list for this policy.
      Parameters:
      except - the role name to exclude
    • getCreationSQL

      public void getCreationSQL(SQLScript script)
      Description copied from class: PgStatement
      Generates 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:
      getCreationSQL in class PgStatement
      Parameters:
      script - the SQL script to append creation statements to
    • appendAlterSQL

      public ObjectState appendAlterSQL(PgStatement newCondition, SQLScript script)
      Description copied from class: PgStatement
      Fill script with object changes and return change type
      Specified by:
      appendAlterSQL in class PgStatement
      Parameters:
      newCondition - new object state
      script - script to collect changes
      Returns:
      object change type
    • getQualifiedName

      public String getQualifiedName()
      Description copied from interface: IStatement
      Gets the fully qualified name of this statement.
      Specified by:
      getQualifiedName in interface IStatement
      Overrides:
      getQualifiedName in class PgStatement
      Returns:
      fully qualified (up to schema) dot-delimited object name. Identifiers are quoted.
    • computeHash

      public void computeHash(Hasher hasher)
      Description copied from interface: IHashable
      Computes the hash of the implementing object using the provided hasher. The implementation should call appropriate put methods on the hasher for all fields that should contribute to the hash value.
      Specified by:
      computeHash in interface IHashable
      Overrides:
      computeHash in class AbstractPolicy
      Parameters:
      hasher - the hasher instance to use for hash computation
    • compare

      public boolean compare(PgStatement obj)
      Description copied from class: PgStatement
      This method does not account for nested child PgStatements. Shallow version of PgStatement.equals(Object)
      Overrides:
      compare in class AbstractPolicy
    • getDbType

      public DatabaseType getDbType()
      Overrides:
      getDbType in class PgStatement
    • getDatabase

      public AbstractDatabase getDatabase()
      Description copied from interface: IStatement
      Gets the database that contains this statement.
      Returns:
      the containing database