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
 99 def initialize(table)
100   @table = table
101 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
109 def v(o)
110   case o
111   when Symbol
112     t, column, aliaz = Sequel.split_symbol(o)
113     if t
114       o
115     elsif aliaz
116       SQL::AliasedExpression.new(SQL::QualifiedIdentifier.new(@table, SQL::Identifier.new(column)), aliaz)
117     else
118       SQL::QualifiedIdentifier.new(@table, o)
119     end
120   when SQL::Identifier
121     SQL::QualifiedIdentifier.new(@table, o)
122   when SQL::QualifiedIdentifier, SQL::JoinClause
123     # Return these directly, so we don't accidentally qualify symbols in them.
124     o
125   else
126     super
127   end
128 end