Class: Arel::Visitors::ToSql

Inherits:
Visitor
  • Object
show all
Defined in:
lib/arel/visitors/to_sql.rb

Direct Known Subclasses

IBM_DB, MSSQL, MySQL, Oracle, OrderClauses, PostgreSQL, SQLite, WhereSql

Instance Method Summary collapse

Constructor Details

#initialize(engine) ⇒ ToSql

Returns a new instance of ToSql.



7
8
9
10
11
12
13
14
# File 'lib/arel/visitors/to_sql.rb', line 7

def initialize engine
  @engine         = engine
  @connection     = nil
  @pool           = nil
  @last_column    = nil
  @quoted_tables  = {}
  @quoted_columns = {}
end

Instance Method Details

#accept(object) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/arel/visitors/to_sql.rb', line 16

def accept object
  @last_column = nil
  @pool        = @engine.connection_pool
  @pool.with_connection do |conn|
    @connection = conn
    super
  end
end