Module: Bmg::Sql::SetOperator

Includes:
Expr
Included in:
Except, Intersect, Union
Defined in:
lib/bmg/sql/nodes/set_operator.rb

Constant Summary

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, #flatten, #group_by?, #join?, #limit_or_offset?, #order_by?, #ordering, #with_insert, #with_push, #with_update

Instance Method Details

#all?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/bmg/sql/nodes/set_operator.rb', line 34

def all?
  set_quantifier.all?
end

#distinct?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/bmg/sql/nodes/set_operator.rb', line 30

def distinct?
  set_quantifier.distinct?
end

#head_exprObject



6
7
8
# File 'lib/bmg/sql/nodes/set_operator.rb', line 6

def head_expr
  self[2]
end

#is_table_dee?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/bmg/sql/nodes/set_operator.rb', line 26

def is_table_dee?
  false
end

#order_by_clauseObject



42
43
44
# File 'lib/bmg/sql/nodes/set_operator.rb', line 42

def order_by_clause
  nil
end

#set_operator?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/bmg/sql/nodes/set_operator.rb', line 22

def set_operator?
  true
end

#set_quantifierObject



14
15
16
# File 'lib/bmg/sql/nodes/set_operator.rb', line 14

def set_quantifier
  self[1]
end

#should_be_reused?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/bmg/sql/nodes/set_operator.rb', line 38

def should_be_reused?
  true
end

#tail_exprsObject



10
11
12
# File 'lib/bmg/sql/nodes/set_operator.rb', line 10

def tail_exprs
  self[3..-1]
end

#to_attr_listObject



46
47
48
# File 'lib/bmg/sql/nodes/set_operator.rb', line 46

def to_attr_list
  self.last.to_attr_list
end

#to_sql(buffer, dialect, parenthesize = !buffer.empty?)) ⇒ Object



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/bmg/sql/nodes/set_operator.rb', line 50

def to_sql(buffer, dialect, parenthesize = !buffer.empty?)
  if parenthesize
    sql_parenthesized(buffer){|b| to_sql(b, dialect, false) }
  else
    left.to_sql(buffer, dialect, true)
    buffer << SPACE << keyword
    unless distinct?
      buffer << SPACE
      set_quantifier.to_sql(buffer, dialect)
    end
    buffer << SPACE
    right.to_sql(buffer, dialect, true)
    buffer
  end
end

#with_exp?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/bmg/sql/nodes/set_operator.rb', line 18

def with_exp?
  false
end