class Sequel::Qualifier
Handles qualifying existing datasets, so that unqualified columns in the dataset are qualified with a given table name.
Public Class Methods
Source
# File lib/sequel/ast_transformer.rb 101 def initialize(table) 102 @table = table 103 end
Set the table used to qualify unqualified columns
Private Instance Methods
Source
# 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
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