class Sequel::Qualifier

Handles qualifying existing datasets, so that unqualified columns in the dataset are qualified with a given table name.

Public Class Methods

new(table) click to toggle source

Set the table used to qualify unqualified columns

    # File lib/sequel/ast_transformer.rb
101 def initialize(table)
102   @table = table
103 end

Private Instance Methods

v(o) click to toggle source

Turn SQL::Identifiers and symbols that aren't implicitly qualified into SQL::QualifiedIdentifiers. For symbols that are not implicitly qualified by are implicitly aliased, return an SQL::AliasedExpressions with a qualified version of the symbol.

Calls superclass method Sequel::ASTTransformer#v
    # File lib/sequel/ast_transformer.rb
111 def v(o)
112   case o
113   when Symbol
114     t, column, aliaz = Sequel.split_symbol(o)
115     if t
116       o
117     elsif aliaz
118       SQL::AliasedExpression.new(SQL::QualifiedIdentifier.new(@table, SQL::Identifier.new(column)), aliaz)
119     else
120       SQL::QualifiedIdentifier.new(@table, o)
121     end
122   when SQL::Identifier
123     SQL::QualifiedIdentifier.new(@table, o)
124   when SQL::QualifiedIdentifier, SQL::JoinClause
125     # Return these directly, so we don't accidentally qualify symbols in them.
126     o
127   else
128     super
129   end
130 end