Class: ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::StatementPool

Inherits:
StatementPool show all
Defined in:
activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb

Constant Summary

Constants inherited from StatementPool

StatementPool::DEFAULT_STATEMENT_LIMIT

Instance Method Summary collapse

Methods inherited from StatementPool

#[], #clear, #delete, #each, #key?, #length

Methods included from Enumerable

#as_json, #exclude?, #index_by, #many?, #pluck, #sum, #without

Constructor Details

#initialize(connection, max) ⇒ StatementPool

Returns a new instance of StatementPool.


180
181
182
183
184
# File 'activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb', line 180

def initialize(connection, max)
  super(max)
  @connection = connection
  @counter = 0
end

Instance Method Details

#[]=(sql, key) ⇒ Object


190
191
192
# File 'activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb', line 190

def []=(sql, key)
  super.tap { @counter += 1 }
end

#next_keyObject


186
187
188
# File 'activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb', line 186

def next_key
  "a#{@counter + 1}"
end