net.sf.saffron.sql
Class SqlValidator.Scope

java.lang.Object
  |
  +--net.sf.saffron.sql.SqlValidator.Scope
Direct Known Subclasses:
SqlValidator.IdentifierScope, SqlValidator.JoinScope, SqlValidator.SelectScope, SqlValidator.SetopScope, SqlValidator.TableConstructorScope
Enclosing class:
SqlValidator

public abstract class SqlValidator.Scope
extends Object

Name-resolution scope. Represents any position in a parse tree than an expression can be, or anything in the parse tree which has columns.


Field Summary
private  String alias
           
 SqlValidator.Scope parent
           
 
Constructor Summary
(package private) SqlValidator.Scope(SqlValidator.Scope parent, String alias)
           
 
Method Summary
 String deriveAlias(SqlNode node, int ordinal)
           
protected  String findQualifyingTableName(String columnName)
           
 SqlIdentifier fullyQualify(SqlIdentifier identifier)
          Converts an identifier into a fully-qualified identifier.
 String getAlias()
           
(package private) abstract  SqlNode getNode()
           
abstract  SaffronType getRowType()
          Returns a list of names of output columns.
 SqlValidator.Scope getScopeFromNode(SqlNode node)
           
 SqlValidator.Table getTable()
          Returns the underlying table, or null if there is none.
 SqlValidator.Scope resolve(String name, SqlValidator.Scope[] ancestorOut, int[] offsetOut)
          Looks up a node with a given name.
 void validate()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parent

public final SqlValidator.Scope parent

alias

private final String alias
Constructor Detail

SqlValidator.Scope

SqlValidator.Scope(SqlValidator.Scope parent,
                   String alias)
Method Detail

getAlias

public String getAlias()

getScopeFromNode

public SqlValidator.Scope getScopeFromNode(SqlNode node)

deriveAlias

public String deriveAlias(SqlNode node,
                          int ordinal)

fullyQualify

public SqlIdentifier fullyQualify(SqlIdentifier identifier)
Converts an identifier into a fully-qualified identifier. For example, the "empno" in "select empno from emp natural join dept" becomes "emp.empno".


validate

public void validate()

getNode

abstract SqlNode getNode()

resolve

public SqlValidator.Scope resolve(String name,
                                  SqlValidator.Scope[] ancestorOut,
                                  int[] offsetOut)
Looks up a node with a given name. Returns null if none is found.

Parameters:
name - Name of node to find
ancestorOut - If not null, writes the ancestor scope here
offsetOut - If not null, writes the offset within the ancestor here

getTable

public SqlValidator.Table getTable()
Returns the underlying table, or null if there is none.


findQualifyingTableName

protected String findQualifyingTableName(String columnName)

getRowType

public abstract SaffronType getRowType()
Returns a list of names of output columns.


SourceForge.net_Logo