Class JoinFragment

    • Constructor Detail

      • JoinFragment

        public JoinFragment()
    • Method Detail

      • addJoin

        public abstract void addJoin​(String tableName,
                                     String alias,
                                     String[] fkColumns,
                                     String[] pkColumns,
                                     JoinType joinType)
        Adds a join.
        Parameters:
        tableName - The name of the table to be joined
        alias - The alias to apply to the joined table
        fkColumns - The names of the columns which reference the joined table
        pkColumns - The columns in the joined table being referenced
        joinType - The type of join
      • addJoin

        public abstract void addJoin​(String tableName,
                                     String alias,
                                     String[] fkColumns,
                                     String[] pkColumns,
                                     JoinType joinType,
                                     String on)
        Adds a join, with an additional ON clause fragment
        Parameters:
        tableName - The name of the table to be joined
        alias - The alias to apply to the joined table
        fkColumns - The names of the columns which reference the joined table
        pkColumns - The columns in the joined table being referenced
        joinType - The type of join
        on - The additional ON fragment
      • addJoin

        public void addJoin​(String tableName,
                            String alias,
                            String[][] fkColumns,
                            String[] pkColumns,
                            JoinType joinType,
                            String on)
        Adds a join, with an additional ON clause fragment
        Parameters:
        tableName - The name of the table to be joined
        alias - The alias to apply to the joined table
        fkColumns - The names of the columns which reference the joined table
        pkColumns - The columns in the joined table being referenced
        joinType - The type of join
        on - The additional ON fragment
      • addCrossJoin

        public abstract void addCrossJoin​(String tableName,
                                          String alias)
        Adds a cross join to the specified table.
        Parameters:
        tableName - The name of the table to be joined
        alias - The alias to apply to the joined table
      • addJoins

        public abstract void addJoins​(String fromFragment,
                                      String whereFragment)
        Free-form form of adding theta-style joins taking the necessary FROM and WHERE clause fragments
        Parameters:
        fromFragment - The FROM clause fragment
        whereFragment - The WHERE clause fragment
      • toFromFragmentString

        public abstract String toFromFragmentString()
        Render this fragment to its FROM clause portion
        Returns:
        The FROM clause portion of this fragment
      • toWhereFragmentString

        public abstract String toWhereFragmentString()
        Render this fragment to its WHERE clause portion
        Returns:
        The WHERE clause portion of this fragment
      • addCondition

        public abstract void addCondition​(String alias,
                                          String[] fkColumns,
                                          String[] pkColumns)
        Adds a condition to the join fragment.
        Parameters:
        alias - The alias of the joined table
        fkColumns - The names of the columns which reference the joined table
        pkColumns - The columns in the joined table being referenced
      • addCondition

        public abstract boolean addCondition​(String condition)
        Adds a free-form condition fragment
        Parameters:
        condition - The fragment
        Returns:
        true if the condition was added
      • copy

        public abstract JoinFragment copy()
        Make a copy.
        Returns:
        The copy.
      • addFragment

        public void addFragment​(JoinFragment ojf)
        Adds another join fragment to this one.
        Parameters:
        ojf - The other join fragment
      • addCondition

        protected boolean addCondition​(StringBuilder buffer,
                                       String on)
        Appends the 'on' condition to the buffer, returning true if the condition was added. Returns false if the 'on' condition was empty.
        Parameters:
        buffer - The buffer to append the 'on' condition to.
        on - The 'on' condition.
        Returns:
        Returns true if the condition was added, false if the condition was already in 'on' string.
      • hasFilterCondition

        public boolean hasFilterCondition()
        True if the where fragment is from a filter condition.
        Returns:
        True if the where fragment is from a filter condition.
      • setHasFilterCondition

        public void setHasFilterCondition​(boolean b)
      • hasThetaJoins

        public boolean hasThetaJoins()
        Determine if the join fragment contained any theta-joins.
        Returns:
        true if the fragment contained theta joins
      • setHasThetaJoins

        public void setHasThetaJoins​(boolean hasThetaJoins)