Class PlsqlBlockScope
Object
gudusoft.gsqlparser.resolver2.scope.AbstractScope
gudusoft.gsqlparser.resolver2.scope.PlsqlBlockScope
- All Implemented Interfaces:
IScope
Scope for PL/SQL blocks (Oracle, PostgreSQL PL/pgSQL).
PL/SQL blocks can have labels (< This scope:
<<main>>
DECLARE
ename VARCHAR2(10) := 'KING';
BEGIN
DELETE FROM emp WHERE ename = main.ename; -- main.ename references the block variable
END;
-
Field Summary
Fields inherited from class gudusoft.gsqlparser.resolver2.scope.AbstractScope
node, parent, scopeType -
Constructor Summary
ConstructorsConstructorDescriptionPlsqlBlockScope(IScope parent, TBlockSqlNode blockNode) Create a new PL/SQL block scope for a labeled block.PlsqlBlockScope(IScope parent, TCustomSqlStatement stmt, String procedureName) Create a new PL/SQL block scope for a stored procedure or function. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddChild(INamespace namespace, String alias, boolean nullable) Default implementation: not supported (most scopes don't have children)Get the block label.Get the block node.Default implementation: empty listGet the variable namespace for this block.Default implementation: delegate to parentvoidresolve(List<String> names, INameMatcher matcher, boolean deep, IResolved resolved) Default implementation: delegate to parentresolveTable(String tableName) Default implementation: delegate to parenttoString()Methods inherited from class gudusoft.gsqlparser.resolver2.scope.AbstractScope
fullyQualify, getNode, getParent, getScopeType, isWithin
-
Constructor Details
-
PlsqlBlockScope
Create a new PL/SQL block scope for a labeled block.- Parameters:
parent- The parent scopeblockNode- The block AST node (TBlockSqlNode)
-
PlsqlBlockScope
Create a new PL/SQL block scope for a stored procedure or function. This constructor is used when there's no TBlockSqlNode (e.g., CREATE PROCEDURE).- Parameters:
parent- The parent scopestmt- The stored procedure/function statementprocedureName- The name of the procedure/function (used as the block label)
-
-
Method Details
-
getBlockLabel
Get the block label.- Returns:
- The block label, or null for anonymous blocks
-
getVariableNamespace
Get the variable namespace for this block.- Returns:
- The PlsqlVariableNamespace containing declared variables
-
getBlockNode
Get the block node.- Returns:
- The TBlockSqlNode AST node
-
addChild
Description copied from class:AbstractScopeDefault implementation: not supported (most scopes don't have children)- Specified by:
addChildin interfaceIScope- Overrides:
addChildin classAbstractScope- Parameters:
namespace- The namespace to addalias- The alias for this namespacenullable- Whether this namespace is nullable (e.g., RIGHT side of LEFT JOIN)
-
getChildren
Description copied from class:AbstractScopeDefault implementation: empty list- Specified by:
getChildrenin interfaceIScope- Overrides:
getChildrenin classAbstractScope- Returns:
- List of scope children
-
resolveTable
Description copied from class:AbstractScopeDefault implementation: delegate to parent- Specified by:
resolveTablein interfaceIScope- Overrides:
resolveTablein classAbstractScope- Parameters:
tableName- Table name or alias- Returns:
- Namespace if found, null otherwise
-
resolve
Description copied from class:AbstractScopeDefault implementation: delegate to parent- Specified by:
resolvein interfaceIScope- Overrides:
resolvein classAbstractScope- Parameters:
names- Name parts (e.g., ["schema", "table", "column"])matcher- Name matcher for case sensitivity rulesdeep- Whether to recursively resolve into record fieldsresolved- Callback to collect all matches
-
getVisibleNamespaces
Description copied from class:AbstractScopeDefault implementation: delegate to parent- Specified by:
getVisibleNamespacesin interfaceIScope- Overrides:
getVisibleNamespacesin classAbstractScope- Returns:
- List of visible namespaces
-
toString
- Overrides:
toStringin classAbstractScope
-