Package gudusoft.gsqlparser.nodes
Class TJoinExpr
Object
gudusoft.gsqlparser.nodes.TParseTreeNode
gudusoft.gsqlparser.nodes.TNodeWithAliasClause
gudusoft.gsqlparser.nodes.TJoinExpr
- All Implemented Interfaces:
IRelation,Visitable,Iterator<TSourceToken>
Represents a JOIN expression in SQL statements. This class replaces
TJoin as of version 2.7.4.0.
A JOIN expression consists of:
- A left table/subquery (
getLeftTable()) - A right table/subquery (
getRightTable()) - A join type (
getJointype()) - e.g. INNER, LEFT, RIGHT, FULL, CROSS - An optional ON condition (
getOnCondition()) - Optional USING columns (
getUsingColumns())
For nested joins, the left and right operands can themselves be JOIN expressions,
allowing representation of complex join trees. Use getLeftMostJoinExpr() to
traverse to the leftmost join in a nested structure.
PostgreSQL-specific: Supports USING clause aliases via getJoin_using_alias().
The class implements IRelation and maintains a list of available attributes
from both sides of the join via getAttributes().
Represents join table in parse tree.
-
Field Summary
FieldsModifier and TypeFieldDescriptionon condition;using (column list)Fields inherited from class gudusoft.gsqlparser.nodes.TParseTreeNode
dbvendor, doubleLinkedTokenListToString, nodeActionAppend, nodeActionInsert, nodeActionRemove, nodeActionUnknown, nodeActionUpdate, nodeActionUpdateText, nodeChangeEndToken, nodeChangeStartToken -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAccept a visitorvoidAccept a visitor to iterate this class and sub-nodes of this class每个 relation 包含的 attributes 当它为 base table 时,这些 attributes 的来源有三种可能 1.Postgres: USING ( join_column [, ...] ) [ AS join_using_alias ]This method is used by parser, do not use it in your code.intThis method is used by parser, do not use it in your code.voidvoidInitialize a query tree node.voidvoidinitAttributes(int roundNo) voidsetJoinCondition(TDummy pDummy) voidsetJoinCondition(TExpression onCondition) voidsetJointype(EJoinType jointype) voidsetLeftOperand(TFromTable leftOperand) This method is used by parser, do not use it in your code.voidsetLeftTable(TTable leftTable) voidsetMatchCondition(TExpression matchCondition) voidsetNestedParen(int nestedParen) voidsetOnCondition(TExpression onCondition) voidsetRightOperand(TFromTable rightOperand) This method is used by parser, do not use it in your code.voidsetRightTable(TTable rightTable) voidsetUsingColumns(TObjectNameList usingColumns) intsize()Methods inherited from class gudusoft.gsqlparser.nodes.TNodeWithAliasClause
getAliasClause, setAliasClause, toStringMethods inherited from class gudusoft.gsqlparser.nodes.TParseTreeNode
addAllMyTokensToTokenList, addToTokenChain, appendNewNode, calculateTokenCount, doAppendNewNode, doParse, fastSetString, getAnchorNode, getColumnNo, getCommentAfterNode, getCommentBeforeNode, getCompactString, getDummyTag, getEndToken, getEvaluateDatatype, getEvalValue, getGsqlparser, getLineNo, getLocation, getMd5, getNodeStatus, getNodeType, getParentObjectName, getPlainText, getStartToken, getTokenCount, hasNext, init, init, init, init, insertAfterAToken, insertNewNodeBeforeMe, isChanged, isTokensInChain, next, refreshAllNodesTokenCount, remove, removeAllMyTokensFromTokenList, removeTokens, removeTokensBetweenNodes, removeTokensBetweenToken, replaceWithNewNode, resetIterator, setAnchorNode, setChanged, setDummyTag, setEndToken, setEndToken, setEndToken, setEndToken, setEndToken, setEndTokenDirectly, setEvaluateDatatype, setEvalValue, setGsqlparser, setIncludingComment, setLocation, setNewSubNode, setNodeStatus, setNodeType, setParent, setPlainText, setStartToken, setStartToken, setStartToken, setStartToken, setStartTokenDirectly, setString, setString2, subNodeInNode, toScript, toString2Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Iterator
forEachRemaining
-
Field Details
-
usingColumns
using (column list) -
onCondition
on condition; -
original_jontype
-
-
Constructor Details
-
TJoinExpr
public TJoinExpr()
-
-
Method Details
-
getJoin_using_alias
Postgres: USING ( join_column [, ...] ) [ AS join_using_alias ]- Returns:
-
initAttributes
-
getAttributes
Description copied from interface:IRelation每个 relation 包含的 attributes 当它为 base table 时,这些 attributes 的来源有三种可能 1. 来自数据库的 metadata,第一次 resolve 时就可以获取,来自 sqlenv 2. 来自 create table ddl,第一次 resolve 时就可以获取,来自 sqlenv 3. 来自 sql script,第二次 resolve 时,来自relation的 referenceAttribute 属性。 第一、二中来源是可靠的来源,attributes应该是完整的,第三种推断自 sql script,attributes很可能是不完整的。- Specified by:
getAttributesin interfaceIRelation- Returns:
-
getRelationName
- Specified by:
getRelationNamein interfaceIRelation
-
size
-
setLeftTable
-
setRightTable
-
getLeftTable
-
getRightTable
-
incNestedParen
-
getNestedParen
-
getUsingColumns
-
getOnCondition
-
getJointype
-
setJointype
-
getLeftOperand
This method is used by parser, do not use it in your code. After parsing, you can use getLeftTable() instead. -
getRightOperand
This method is used by parser, do not use it in your code. After parsing, you can use getRightTable() instead. -
setLeftOperand
This method is used by parser, do not use it in your code. After parsing, you can use setLeftTable() instead. -
setRightOperand
This method is used by parser, do not use it in your code. After parsing, you can use setRightTable() instead. -
init
Description copied from class:TParseTreeNodeInitialize a query tree node. Used internally- Overrides:
initin classTParseTreeNode- Parameters:
arg1- first argument
-
init
- Overrides:
initin classTParseTreeNode
-
setJoinCondition
-
setJoinCondition
-
getLeftMostJoinExpr
-
setNestedParen
-
setUsingColumns
-
setOnCondition
-
getMatchCondition
-
setMatchCondition
-
accept
Description copied from class:TParseTreeNodeAccept a visitor- Specified by:
acceptin interfaceVisitable- Overrides:
acceptin classTParseTreeNode- Parameters:
v- visitor is a descendant class ofTParseTreeVisitor
-
acceptChildren
Description copied from class:TParseTreeNodeAccept a visitor to iterate this class and sub-nodes of this class- Specified by:
acceptChildrenin interfaceVisitable- Overrides:
acceptChildrenin classTParseTreeNode- Parameters:
v- visitor is a descendant class ofTParseTreeVisitor
-