Class TJoin

All Implemented Interfaces:
Visitable, Iterator<TSourceToken>

public class TJoin extends TNodeWithAliasClause
Deprecated.
As of v2.7.4.0, Please use TJoinExpr instead. A list of join TCustomSqlStatement.joins represents table sources in following clauses of SQL statement:
  • from clause of select statement.
  • from clause of delete statement, Specifies an additional FROM clause, This Transact-SQL extension to DELETE allows specifying data from table_source and deleting the corresponding rows from the table in the first FROM clause.
  • from clause of update statement, Specifies that a table, view, or derived table source is used to provide the criteria for the update operation.

Each table source in from clause was treated as a join which is type of TJoin.
The reason for this design is that we can treat all table sources in from clause in a uniform way.
  • Constructor Details

    • TJoin

      public TJoin()
      Deprecated.
  • Method Details

    • setNestedParen

      public void setNestedParen(int nestedParen)
      Deprecated.
    • getNestedParen

      public int getNestedParen()
      Deprecated.
    • setWithParen

      public void setWithParen(boolean withParen)
      Deprecated.
    • isWithParen

      public boolean isWithParen()
      Deprecated.
    • setJoinItems

      public void setJoinItems(TJoinItemList joinItems)
      Deprecated.
    • setJoin

      public void setJoin(TJoin join)
      Deprecated.
    • setTable

      public void setTable(TTable table)
      Deprecated.
    • setKind

      public void setKind(int kind)
      Deprecated.
    • getJoinItems

      Deprecated.
      List of joinItems.

      SQL 1:

      select f from t1 left join t2 on t1.f1 = t2.f1 right join t3 on t1.f1 = t3.f1
      Text in Item 0 will be: left join t2 on t1.f1 = t2.f1

      Text in Item 1 will be: right join t3 on t1.f1 = t3.f1

      Check TJoinItem to see how information was organized.

      Returns:
    • getJoin

      public TJoin getJoin()
      Deprecated.
      Returns:
      this join start with another join( (a as a_alias left join a1 on a1.f1 = a_alias.f1) as a_join ) in SQL:
      select a_join.f1 from (a as a_alias left join a1 on a1.f1 = a_alias.f1) as a_join join b on a_join.f1 = b.f1;
    • getTable

      public TTable getTable()
      Deprecated.
      Returns:
      this join start with a table(t1) in SQL:
      select f from t1 join t2 on t1.f1 = t2.f1
    • getKind

      public int getKind()
      Deprecated.
      According to the table source in from clause, there are 3 kinds of join.
      • TBaseType.join_source_fake, it's a fake join like
        select f from t1
        the whole from clause was represented by this class, you can get text representation of this from clause by using toString() method, it returns "t1" . and table t1 can be fetch from getTable().
      • TBaseType.join_source_table,
        select f from t1 join t2 on t1.f1 = t2.f1
        the whole from clause was represented by this class, you can get text representation of this from clause by using toString() method, it returns "t1 join t2 on t1.f1 = t2.f1". t1 can be fetch from getTable().
      • TBaseType.join_source_join,
        select a_join.f1 from (a as a_alias left join a1 on a1.f1 = a_alias.f1) as a_join join b on a_join.f1 = b.f1;
        the whole from clause was represented by this class, you can get text representation of this from clause by using toString() method, it returns "(a as a_alias left join a1 on a1.f1 = a_alias.f1) as a_join join b on a_join.f1 = b.f1".

        (a as a_alias left join a1 on a1.f1 = a_alias.f1) can be fetched from getJoin().

      Returns:
    • getAliasClause

      Deprecated.
      Overrides:
      getAliasClause in class TNodeWithAliasClause
      Returns:
      alias of getJoin(), valid only when = TBaseType#join_source_join. In this SQL, alias is "as a_join"
      select a_join.f1 from (a as a_alias left join a1 on a1.f1 = a_alias.f1) as a_join join b on a_join.f1 = b.f1;

      But in this SQL, alias is null, "as t1" is the alias of t1.

       select f from t as t1 join t2 on t1.f1 = t2.f1
    • accept

      public void accept(TParseTreeVisitor v)
      Deprecated.
      Description copied from class: TParseTreeNode
      Accept a visitor
      Specified by:
      accept in interface Visitable
      Overrides:
      accept in class TParseTreeNode
      Parameters:
      v - visitor is a descendant class of TParseTreeVisitor
    • acceptChildren

      Deprecated.
      Description copied from class: TParseTreeNode
      Accept a visitor to iterate this class and sub-nodes of this class
      Specified by:
      acceptChildren in interface Visitable
      Overrides:
      acceptChildren in class TParseTreeNode
      Parameters:
      v - visitor is a descendant class of TParseTreeVisitor