class Seaquel::Statement::Join

A join clause inside an SQL statement.

Attributes

ons[R]
tables[R]

Public Class Methods

new(tables) click to toggle source
# File lib/seaquel/statement/join.rb, line 10
def initialize tables
  @tables = AST::List.new(tables)

  @ons = AST::JoinOp.new(:and, [])
end

Public Instance Methods

convert(conversion_helper) click to toggle source

Turns a join statement into SQL by invoking conversion_helper on the right parts.

@param conversion_helper [#convert] instance of a class that implements

a #convert method that turns expressions into SQL.

@return [String] SQL string for this join

# File lib/seaquel/statement/join.rb, line 27
def convert conversion_helper
  parts = []
  parts << 'INNER JOIN'
  parts << conversion_helper.convert(tables)
  parts << 'ON'
  parts << conversion_helper.convert(ons)
end
on(*exps) click to toggle source
# File lib/seaquel/statement/join.rb, line 16
def on *exps
  ons.concat(*exps)
end