module Bmg::Sql::Expr
Constants
- AND
- AS
- COMMA
- DOT
- EQUAL
- EXISTS
- FALSE
- GREATER
- GREATER_OR_EQUAL
- IN
- LEFT_PARENTHESE
- LESS
- LESS_OR_EQUAL
- NOT
- NOT_EQUAL
- OR
- QUOTE
- RIGHT_PARENTHESE
- SPACE
- TRUE
Public Instance Methods
each_child(skip = 0) { |c, i - 1| ... }
click to toggle source
# File lib/bmg/sql/nodes/expr.rb, line 60 def each_child(skip = 0) each_with_index do |c,i| next if i <= skip yield(c, i - 1) end end
flatten()
click to toggle source
# File lib/bmg/sql/nodes/expr.rb, line 67 def flatten Processor::Flatten.new(nil).call(self) end
group_by?()
click to toggle source
# File lib/bmg/sql/nodes/expr.rb, line 38 def group_by? not(group_by_clause.nil?) end
join?()
click to toggle source
# File lib/bmg/sql/nodes/expr.rb, line 34 def join? false end
limit_or_offset?()
click to toggle source
# File lib/bmg/sql/nodes/expr.rb, line 30 def limit_or_offset? not(limit_clause.nil? and offset_clause.nil?) end
ordering()
click to toggle source
# File lib/bmg/sql/nodes/expr.rb, line 42 def ordering obc = order_by_clause obc && order_by_clause.to_ordering end
set_operator?()
click to toggle source
# File lib/bmg/sql/nodes/expr.rb, line 26 def set_operator? false end
with_insert(index, what)
click to toggle source
# File lib/bmg/sql/nodes/expr.rb, line 52 def with_insert(index, what) dup.tap{|x| x.insert(index, Grammar.sexpr(what)) } end
with_push(*sexprs)
click to toggle source
# File lib/bmg/sql/nodes/expr.rb, line 56 def with_push(*sexprs) dup.push(*sexprs) end
with_update(index, what)
click to toggle source
# File lib/bmg/sql/nodes/expr.rb, line 47 def with_update(index, what) index = find_child_index(index) if index.is_a?(Symbol) dup.tap{|x| x[index] = Grammar.sexpr(what) } end
Private Instance Methods
find_child(kind = nil, &search)
click to toggle source
# File lib/bmg/sql/nodes/expr.rb, line 73 def find_child(kind = nil, &search) if search.nil? and kind search = ->(x){ x.is_a?(Array) && x.first == kind } end each_child do |child| return child if search.call(child) end nil end
find_child_index(kind)
click to toggle source
# File lib/bmg/sql/nodes/expr.rb, line 83 def find_child_index(kind) each_with_index do |child,index| return index if child.is_a?(Array) && child.first == kind end nil end
sql_parenthesized(buffer) { |buffer| ... }
click to toggle source
# File lib/bmg/sql/nodes/expr.rb, line 90 def sql_parenthesized(buffer) buffer << LEFT_PARENTHESE yield(buffer) buffer << RIGHT_PARENTHESE end