Class: Arel::Visitors::Spanner

Inherits:
ToSql
  • Object
show all
Defined in:
lib/arel/visitors/spanner.rb

Instance Method Summary collapse

Instance Method Details

#compile(node, collector = Arel::Collectors::SQLString.new) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/arel/visitors/spanner.rb', line 34

def compile node, collector = Arel::Collectors::SQLString.new
  unless collector.respond_to? :hints=
    collector.class.attr_accessor :hints, :table_hints, :join_hints
  end
  collector.hints = {}
  collector.table_hints = {}
  collector.join_hints = {}

  sql, binds = accept(node, collector).value
  sql = collector.hints[:statement_hint].value + sql if collector.hints[:statement_hint]

  if binds
    compile_with_binds collector, sql, binds
  else
    sql
  end
end