Class MsAbstractExprWithNmspc<T>

Type Parameters:
T - analyzed expression, should be extension of ParserRuleContext or a rulectx wrapper class
Direct Known Subclasses:
MsDelete, MsExprWithNmspc, MsInsert, MsMerge, MsSelect, MsUpdate

public abstract class MsAbstractExprWithNmspc<T> extends MsAbstractExpr
Abstract base class for analyzing Microsoft SQL expressions with namespace support. Provides functionality for managing table aliases, common table expressions (CTEs), and resolving object references within a specific namespace context.
Author:
levsha_aa
  • Method Details

    • findReference

      public Map.Entry<String,ObjectReference> findReference(String schema, String name, String column)
      Overrides:
      findReference in class AbstractExpr
      Parameters:
      schema - optional schema qualification of name, may be null
      name - alias of the referenced object
      column - optional referenced column alias, may be null
      Returns:
      a pair of (Alias, Dealiased name) where Alias is the given name. Dealiased name can be null if the name is internal to the query and is not a reference to external table.
      null if the name is not found
    • addReference

      public boolean addReference(String alias, ObjectReference object)
      Adds a reference to the namespace with the specified alias. Clients may use this to setup pseudo-variable names before expression analysis.
      Parameters:
      alias - the alias name for the reference
      object - the database object being referenced, may be null for internal query names
      Returns:
      true if the reference was added successfully, false if alias already exists
    • addRawTableReference

      public void addRawTableReference(ObjectReference qualifiedTable)
      Adds an unaliased table reference to the namespace. Used for tables that don't have explicit aliases in the FROM clause.
      Parameters:
      qualifiedTable - the fully qualified table reference to add
    • analyze

      public abstract List<String> analyze(T ruleCtx)
      Analyzes the given rule context and returns a list of column names. Implementations should process the specific Microsoft SQL expression type and extract relevant database dependencies and column information.
      Parameters:
      ruleCtx - the parser rule context to analyze
      Returns:
      list of column names found during analysis