class Select

Constants

S_DISTINCT
S_DISTINCT_ON
S_DISTINCT_ON_SINGLE
S_SELECT

Public Instance Methods

distinct_clause(sql) click to toggle source
# File lib/eno/expressions.rb, line 510
def distinct_clause(sql)
  case (on = @props[:distinct])
  when nil
    nil
  when true
    S_DISTINCT
  when Array
    S_DISTINCT_ON % on.map { |e| sql.quote(e) }.join(S_COMMA)
  else
    S_DISTINCT_ON_SINGLE % sql.quote(on)
  end
end
to_sql(sql) click to toggle source
# File lib/eno/expressions.rb, line 504
def to_sql(sql)
  S_SELECT % [
    distinct_clause(sql), @members.map { |e| sql.quote(e) }.join(S_COMMA)
  ]
end