Class OraclePackageNamespace
Object
gudusoft.gsqlparser.resolver2.namespace.OraclePackageNamespace
- All Implemented Interfaces:
INamespace
Namespace representing Oracle PL/SQL package members (variables, constants, cursors).
Package members declared in PACKAGE or PACKAGE BODY can be referenced:
- Unqualified (within package body):
gn_err_no - Qualified (anywhere):
pkg_name.gn_err_no - Schema-qualified:
schema.pkg_name.gn_err_no
This namespace returns getFinalTable() == null since package members
are not table columns.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumRepresents the kind of package member.static classRepresents a single package member (variable, constant, cursor, etc.) -
Constructor Summary
ConstructorsConstructorDescriptionOraclePackageNamespace(String packageName, String schemaName, TPlsqlCreatePackage packageNode) Create a new Oracle package namespace. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCursor(TCursorDeclStmt cursorDecl) Add a cursor member from TCursorDeclStmt.voidaddMember(String name, OraclePackageNamespace.MemberKind kind, Object definitionNode) Add a member directly by name and kind.voidaddVariable(TVarDeclStmt varDecl) Add a variable/constant member from TVarDeclStmt.Get all column sources exposed by this namespace.Get all final physical tables this namespace depends on.Get a display name for this namespace (for debugging/error messages)Get the final physical table this namespace represents.Get a specific member by name.Get all members in this package.getNode()Get the associated AST node (TTable, TSelectSqlStatement, etc.)Get the package name.Get the schema name.Check if a column exists in this namespace.booleanCheck if this package has a member with the given name.booleanCheck if this namespace is validated/resolved.voidmergeFrom(OraclePackageNamespace other) Merge members from another package namespace (spec + body merging).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
-
OraclePackageNamespace
public OraclePackageNamespace(String packageName, String schemaName, TPlsqlCreatePackage packageNode) Create a new Oracle package namespace.- Parameters:
packageName- The simple package nameschemaName- The schema name (may be null)packageNode- The AST node for the package
-
-
Method Details
-
addVariable
Add a variable/constant member from TVarDeclStmt.- Parameters:
varDecl- The variable declaration statement
-
addCursor
Add a cursor member from TCursorDeclStmt.- Parameters:
cursorDecl- The cursor declaration statement
-
addMember
Add a member directly by name and kind. Used for adding members discovered through other means (e.g., exception declarations).- Parameters:
name- The member namekind- The member kinddefinitionNode- The AST node where this member is defined
-
mergeFrom
Merge members from another package namespace (spec + body merging).- Parameters:
other- The other namespace to merge from
-
getDisplayName
Description copied from interface:INamespaceGet a display name for this namespace (for debugging/error messages)- Specified by:
getDisplayNamein interfaceINamespace
-
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
-
getPackageName
Get the package name.- Returns:
- The simple package name
-
getSchemaName
Get the schema name.- Returns:
- The schema name, or null if not specified
-
getMembers
Get all members in this package.- Returns:
- Unmodifiable map of member name (lowercase) -> PackageMember
-
hasMember
Check if this package has a member with the given name.- Parameters:
name- The member name to check- Returns:
- true if the member exists
-
getMember
Get a specific member by name.- Parameters:
name- The member name- Returns:
- The PackageMember, or null if not found
-
toString
-