Method: Sequel::Dataset#split_alias

Defined in:
lib/sequel/dataset/misc.rb

#split_alias(c) ⇒ Object

Splits a possible implicit alias in C, handling both SQL::AliasedExpressions and Symbols. Returns an array of two elements, with the first being the main expression, and the second being the alias.



135
136
137
138
139
140
141
142
143
144
145
# File 'lib/sequel/dataset/misc.rb', line 135

def split_alias(c)
  case c
  when Symbol
    c_table, column, aliaz = split_symbol(c)
    [c_table ? SQL::QualifiedIdentifier.new(c_table, column.to_sym) : column.to_sym, aliaz]
  when SQL::AliasedExpression
    [c.expression, c.aliaz]
  else
    [c, nil]
  end
end