public class TObjectName extends TParseTreeNode implements Cloneable
The general syntax of database object in Oracle: [schema.]object[.part][@dblink]
The general syntax of database object in SQL Server: [server.][database.][schema.]object
The meaning of getObjectToken() and getPartToken() depends on the getDbObjectType().
If this database object is a schema object such as table, index, then the objectToken represents this
database object and partToken is null.
If this TObjectName represents a column, the partToken represents the column name, the objectToken is table/view
name of this column if this column is qualified like table.column, otherwise, the objectToken is
null.
schemaToken, databaseToken, serverToken is the qualified part of a database object name.
If this objectName represents a database name in the create database statement like this
CREATE DATABASE menagerie, then, the objectToken is menagerie and databaseToken is null.
EDbObjectType| Modifier and Type | Field and Description |
|---|---|
int |
searchLevel
Internal use only
|
static int |
ttobjAttribute
Deprecated.
replaced by
EDbObjectType.
attribute name is in partToken |
static int |
ttobjColumn
Deprecated.
replaced by
EDbObjectType.
column in table, objectToken is table if specified, and partToken is column name. |
static int |
ttobjColumnAlias
Deprecated.
replaced by
EDbObjectType.
column alias in objectToken. |
static int |
ttobjColumnMethod
Deprecated.
replaced by
EDbObjectType.method.
column method like SetXY below, column method in methodToken, and colomn name in partToken.
UPDATE Cities SET Location.SetXY(23.5, 23.5) |
static int |
ttobjConstraintName
Deprecated.
replaced by
EDbObjectType.constraint.
constraint name in objectToken |
static int |
ttobjDatatype
Deprecated.
replaced by
EDbObjectType.
datatype was not represented by a TObjectName object, this constant was used in source tokens that consist of TTypeName. |
static int |
ttobjFunctionName
Deprecated.
replaced by
EDbObjectType.
function name in objectToken |
static int |
ttobjNamedArgParameter
Named argument parameter name in function calls.
|
static int |
ttobjNotAObject
Deprecated.
replaced by
EDbObjectType.
this is not an object, like sysdate function in oracle database |
static int |
ttobjParameter
Deprecated.
replaced by
EDbObjectType.
parameter name in objectToken. |
static int |
ttobjPositionalParameters
Deprecated.
replaced by
EDbObjectType.
postgresql
Positional Parameters, $1, $1[1], $1[1,10]
parameter name is in partToken of $1,
and parameter name is in objectToken of $1.columnName,
and column name is in partToken |
static int |
ttobjSchemaName
Deprecated.
replaced by
EDbObjectType.
schema name in schemaToken |
static int |
ttobjStringConstant
Deprecated.
replaced by
EDbObjectType.
string constant in objectToken |
static int |
ttobjTable
Deprecated.
replaced by
EDbObjectType.
table name in objectToken. |
static int |
ttobjUnknown
Deprecated.
replaced by
EDbObjectType.
object type can't be determined. |
static int |
ttobjVariable
Deprecated.
replaced by
EDbObjectType.
variable name in objectToken. |
dbvendor, doubleLinkedTokenListToString, nodeActionAppend, nodeActionInsert, nodeActionRemove, nodeActionUnknown, nodeActionUpdate, nodeActionUpdateText, nodeChangeEndToken, nodeChangeStartToken| Constructor and Description |
|---|
TObjectName() |
| Modifier and Type | Method and Description |
|---|---|
void |
accept(TParseTreeVisitor v)
Accept a visitor
|
void |
acceptChildren(TParseTreeVisitor v)
Accept a visitor to iterate this class and sub-nodes of this class
|
void |
appendObjectName(TObjectName objectName) |
void |
attributesToPropertyToken(TObjectNameList attributes)
used in Oracle and teradata SQL syntax
|
TObjectName |
clone() |
void |
columnToProperty() |
String |
coordinate()
The X and Y position of this objectName in the SQL
|
static TObjectName |
createObjectName(EDbVendor dbVendor,
EDbObjectType dbObjectType) |
static TObjectName |
createObjectName(EDbVendor dbVendor,
EDbObjectType dbObjectType,
String str) |
static TObjectName |
createObjectName(EDbVendor dbVendor,
EDbObjectType dbObjectType,
TSourceToken token1) |
static TObjectName |
createObjectName(EDbVendor dbVendor,
EDbObjectType dbObjectType,
TSourceToken token1,
TSourceToken token2) |
static TObjectName |
createObjectName(EDbVendor dbVendor,
EDbObjectType dbObjectType,
TSourceToken token1,
TSourceToken token2,
TSourceToken token3) |
static TObjectName |
createObjectName(EDbVendor dbVendor,
EDbObjectType dbObjectType,
TSourceToken token1,
TSourceToken token2,
TSourceToken token3,
TSourceToken token4) |
List<TSourceToken> |
getAdditionalParts()
Get additional parts beyond the standard 6 tokens.
|
String |
getAnsiCatalogName()
If a table name is not qualified with a database name, but GSP detect the database for this table in the metadata
then, this method will return this detected database name.
|
String |
getAnsiSchemaName()
In this SQL: select * from part1.part2,
In Hive, MySQL and Teradata, part1 will be treated as a database name, returned in getDatabaseString(),
while getSchemaString() return empty string.
|
TSourceToken |
getAtsign() |
ArrayList<TAttributeNode> |
getAttributeNodesDerivedFromFromClause()
这个属性只有当 column 为 * 时有效
当 column 为 * 时, 本属性包含该 * 展开后对应的 attributeNode 列表,来源是 FROM CLAUSE中的 tables, 在 resolve star column
时给本属性赋值, TStmtScope.resolve(TObjectName objectName)
当 table 有metadata或DDL给出了明确的字段时,每table个展开的 attributeNode 包含明确的字段名,such as t.c
当 table 没有 metadata 和 DDL 时,每table个只展开的 一个 attributeNode,内容为 t.*
|
ArrayList<TColumnTableMatch> |
getCandidateAttributeNodes()
非 star column 使用该属性存放可能包含该 column 的 attributeNode
star column 使用
getAttributeNodesDerivedFromFromClause() |
Map<TTable,Integer> |
getCandidateTableDdlStatus()
Get DDL verification status for all candidate tables.
|
TTableList |
getCandidateTables() |
List<TTable> |
getCandidateTables2()
Get all candidate tables (for ambiguous columns)
|
TObjectNameList |
getColumnAttributes()
The data type of this column is structured UDT, this method returns the column's attributes.
|
String |
getColumnNameOnly()
Returns only the column name if it's prefixed with a table name
|
long |
getColumnNo()
The column position of this objectName in the SQL
|
TResultColumnList |
getColumnsLinkedToStar()
if this is a star column(column name is *), and the value of this star column
is derived from a subquery, then, this field points to the select list in the subquery
|
ArrayList<String> |
getColumnsLinkedToStarColumn() |
ColumnSource |
getColumnSource()
Convenience method: get column source (most common access pattern)
|
TSourceToken |
getColumnToken()
|
TSourceToken |
getCommentString() |
String |
getDatabaseString()
String text of the database name
|
TSourceToken |
getDatabaseToken()
The database part of this objectName: [server.][database.][schema.]object
|
TObjectName |
getDblink()
The database link part
remoreserver in this objectName: scott.emp@remoreserver |
EDbObjectType |
getDbObjectType()
The database object type of this objectName such as table, view, column for example.
|
int |
getDdlVerificationStatus(TTable table)
Check DDL verification status for a candidate table.
|
TExceptReplaceClause |
getExceptReplaceClause() |
TSourceToken |
getExclamationmark() |
String |
getImplictDatabaseString() |
String |
getImplictSchemaString()
This is the schema fetched from the SQLEnv.
|
TIndirection |
getIndirection()
Array element of this objectName
|
long |
getLineNo()
The line number of this objectName in SQL
|
TColumnDefinition |
getLinkedColumnDef()
The column definition in create/alter table statement that include this column name object.
|
gudusoft.gsqlparser.compiler.TVariable |
getLinkedVariable() |
TSourceToken |
getMethodToken() |
TObjectName |
getNamespace()
The Couchbase namespace before keyspace
|
String |
getNormalizedColumnString()
Get normalized column string with caching (Phase 5 optimization).
|
String |
getNormalizedDatabaseString()
Get normalized database string with caching (Phase 5 optimization).
|
String |
getNormalizedSchemaString()
Get normalized schema string with caching (Phase 5 optimization).
|
String |
getNormalizedServerString()
Get normalized server string with caching (Phase 5 optimization).
|
String |
getNormalizedTableString()
Get normalized table string with caching (Phase 5 optimization).
|
int |
getNumberOfPart()
List the number of parts made up this objectName
|
String |
getObjectString()
String text of the object name
|
TSourceToken |
getObjectToken()
The object part of this objectName such as table name, view name.
|
int |
getObjectType()
Deprecated.
use
getDbObjectType() instead. |
TCustomSqlStatement |
getOwnStmt() |
String |
getPackageString()
String text of the package name.
|
TSourceToken |
getPackageToken()
Oracle package name
|
TObjectName |
getParentObjectName() |
String |
getPartString()
String text of the part name
|
TSourceToken |
getPartToken()
The column name of this objectName if
getDbObjectType() is EDbObjectType.column. |
TPathSqlNode |
getPath()
stage path
|
TSourceToken |
getPropertyToken() |
EPseudoTableType |
getPseudoTableType() |
EQuoteType |
getQuoteType()
Tell whether this is a quoted objectName.
|
TObjectNameList |
getReferencedObjects() |
ResolutionResult |
getResolution()
Get resolution result from new resolver
|
int |
getResolveStatus() |
String |
getSchemaString()
String text of schema name in a qualified name of a schema object.
|
TSourceToken |
getSchemaToken()
The schema name of this objectName.
|
String |
getServerString()
String text of the server name
|
TSourceToken |
getServerToken()
The server part of this objectName: [server.][database.][schema.]object
|
TAttributeNode |
getSourceAttributeNode()
Deprecated.
Since 3.4.0.5. Use TSQLResolver2 with
getResolution() instead. |
TResultColumn |
getSourceColumn()
The result column which include this column
|
TTable |
getSourceTable()
Get the immediate source table where this column is visible in the current scope.
|
ArrayList<TTable> |
getSourceTableList()
source table list for star column,
select * from emp,dept * column will be list to both emp and dept table. |
StructFieldHint |
getStructFieldHint()
Get the struct field hint for deep struct access (3+ part names without alias).
|
ETableKind |
getTableKind() |
String |
getTableString()
String text of the table name
|
TSourceToken |
getTableToken()
The table name of this objectName, it's the same value as
getObjectToken() if getDbObjectType()
is EDbObjectType.table |
int |
getValidate_column_status() |
void |
init(EDbObjectType dbObjectType,
Object arg1,
Object arg2,
Object arg3) |
void |
init(Object arg1)
Initialize a query tree node.
|
void |
init(Object arg1,
Object arg2) |
void |
init(Object arg1,
Object arg2,
Object arg3) |
void |
init(Object arg1,
Object arg2,
Object arg3,
Object arg4) |
void |
init(Object arg1,
Object arg2,
Object arg3,
Object arg4,
Object arg5) |
void |
init(Object arg1,
Object arg2,
Object arg3,
Object arg4,
Object arg5,
Object arg6) |
void |
init(Object arg1,
Object arg2,
Object arg3,
Object arg4,
Object arg5,
Object arg6,
Object arg7)
Init with 7 tokens for deeply nested struct field access (e.g., BigQuery)
Pattern: a.b.c.d.e.f.g (7 parts)
|
void |
init(Object arg1,
Object arg2,
Object arg3,
Object arg4,
Object arg5,
Object arg6,
Object arg7,
Object arg8)
Init with 8 tokens for deeply nested struct field access
Pattern: a.b.c.d.e.f.g.h (8 parts)
|
void |
init(Object arg1,
Object arg2,
Object arg3,
Object arg4,
Object arg5,
Object arg6,
Object arg7,
Object arg8,
Object arg9)
Init with 9 tokens for deeply nested struct field access
Pattern: a.b.c.d.e.f.g.h.i (9 parts)
|
void |
init(Object arg1,
Object arg2,
Object arg3,
Object arg4,
Object arg5,
Object arg6,
Object arg7,
Object arg8,
Object arg9,
Object arg10)
Init with 10 tokens for deeply nested struct field access
Pattern: a.b.c.d.e.f.g.h.i.j (10 parts)
|
boolean |
isAmbiguous()
Check if this column reference is ambiguous
|
boolean |
isAttributeNameInObjectName(TSourceToken leftparen,
TSourceToken rightparen) |
boolean |
isCandidatesFromUnion()
Returns true if candidate tables came from UNION/CTE branch propagation,
false if they came from ambiguity (e.g., unqualified column in multi-table query).
|
boolean |
isContinueToSearch() |
boolean |
isImplicitDatabase() |
boolean |
isImplicitSchema() |
boolean |
isOrphanColumn() |
boolean |
isQualified()
Check whether a column is prefixed by a table like this:
table.column |
boolean |
isReservedKeyword() |
boolean |
isResolved()
Check if this column reference has been resolved (by new resolver)
|
boolean |
isSubscripts()
PostgreSQL column with array types
|
boolean |
isTableDetermined()
Sometime, a non-qualified column can't be linked to a table without additional metadata from database.
|
boolean |
isValidColumnName(EDbVendor pDBVendor)
Check whether a column name is syntax valid in a specific database vendor.
|
void |
mergeObjectName(TObjectName objectName)
Used internally in hive .y file to merge two objectNames
|
void |
mergeObjectName(TObjectName objectName,
TObjectName objectName2) |
boolean |
resolveWithThisTable(TTable pTable)
This column must be in this syntax: table.column, otherwise, this method always return false.
|
protected TSQLSchema |
searchImplicitSchema() |
void |
setAtsign(TSourceToken atsign) |
void |
setColumnAttributes(TObjectNameList columnAttributes) |
void |
setColumnsLinkedToStar(TResultColumnList columnsLinkedToStar) |
void |
setCommentString(TSourceToken commentString) |
void |
setDatabaseToken(TSourceToken databaseToken) |
void |
setDatabaseToken(TSourceToken databaseToken,
boolean implicit) |
void |
setDblink(TObjectName dblink) |
void |
setDblink(TObjectName dblink,
boolean linkToDB) |
void |
setDbObjectType(EDbObjectType dbObjectType)
Set object type of this objectName
|
void |
setDbObjectType(EDbVendor dbVendor,
EDbObjectType dbObjectType) |
void |
setDbObjectTypeDirectly(EDbObjectType dbObjectType) |
void |
setExceptReplaceClause(TExceptReplaceClause exceptReplaceClause) |
void |
setExclamationmark(TSourceToken exclamationmark) |
void |
setImplictDatabaseName(String implictDatabaseName) |
void |
setImplictSchemaName(String implictSchemaName) |
void |
setIndirection(TIndirection indirection) |
void |
setLinkedColumnDef(TColumnDefinition linkedColumnDef) |
void |
setLinkedVariable(gudusoft.gsqlparser.compiler.TVariable linkedVariable) |
void |
setMethodToken(TSourceToken methodToken) |
void |
setNamespace(TObjectName namespace) |
void |
setObjectToken(TSourceToken objectToken) |
void |
setObjectType(int objectType)
Deprecated.
|
void |
setOrphanColumn(boolean orphanColumn) |
void |
setOwnStmt(TCustomSqlStatement ownStmt) |
void |
setPackageToken(TSourceToken packageToken) |
void |
setParentObjectName(TObjectName parentObjectName) |
void |
setPartToken(TSourceToken partToken) |
void |
setPath(TPathSqlNode path) |
void |
setPropertyToken(TSourceToken propertyToken) |
void |
setPseudoTableType(EPseudoTableType pseudoTableType) |
void |
setQuoteType(EQuoteType quoteType) |
void |
setResolution(ResolutionResult resolution)
Set resolution result (called by resolver2.NameResolver)
|
void |
setResolveStatus(int resolveStatus) |
void |
setSchemaToken(TSourceToken schemaToken) |
void |
setSchemaToken(TSourceToken schemaToken,
boolean implicit) |
void |
setServerToken(TSourceToken serverToken) |
void |
setSourceAttributeNode(TAttributeNode sourceAttributeNode)
Deprecated.
Since 3.4.0.5. Use TSQLResolver2 with
setResolution(gudusoft.gsqlparser.resolver2.model.ResolutionResult) instead. |
void |
setSourceColumn(TResultColumn sourceColumn)
Set the result column which include this column name.
|
void |
setSourceColumnOnly(TResultColumn sourceColumn)
Set the source column without changing dbObjectType.
|
void |
setSourceTable(TTable sourceTable)
Set the table this column belongs to.
|
void |
setSourceTableBySQLResolver(TCustomSqlStatement sqlStatement,
TAttributeNode attributeNode,
TTable newSourceTable) |
void |
setSqlEnv(TSQLEnv sqlEnv) |
void |
setStructFieldHint(StructFieldHint hint)
Set the struct field hint (called by NameResolver for 3+ part no-alias struct patterns).
|
void |
setTableDetermined(boolean tableDetermined) |
void |
setTableKind(ETableKind tableKind) |
void |
setValidate_column_status(int validate_column_status) |
void |
splitNameInQuotedIdentifier() |
void |
TObjectName() |
String |
toString()
返回该对象名的字符串表示(中文说明):
|
addAllMyTokensToTokenList, addToTokenChain, appendNewNode, calculateTokenCount, doAppendNewNode, doParse, fastSetString, getAnchorNode, getCommentAfterNode, getCommentBeforeNode, getCompactString, getDummyTag, getEndToken, getEvaluateDatatype, getEvalValue, getGsqlparser, getLocation, getMd5, getNodeStatus, getNodeType, getPlainText, getStartToken, getTokenCount, hasNext, 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, toString2equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitforEachRemainingpublic int searchLevel
public static final int ttobjNotAObject
EDbObjectType.
this is not an object, like sysdate function in oracle databasepublic static final int ttobjUnknown
EDbObjectType.
object type can't be determined.public static final int ttobjColumn
EDbObjectType.
column in table, objectToken is table if specified, and partToken is column name.public static final int ttobjColumnAlias
EDbObjectType.
column alias in objectToken.public static final int ttobjTable
EDbObjectType.
table name in objectToken.public static final int ttobjParameter
EDbObjectType.
parameter name in objectToken.public static final int ttobjVariable
EDbObjectType.
variable name in objectToken.public static final int ttobjColumnMethod
EDbObjectType.method.
column method like SetXY below, column method in methodToken, and colomn name in partToken.
UPDATE Cities
SET Location.SetXY(23.5, 23.5)
public static final int ttobjNamedArgParameter
Example: In Snowflake FLATTEN(INPUT => parse_json(col), outer => TRUE), "INPUT" and "outer" are named argument parameter names, NOT column references.
These should be skipped during column resolution and data lineage analysis.
public static final int ttobjFunctionName
EDbObjectType.
function name in objectTokenpublic static final int ttobjConstraintName
EDbObjectType.constraint.
constraint name in objectTokenpublic static final int ttobjStringConstant
EDbObjectType.
string constant in objectTokenpublic static final int ttobjAttribute
EDbObjectType.
attribute name is in partTokenpublic static final int ttobjDatatype
EDbObjectType.
datatype was not represented by a TObjectName object, this constant was used in source tokens that consist of TTypeName.public static final int ttobjSchemaName
EDbObjectType.
schema name in schemaTokenpublic static final int ttobjPositionalParameters
EDbObjectType.
postgresql
Positional Parameters, $1, $1[1], $1[1,10]
parameter name is in partToken of $1,
and parameter name is in objectToken of $1.columnName,
and column name is in partTokenpublic TObjectName()
public void setOwnStmt(TCustomSqlStatement ownStmt)
public TCustomSqlStatement getOwnStmt()
public TExceptReplaceClause getExceptReplaceClause()
public void setExceptReplaceClause(TExceptReplaceClause exceptReplaceClause)
public void setTableKind(ETableKind tableKind)
public ETableKind getTableKind()
public EPseudoTableType getPseudoTableType()
public void setPseudoTableType(EPseudoTableType pseudoTableType)
public void setLinkedVariable(gudusoft.gsqlparser.compiler.TVariable linkedVariable)
public gudusoft.gsqlparser.compiler.TVariable getLinkedVariable()
@Deprecated public void setSourceAttributeNode(TAttributeNode sourceAttributeNode)
setResolution(gudusoft.gsqlparser.resolver2.model.ResolutionResult) instead.
This method is used only by the legacy TSQLResolver (RESOLVER).
It is not used when using TSQLResolver2 (RESOLVER2) for name resolution.
For RESOLVER2, use setResolution(gudusoft.gsqlparser.resolver2.model.ResolutionResult) instead.
sourceAttributeNode - the attribute node representing the resolved source@Deprecated public TAttributeNode getSourceAttributeNode()
getResolution() instead.
This method is used only by the legacy TSQLResolver (RESOLVER).
It is not used when using TSQLResolver2 (RESOLVER2) for name resolution.
For RESOLVER2, use getResolution() instead.
public void setResolution(ResolutionResult resolution)
public ResolutionResult getResolution()
public ColumnSource getColumnSource()
public StructFieldHint getStructFieldHint()
public void setStructFieldHint(StructFieldHint hint)
public boolean isAmbiguous()
public boolean isResolved()
public List<TTable> getCandidateTables2()
public TObjectName clone()
public void setParentObjectName(TObjectName parentObjectName)
public TObjectName getParentObjectName()
getParentObjectName in class TParseTreeNodepublic void setPath(TPathSqlNode path)
public TPathSqlNode getPath()
public ArrayList<TTable> getSourceTableList()
public boolean isImplicitSchema()
public boolean isImplicitDatabase()
public ArrayList<TAttributeNode> getAttributeNodesDerivedFromFromClause()
public ArrayList<TColumnTableMatch> getCandidateAttributeNodes()
getAttributeNodesDerivedFromFromClause()public TTableList getCandidateTables()
public boolean isCandidatesFromUnion()
public int getDdlVerificationStatus(TTable table)
Returns a tri-state result:
table - The candidate table to checkpublic Map<TTable,Integer> getCandidateTableDdlStatus()
Returns a map from each candidate table to its DDL verification status:
public void setOrphanColumn(boolean orphanColumn)
public boolean isOrphanColumn()
public boolean isReservedKeyword()
public void setLinkedColumnDef(TColumnDefinition linkedColumnDef)
public TColumnDefinition getLinkedColumnDef()
CREATE TABLE table_name (
column1 datatype,
column2 datatype
);
In above SQL, column1 datatype is the column definition while column1 is this
object name.public void setNamespace(TObjectName namespace)
public TObjectName getNamespace()
public String toString()
1) 优先调用父类 Object.toString() 获取已构造好的整体标识文本;
若父类返回非空,则:
- 对于 Snowflake,当文本以 IDENTIFIER(...) 形式出现时,仅提取并返回其中的
字面量部分(去除引号),以符合 Snowflake 标识符解析规则;
- 其他情况直接返回父类结果。
2) 若父类返回为空(尚未生成整体文本),则回退到更细粒度的 token:
- 若存在 part 级 token,返回其字符串;
- 否则若存在 object 级 token,返回其字符串;
- 若仍不存在,返回 null。
目的:统一并优先复用已构造的字符串表示,同时兼容特定数据库(如 Snowflake)的 标识符语义,从而在不同厂商 SQL 中提供稳定、符合预期的对象名输出。
toString in class TParseTreeNodepublic void setQuoteType(EQuoteType quoteType)
public EQuoteType getQuoteType()
public boolean isContinueToSearch()
public void setSourceColumn(TResultColumn sourceColumn)
sourceColumn - the result column includes this column namepublic void setSourceColumnOnly(TResultColumn sourceColumn)
sourceColumn - the result column includes this column namepublic TResultColumn getSourceColumn()
select salary + 1000 from emp
In the above SQL, salary + 1000 is the result column while salary is this column name.public boolean resolveWithThisTable(TTable pTable)
pTable - table used to match getTableToken() of this column objectpublic boolean isQualified()
table.columntable.columnpublic int getValidate_column_status()
public void setValidate_column_status(int validate_column_status)
public boolean isValidColumnName(EDbVendor pDBVendor)
rowid is not a valid column name.pDBVendor - in which the database vendor the syntax of this column is checkedpublic ArrayList<String> getColumnsLinkedToStarColumn()
public void setColumnsLinkedToStar(TResultColumnList columnsLinkedToStar)
public TResultColumnList getColumnsLinkedToStar()
public void setSourceTable(TTable sourceTable)
sourceTable - table contains this columnpublic void setSourceTableBySQLResolver(TCustomSqlStatement sqlStatement, TAttributeNode attributeNode, TTable newSourceTable)
public TTable getSourceTable()
This returns the table/subquery/CTE that directly exposes this column in the FROM clause, NOT the final physical table after tracing through subqueries or CTEs.
To get the final physical table (after tracing through all layers), use:
getResolution().getColumnSource().getFinalTable()
SELECT title FROM (SELECT * FROM books) sub
For the 'title' column in outer SELECT:
- getSourceTable() → TTable for subquery 'sub' (tableType=subquery)
- resolution.getFinalTable() → TTable for 'books' (the physical table)
sourceTable,
ColumnSource.getFinalTable()public void setResolveStatus(int resolveStatus)
public int getResolveStatus()
public void TObjectName()
public boolean isSubscripts()
CREATE TABLE sal_emp (
name text,
pay_by_quarter integer[],
schedule text[][]
);
In the above SQL, this method returns true for pay_by_quarter column.public void setIndirection(TIndirection indirection)
public TIndirection getIndirection()
select arraycolumn[4] from t;
In the above SQL, this method returns [4] of this objectName.TIndirectionpublic void setPropertyToken(TSourceToken propertyToken)
public TSourceToken getAtsign()
public TSourceToken getMethodToken()
public TSourceToken getPropertyToken()
public TSourceToken getServerToken()
public TSourceToken getExclamationmark()
public TObjectName getDblink()
remoreserver in this objectName: scott.emp@remoreserverpublic TSourceToken getDatabaseToken()
public void setTableDetermined(boolean tableDetermined)
public boolean isTableDetermined()
select name from emp, dept
In the above SQL, the name column can't be determined which table it belongs to.
Below is a more complicated SQL that shows the relationship between column and table.
select
s2.s2t1a1,
s3.s3t1a1
from
(
select *
from subselect2table1 s2t1
) s2,
(
select *
from subselect3table1, subselect3table2
) s3
column s2t1a1 was linked to subselect2table1, isTableDetermined() returns true for this column.
isTableDetermined() returns false for this column.
Provide database metadata will help GSP links the column to the table correctly.
TGSqlParser.setMetaDatabase(gudusoft.gsqlparser.IMetaDatabase)public void attributesToPropertyToken(TObjectNameList attributes)
teradata:
column.attribute()
column.attribute().attribute()
attributes - public void setColumnAttributes(TObjectNameList columnAttributes)
public TObjectNameList getColumnAttributes()
CREATE TYPE school_record AS (
school_name VARCHAR(20),
GPA FLOAT);
CREATE TYPE college_record AS (
school school_record,
major VARCHAR(20),
minor VARCHAR(20));
CREATE TABLE student_record (
student_id INTEGER,
Last_name VARCHAR(20),
First_name VARCHAR(20),
high_school school_record,
college college_record);
SELECT student_id, last_name, first_name,
high_school.school_name(), high_school.GPA(),
college.school().school_name(), college.school().GPA(),
college.major(), college.minor()
FROM student_record;
SELECT *.ALL FROM student_record;
SELECT student_record.*.ALL;
Take this column college.school().school_name() for example, the partToken of this objectName
should be college, and the value returned by this method should be
school().school_name()
PLEASE NOTE THAT CURRENT VERSION CAN'T HANDLE THE ABOVE SQL CORRECTLY.
public void setObjectType(int objectType)
setDbObjectType(gudusoft.gsqlparser.EDbVendor, gudusoft.gsqlparser.EDbObjectType) insteadobjectType - object type of this objectNamepublic void setDbObjectType(EDbVendor dbVendor, EDbObjectType dbObjectType)
public void setDbObjectTypeDirectly(EDbObjectType dbObjectType)
public void setDbObjectType(EDbObjectType dbObjectType)
dbObjectType - database object typepublic EDbObjectType getDbObjectType()
EDbObjectType.column, getPartToken() represents
the column name, for all other object type, the name of this database object is stored in getObjectToken()public int getObjectType()
getDbObjectType() instead.public void setAtsign(TSourceToken atsign)
public void setDblink(TObjectName dblink)
public void setDblink(TObjectName dblink, boolean linkToDB)
public void setServerToken(TSourceToken serverToken)
public void setDatabaseToken(TSourceToken databaseToken, boolean implicit)
public void setDatabaseToken(TSourceToken databaseToken)
public void setObjectToken(TSourceToken objectToken)
public void setPartToken(TSourceToken partToken)
public void setMethodToken(TSourceToken methodToken)
public void setSchemaToken(TSourceToken schemaToken, boolean implicit)
public void setSchemaToken(TSourceToken schemaToken)
public void setPackageToken(TSourceToken packageToken)
public TSourceToken getPackageToken()
public TSourceToken getObjectToken()
public TSourceToken getPartToken()
getDbObjectType() is EDbObjectType.column.
getColumnToken() returns the same value.public TSourceToken getSchemaToken()
public String getPackageString()
public String getServerString()
public String getDatabaseString()
public String getSchemaString()
public String getImplictSchemaString()
getSchemaString()
This method is only valid when the dbObjectType is a schema object.public void setImplictDatabaseName(String implictDatabaseName)
public void setImplictSchemaName(String implictSchemaName)
public String getImplictDatabaseString()
protected TSQLSchema searchImplicitSchema()
public TSourceToken getTableToken()
getObjectToken() if getDbObjectType()
is EDbObjectType.tablepublic String getTableString()
public String getObjectString()
public String getPartString()
public String getNormalizedDatabaseString()
This method caches the normalized database name to avoid repeated normalize() calls. The cache is invalidated automatically when the IdentifierProfile changes (e.g., vendor switch).
public String getNormalizedSchemaString()
This method caches the normalized schema name to avoid repeated normalize() calls. The cache is invalidated automatically when the IdentifierProfile changes.
public String getNormalizedTableString()
This method caches the normalized table name to avoid repeated normalize() calls. The cache is invalidated automatically when the IdentifierProfile changes.
public String getNormalizedColumnString()
This method caches the normalized column name (from partToken) to avoid repeated normalize() calls. The cache is invalidated automatically when the IdentifierProfile changes.
public String getNormalizedServerString()
This method caches the normalized server name to avoid repeated normalize() calls. The cache is invalidated automatically when the IdentifierProfile changes.
public void setExclamationmark(TSourceToken exclamationmark)
public String getAnsiSchemaName()
public String getAnsiCatalogName()
public int getNumberOfPart()
public static TObjectName createObjectName(EDbVendor dbVendor, EDbObjectType dbObjectType)
public static TObjectName createObjectName(EDbVendor dbVendor, EDbObjectType dbObjectType, TSourceToken token1)
public static TObjectName createObjectName(EDbVendor dbVendor, EDbObjectType dbObjectType, String str)
public static TObjectName createObjectName(EDbVendor dbVendor, EDbObjectType dbObjectType, TSourceToken token1, TSourceToken token2)
public static TObjectName createObjectName(EDbVendor dbVendor, EDbObjectType dbObjectType, TSourceToken token1, TSourceToken token2, TSourceToken token3)
public static TObjectName createObjectName(EDbVendor dbVendor, EDbObjectType dbObjectType, TSourceToken token1, TSourceToken token2, TSourceToken token3, TSourceToken token4)
public void splitNameInQuotedIdentifier()
public void init(Object arg1)
TParseTreeNodeinit in class TParseTreeNodearg1 - first argumentpublic void init(Object arg1, Object arg2)
init in class TParseTreeNodepublic void init(EDbObjectType dbObjectType, Object arg1, Object arg2, Object arg3)
public void init(Object arg1, Object arg2, Object arg3)
init in class TParseTreeNodepublic void init(Object arg1, Object arg2, Object arg3, Object arg4)
init in class TParseTreeNodepublic void init(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5)
init in class TParseTreeNodepublic void init(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6)
init in class TParseTreeNodepublic void init(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7)
init in class TParseTreeNodepublic void init(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7, Object arg8)
init in class TParseTreeNodepublic void init(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7, Object arg8, Object arg9)
init in class TParseTreeNodepublic void init(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7, Object arg8, Object arg9, Object arg10)
init in class TParseTreeNodepublic List<TSourceToken> getAdditionalParts()
public long getColumnNo()
getColumnNo in class TParseTreeNodepublic long getLineNo()
getLineNo in class TParseTreeNodepublic TObjectNameList getReferencedObjects()
public String getColumnNameOnly()
public void accept(TParseTreeVisitor v)
TParseTreeNodeaccept in interface Visitableaccept in class TParseTreeNodev - visitor is a descendant class of TParseTreeVisitorpublic void acceptChildren(TParseTreeVisitor v)
TParseTreeNodeacceptChildren in interface VisitableacceptChildren in class TParseTreeNodev - visitor is a descendant class of TParseTreeVisitorpublic TSourceToken getColumnToken()
public boolean isAttributeNameInObjectName(TSourceToken leftparen, TSourceToken rightparen)
public void mergeObjectName(TObjectName objectName)
public void mergeObjectName(TObjectName objectName, TObjectName objectName2)
public void columnToProperty()
public void appendObjectName(TObjectName objectName)
public void setCommentString(TSourceToken commentString)
public TSourceToken getCommentString()
public String coordinate()