Class ColumnReference
Object
gudusoft.gsqlparser.resolver2.model.ColumnReference
Column reference record - preserves original AST node information for traceability.
When multiple syntactically different identifiers refer to the same semantic column (e.g., "Column1" and column1 in Oracle), this class allows tracing back from the normalized column name to all original occurrences in the SQL text.
Example: For SQL SELECT "Column1", column1 FROM dual:
- Both references resolve to the same column COLUMN1
- Each creates a separate ColumnReference with its original text and position
- The ColumnSourceWithReferences holds both references
- Since:
- 3.1.0.9
-
Constructor Summary
ConstructorsConstructorDescriptionColumnReference(TObjectName objectName) Create a column reference from a TObjectName AST node.ColumnReference(TObjectName objectName, String originalText, int startOffset, int endOffset, int lineNumber, int columnNumber) Create a column reference with explicit values (for testing or special cases). -
Method Summary
Modifier and TypeMethodDescriptionbooleanintGet the column number.intGet the end offset in the SQL text.intGet the line number.Get the original AST node.Get the original text as it appears in SQL.intGet the start offset in the SQL text.inthashCode()booleanCheck if position information is available.toString()
-
Constructor Details
-
ColumnReference
Create a column reference from a TObjectName AST node.- Parameters:
objectName- the original AST node
-
ColumnReference
public ColumnReference(TObjectName objectName, String originalText, int startOffset, int endOffset, int lineNumber, int columnNumber) Create a column reference with explicit values (for testing or special cases).- Parameters:
objectName- the original AST node (may be null)originalText- the original textstartOffset- start offsetendOffset- end offsetlineNumber- line numbercolumnNumber- column number
-
-
Method Details
-
getObjectName
Get the original AST node.- Returns:
- the TObjectName node, or null if not available
-
getOriginalText
Get the original text as it appears in SQL.- Returns:
- original text (e.g., "Column1" with quotes, or column1 without)
-
getStartOffset
Get the start offset in the SQL text.- Returns:
- start offset (0-based), or -1 if not available
-
getEndOffset
Get the end offset in the SQL text.- Returns:
- end offset (0-based, exclusive), or -1 if not available
-
getLineNumber
Get the line number.- Returns:
- line number (1-based), or -1 if not available
-
getColumnNumber
Get the column number.- Returns:
- column number (1-based), or -1 if not available
-
hasPositionInfo
Check if position information is available.- Returns:
- true if position information is valid
-
toString
-
equals
-
hashCode
-