class Join

Constants

H_JOIN_TYPES
S_JOIN
S_ON
S_USING

Public Instance Methods

condition_sql(sql) click to toggle source
# File lib/eno/expressions.rb, line 315
def condition_sql(sql)
  if @props[:on]
    S_ON % sql.quote(@props[:on])
  elsif using_fields = @props[:using]
    fields = using_fields.is_a?(Array) ? using_fields : [using_fields]
    S_USING % fields.map { |f| sql.quote(f) }.join(S_COMMA)
  else
    nil
  end
end
to_sql(sql) click to toggle source
# File lib/eno/expressions.rb, line 306
def to_sql(sql)
  (S_JOIN % [
    sql.quote(@members[0]),
    H_JOIN_TYPES[@props[:type]],
    sql.quote(@members[1]),
    condition_sql(sql)
  ]).strip
end