Class PlsqlVariableNamespace
Object
gudusoft.gsqlparser.resolver2.namespace.PlsqlVariableNamespace
- All Implemented Interfaces:
INamespace
Namespace representing PL/SQL variables declared in a block.
PL/SQL blocks (<
-
Constructor Summary
ConstructorsConstructorDescriptionPlsqlVariableNamespace(String blockLabel) Create a new PL/SQL variable namespace for a labeled block. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddParameter(String paramName) Add a procedure/function parameter to this namespace.voidaddVariable(TVarDeclStmt varDecl) Add a variable declaration to this namespace.Get all column sources exposed by this namespace.Get all final physical tables this namespace depends on.Get the block label.Get a display name for this namespace (for debugging/error messages)Get the final physical table this namespace represents.getNode()Get the associated AST node (TTable, TSelectSqlStatement, etc.)Get all variable declarations in this block.Check if a column exists in this namespace.booleanhasParameter(String name) Check if a name is a parameter.booleanhasVariable(String variableName) Check if a variable with the given name exists in this block.booleanCheck if this namespace is validated/resolved.resolveColumn(String columnName) Resolve a column name to its source.toString()voidvalidate()Validate/resolve this namespace.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface gudusoft.gsqlparser.resolver2.namespace.INamespace
addInferredColumn, getInferredColumns, getSelectStatement, getSourceTable, getStarColumn, hasStarColumn, resolveColumnPath, supportsDynamicInference
-
Constructor Details
-
PlsqlVariableNamespace
Create a new PL/SQL variable namespace for a labeled block.- Parameters:
blockLabel- The block label (e.g., "main" from <>)
-
-
Method Details
-
addVariable
Add a variable declaration to this namespace.- Parameters:
varDecl- The variable declaration statement
-
addParameter
Add a procedure/function parameter to this namespace. Parameters are tracked separately from variables since they don't need ColumnSource lineage - we only need to know if a name is a parameter to filter it from column reference collection.- Parameters:
paramName- The parameter name (as String)
-
hasVariable
Check if a variable with the given name exists in this block.- Parameters:
variableName- The variable name to check- Returns:
- true if the variable exists
-
getDisplayName
Description copied from interface:INamespaceGet a display name for this namespace (for debugging/error messages)- Specified by:
getDisplayNamein interfaceINamespace
-
hasParameter
Check if a name is a parameter.- Parameters:
name- The name to check- Returns:
- true if the name is a registered parameter
-
hasColumn
Description copied from interface:INamespaceCheck if a column exists in this namespace. Returns a three-level answer: EXISTS, MAYBE, NOT_EXISTS- Specified by:
hasColumnin interfaceINamespace- Parameters:
columnName- Column name to check- Returns:
- Column existence level
-
resolveColumn
Description copied from interface:INamespaceResolve a column name to its source.- Specified by:
resolveColumnin interfaceINamespace- Parameters:
columnName- Column name to resolve- Returns:
- ColumnSource if found, null otherwise
-
getAllColumnSources
Description copied from interface:INamespaceGet all column sources exposed by this namespace. Used for SELECT * expansion and smart completion.- Specified by:
getAllColumnSourcesin interfaceINamespace- Returns:
- Map of column name -> ColumnSource
-
getFinalTable
Description copied from interface:INamespaceGet the final physical table this namespace represents. For tables: returns the table itself For subqueries/CTEs: recursively traces back to physical table(s)- Specified by:
getFinalTablein interfaceINamespace- Returns:
- Physical table, or null if not determinable
-
getAllFinalTables
Description copied from interface:INamespaceGet all final physical tables this namespace depends on. For simple table namespace: returns single table For subquery/CTE: returns all tables in the query tree- Specified by:
getAllFinalTablesin interfaceINamespace- Returns:
- List of all physical tables
-
isValidated
Description copied from interface:INamespaceCheck if this namespace is validated/resolved. Some namespaces require resolution before they can provide column info.- Specified by:
isValidatedin interfaceINamespace- Returns:
- true if validated
-
validate
Description copied from interface:INamespaceValidate/resolve this namespace. For subqueries: resolve the SELECT list For tables: load metadata if needed- Specified by:
validatein interfaceINamespace
-
getNode
Description copied from interface:INamespaceGet the associated AST node (TTable, TSelectSqlStatement, etc.)- Specified by:
getNodein interfaceINamespace- Returns:
- AST node, or null if not applicable
-
getBlockLabel
Get the block label.- Returns:
- The block label
-
getVariables
Get all variable declarations in this block.- Returns:
- Unmodifiable map of variable name -> declaration
-
toString
-