Class PgCompositeType

All Implemented Interfaces:
ICompositeType, ISearchPath, IStatement, IType, IHashable

public class PgCompositeType extends PgAbstractType implements ICompositeType
PostgreSQL composite type implementation. Represents a composite type consisting of multiple attributes (fields), similar to a table row structure but used as a data type.
  • Constructor Details

    • PgCompositeType

      public PgCompositeType(String name)
      Creates a new PostgreSQL composite type.
      Parameters:
      name - type name
  • Method Details

    • appendComments

      public void appendComments(SQLScript script)
      Description copied from class: AbstractStatement
      Appends comment SQL to the script if this statement has comments.
      Overrides:
      appendComments in class AbstractStatement
      Parameters:
      script - the SQL script to append comments to
    • appendAlterComments

      public void appendAlterComments(AbstractStatement newObj, SQLScript script)
      Description copied from class: AbstractStatement
      Appends ALTER comment SQL if the comment has changed.
      Overrides:
      appendAlterComments in class AbstractStatement
      Parameters:
      newObj - the new statement to compare comments with
      script - the SQL script to append ALTER comments to
    • getAttr

      public PgColumn getAttr(String name)
      Returns an attribute by name.
      Parameters:
      name - attribute name
      Returns:
      attribute or null if not found
    • getAttrs

      public List<Pair<String,String>> getAttrs()
      Description copied from interface: ICompositeType
      Returns list of all attributes.
      Specified by:
      getAttrs in interface ICompositeType
      Returns:
      list of attributes
    • addAttr

      public void addAttr(PgColumn attr)
      Adds an attribute to this composite type.
      Parameters:
      attr - attribute to add
    • getAttrType

      public String getAttrType(String attrName)
      Description copied from interface: ICompositeType
      Returns the type of the specified attribute.
      Specified by:
      getAttrType in interface ICompositeType
      Parameters:
      attrName - the attribute name
      Returns:
      the attribute type, or null if not found
    • 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
      Parameters:
      hasher - the hasher instance to use for hash computation
    • compare

      public boolean compare(IStatement obj)
      Description copied from class: AbstractStatement
      This method does not account for nested child PgStatements. Shallow version of AbstractStatement.equals(Object)
      Specified by:
      compare in interface IStatement
      Overrides:
      compare in class AbstractStatement