Module: Alf::Sql::SetOperator

Includes:
Expr
Included in:
Except, Intersect, Union
Defined in:
lib/alf/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, #join?, #limit_or_offset?, #ordering, #with_insert, #with_push, #with_update

Instance Method Details

#all?Boolean

Returns:

  • (Boolean)


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

def all?
  set_quantifier.all?
end

#distinct?Boolean

Returns:

  • (Boolean)


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

def distinct?
  set_quantifier.distinct?
end

#is_table_dee?Boolean

Returns:

  • (Boolean)


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

def is_table_dee?
  false
end

#leftObject



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

def left
  self[2]
end

#order_by_clauseObject



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

def order_by_clause
  nil
end

#rightObject



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

def right
  self[3]
end

#set_operator?Boolean

Returns:

  • (Boolean)


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

def set_operator?
  true
end

#set_quantifierObject



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

def set_quantifier
  self[1]
end

#should_be_reused?Boolean

Returns:

  • (Boolean)


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

def should_be_reused?
  true
end

#to_attr_listObject



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

def to_attr_list
  self.last.to_attr_list
end

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



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

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

#with_exp?Boolean

Returns:

  • (Boolean)


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

def with_exp?
  false
end