Module: Alf::Sql::InnerJoin

Includes:
Expr
Defined in:
lib/alf/sql/nodes/inner_join.rb

Constant Summary collapse

INNER =
"INNER".freeze
JOIN =
"JOIN".freeze
ON =
"ON".freeze

Constants included from Expr

Expr::AND, Expr::AS, Expr::COMMA, Expr::DOT, Expr::EQUAL, Expr::EXISTS, Expr::FALSE, Expr::GREATER, Expr::GREATER_OR_EQUAL, Expr::IN, Expr::LEFT_PARENTHESE, Expr::LESS, Expr::LESS_OR_EQUAL, Expr::NOT, Expr::NOT_EQUAL, Expr::OR, Expr::QUOTE, Expr::RIGHT_PARENTHESE, Expr::SPACE, Expr::TRUE

Instance Method Summary collapse

Methods included from Expr

#each_child, #limit_or_offset?, #ordering, #set_operator?, #with_insert, #with_push, #with_update

Instance Method Details

#join?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/alf/sql/nodes/inner_join.rb', line 10

def join?
  true
end

#leftObject



14
15
16
# File 'lib/alf/sql/nodes/inner_join.rb', line 14

def left
  self[1]
end

#predicateObject



22
23
24
# File 'lib/alf/sql/nodes/inner_join.rb', line 22

def predicate
  last
end

#rightObject



18
19
20
# File 'lib/alf/sql/nodes/inner_join.rb', line 18

def right
  self[2]
end

#to_sql(buffer = "") ⇒ Object



26
27
28
29
30
31
32
33
# File 'lib/alf/sql/nodes/inner_join.rb', line 26

def to_sql(buffer = "")
  left.to_sql(buffer)
  buffer << SPACE << JOIN << SPACE
  right.to_sql(buffer)
  buffer << SPACE << ON << SPACE
  predicate.to_sql(buffer)
  buffer
end