public class TAttributeNode extends gudusoft.gsqlparser.compiler.TSymbol
TTable.getAttributes()
来获取。
如果SQLEnv 中没有查找 table1 的定义,则创建一个 star column TAttributeNode, 形如 table1.*
例如:子查询
select column1 from (select c1,c2 from table1) t1
针对上例中的 t1 子查询, GSP 会创建两个 TAttributeNode,对应 t1.c1, t1.c2
针对其他类型的 table, 也做类似处理。为 SQL 中的每个 table 准备好 TAttributeNode 列表,
在接下来的分析中,SQL 语句中出现的 column 引用都应该能找到对应的来源表和 TAttributeNode
相关的属性
getName()
, 字段名,不带前缀。
getTable_ref()
, 该字段对应的 table,每个在 SQL 语句中出现的 table 都有对应的 TTable
对象。
getSqlColumn()
, 如果在 SQLEnv 中找到该 table 的定义,这个方法返回数据库中定义的字段、
getSubLevelResultColumn()
, 如果 table 类型为子查询,该方法返回子查询 select list 中的 TResultColumn
对象,为该字段的数据来源。
或者是 values() 中的 result column。Constructor and Description |
---|
TAttributeNode(String n,
TTable table) |
TAttributeNode(String n,
TTable table,
TColumnDefinition columnDef,
TResultColumn resultColumn) |
TAttributeNode(String n,
TTable table,
TResultColumn attribute) |
TAttributeNode(String n,
TTable table,
TResultColumn attribute,
int index) |
TAttributeNode(String n,
TTable table,
TSQLColumn columnDef) |
TAttributeNode(String n,
TTable table,
TSQLColumn columnDef,
TResultColumn attribute) |
TAttributeNode(String n,
TTable table,
TSQLColumn columnDef,
TResultColumn attribute,
int index) |
Modifier and Type | Method and Description |
---|---|
static boolean |
addAllNodesToList(ArrayList<TAttributeNode> nodes,
ArrayList<TAttributeNode> list) |
void |
addAttributeRefToThisNode(TObjectName objectName)
把关联上的 column 加入到 attributeNode 中来。
另外,如果这个 attributeNode 的源来自 sub-query 中的 select list 的 star column,
那么把这个 column 加到 star column 中来,完成自顶向下的数据传递,
|
static boolean |
addNodeToList(TAttributeNode node,
ArrayList<TAttributeNode> list) |
boolean |
equals(Object o) |
ArrayList<TAttributeNode> |
getAccompaniedAttributeNodes() |
TColumnDefinition |
getColumnDefinition() |
int |
getIndex() |
String |
getLastPartOfName() |
String |
getName() |
TSQLColumn |
getSqlColumn() |
TResultColumn |
getStructResultColumn() |
TResultColumn |
getSubLevelResultColumn() |
TTable |
getTable_ref() |
int |
hashCode() |
String |
toString() |
public TAttributeNode(String n, TTable table, TColumnDefinition columnDef, TResultColumn resultColumn)
public TAttributeNode(String n, TTable table)
public TAttributeNode(String n, TTable table, TSQLColumn columnDef)
public TAttributeNode(String n, TTable table, TResultColumn attribute)
public TAttributeNode(String n, TTable table, TSQLColumn columnDef, TResultColumn attribute)
public TAttributeNode(String n, TTable table, TResultColumn attribute, int index)
public TAttributeNode(String n, TTable table, TSQLColumn columnDef, TResultColumn attribute, int index)
public static boolean addNodeToList(TAttributeNode node, ArrayList<TAttributeNode> list)
public static boolean addAllNodesToList(ArrayList<TAttributeNode> nodes, ArrayList<TAttributeNode> list)
public ArrayList<TAttributeNode> getAccompaniedAttributeNodes()
public TResultColumn getStructResultColumn()
public TColumnDefinition getColumnDefinition()
public TResultColumn getSubLevelResultColumn()
public TSQLColumn getSqlColumn()
public void addAttributeRefToThisNode(TObjectName objectName)
objectName
- public int getIndex()
public String getLastPartOfName()
public TTable getTable_ref()