Class FromClause

  • All Implemented Interfaces:
    StatementTreeObject, java.io.Serializable, java.lang.Cloneable

    public final class FromClause
    extends java.lang.Object
    implements java.io.Serializable, StatementTreeObject, java.lang.Cloneable
    A container for the From clause of a select statement. This handles the different types of joins.
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.ArrayList all_table_names
      A list of all table names in this from clause.
      private java.util.ArrayList def_list
      A list of all FromTableDef objects in this clause in order of when they were specified.
      private JoiningSet join_set
      The JoiningSet object that we have created to represent the joins in this FROM clause.
      (package private) static long serialVersionUID  
      private int table_key
      An id used for making unique names for anonymous inner selects.
    • Constructor Summary

      Constructors 
      Constructor Description
      FromClause()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addJoin​(int type)
      Adds a Join to the from clause.
      void addJoin​(int type, Expression on_expression)
      Adds a Join to the from clause.
      void addPreviousJoin​(int type, Expression on_expression)
      Hack, add a joining type to the previous entry from the end.
      void addTable​(java.lang.String table_name)
      Adds a table name to this FROM clause.
      void addTable​(java.lang.String table_name, java.lang.String table_alias)
      Adds a table name + alias to this FROM clause.
      void addTableDeclaration​(java.lang.String table_name, TableSelectExpression select, java.lang.String table_alias)
      A generic form of a table declaration.
      private void addTableDef​(java.lang.String table_name, FromTableDef def)  
      java.util.Collection allTables()
      Returns a Set of FromTableDef objects that represent all the tables that are in this from clause.
      java.lang.Object clone()
      Performs a DEEP clone of this object if it is mutable, or a deep clone of its mutable members.
      private java.lang.String createNewKey()
      Creates a new unique key string.
      JoiningSet getJoinSet()
      Returns the JoiningSet object for the FROM clause.
      int getJoinType​(int n)
      Returns the type of join after table 'n' in the set of tables in the from clause.
      Expression getOnExpression​(int n)
      Returns the ON Expression for the type of join after table 'n' in the set.
      void prepareExpressions​(ExpressionPreparer preparer)
      Prepares all expressions in this statement tree object by passing the ExpressionPreparer object to the 'prepare' method of the expression.
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • join_set

        private JoiningSet join_set
        The JoiningSet object that we have created to represent the joins in this FROM clause.
      • def_list

        private java.util.ArrayList def_list
        A list of all FromTableDef objects in this clause in order of when they were specified.
      • all_table_names

        private java.util.ArrayList all_table_names
        A list of all table names in this from clause.
      • table_key

        private int table_key
        An id used for making unique names for anonymous inner selects.
    • Constructor Detail

      • FromClause

        public FromClause()
    • Method Detail

      • createNewKey

        private java.lang.String createNewKey()
        Creates a new unique key string.
      • addTableDef

        private void addTableDef​(java.lang.String table_name,
                                 FromTableDef def)
      • addTable

        public void addTable​(java.lang.String table_name)
        Adds a table name to this FROM clause. Note that the given name may be a dot deliminated ref such as (schema.table_name).
      • addTable

        public void addTable​(java.lang.String table_name,
                             java.lang.String table_alias)
        Adds a table name + alias to this FROM clause.
      • addTableDeclaration

        public void addTableDeclaration​(java.lang.String table_name,
                                        TableSelectExpression select,
                                        java.lang.String table_alias)
        A generic form of a table declaration. If any parameters are 'null' it means the information is not available.
      • addJoin

        public void addJoin​(int type)
        Adds a Join to the from clause. 'type' must be a join type as defined in JoiningSet.
      • addPreviousJoin

        public void addPreviousJoin​(int type,
                                    Expression on_expression)
        Hack, add a joining type to the previous entry from the end. This is an artifact of how joins are parsed.
      • addJoin

        public void addJoin​(int type,
                            Expression on_expression)
        Adds a Join to the from clause. 'type' must be a join type as defined in JoiningSet, and expression represents the ON condition.
      • getJoinSet

        public JoiningSet getJoinSet()
        Returns the JoiningSet object for the FROM clause.
      • getJoinType

        public int getJoinType​(int n)
        Returns the type of join after table 'n' in the set of tables in the from clause. Returns, JoiningSet.INNER_JOIN, JoiningSet.FULL_OUTER_JOIN, etc.
      • getOnExpression

        public Expression getOnExpression​(int n)
        Returns the ON Expression for the type of join after table 'n' in the set.
      • allTables

        public java.util.Collection allTables()
        Returns a Set of FromTableDef objects that represent all the tables that are in this from clause.
      • clone

        public java.lang.Object clone()
                               throws java.lang.CloneNotSupportedException
        Description copied from interface: StatementTreeObject
        Performs a DEEP clone of this object if it is mutable, or a deep clone of its mutable members. If the object is immutable then it may return 'this'.
        Specified by:
        clone in interface StatementTreeObject
        Overrides:
        clone in class java.lang.Object
        Throws:
        java.lang.CloneNotSupportedException