Module: Bmg::Sql::WithSpec

Includes:
Expr
Defined in:
lib/bmg/sql/nodes/with_spec.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, #set_operator?, #with_insert, #with_push, #with_update

Instance Method Details

#to_hashObject



14
15
16
17
18
19
20
# File 'lib/bmg/sql/nodes/with_spec.rb', line 14

def to_hash
  hash = {}
  each_child do |child|
    hash[child.table_name.value] = child.subquery
  end
  hash
end

#to_sql(buffer, dialect) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/bmg/sql/nodes/with_spec.rb', line 6

def to_sql(buffer, dialect)
  each_child do |child,index|
    buffer << COMMA << SPACE unless index==0
    child.to_sql(buffer, dialect)
  end
  buffer
end