Parent

Files

Class Index [+]

Quicksearch

ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::StatementPool

Public Class Methods

new(connection, max) click to toggle source
     # File lib/active_record/connection_adapters/postgresql_adapter.rb, line 256
256:         def initialize(connection, max)
257:           super
258:           @counter = 0
259:           @cache   = Hash.new { |h,pid| h[pid] = {} }
260:         end

Public Instance Methods

[](key) click to toggle source
     # File lib/active_record/connection_adapters/postgresql_adapter.rb, line 264
264:         def [](key);      cache[key]; end
[]=(sql, key) click to toggle source
     # File lib/active_record/connection_adapters/postgresql_adapter.rb, line 271
271:         def []=(sql, key)
272:           while @max <= cache.size
273:             dealloc(cache.shift.last)
274:           end
275:           @counter += 1
276:           cache[sql] = key
277:         end
clear() click to toggle source
     # File lib/active_record/connection_adapters/postgresql_adapter.rb, line 279
279:         def clear
280:           cache.each_value do |stmt_key|
281:             dealloc stmt_key
282:           end
283:           cache.clear
284:         end
delete(sql_key) click to toggle source
     # File lib/active_record/connection_adapters/postgresql_adapter.rb, line 286
286:         def delete(sql_key)
287:           dealloc cache[sql_key]
288:           cache.delete sql_key
289:         end
each(&block) click to toggle source
     # File lib/active_record/connection_adapters/postgresql_adapter.rb, line 262
262:         def each(&block); cache.each(&block); end
key?(key) click to toggle source
     # File lib/active_record/connection_adapters/postgresql_adapter.rb, line 263
263:         def key?(key);    cache.key?(key); end
length() click to toggle source
     # File lib/active_record/connection_adapters/postgresql_adapter.rb, line 265
265:         def length;       cache.length; end
next_key() click to toggle source
     # File lib/active_record/connection_adapters/postgresql_adapter.rb, line 267
267:         def next_key
268:           "a#{@counter + 1}"
269:         end

Private Instance Methods

cache() click to toggle source
     # File lib/active_record/connection_adapters/postgresql_adapter.rb, line 292
292:         def cache
293:           @cache[$$]
294:         end
connection_active?() click to toggle source
     # File lib/active_record/connection_adapters/postgresql_adapter.rb, line 300
300:         def connection_active?
301:           @connection.status == PGconn::CONNECTION_OK
302:         rescue PGError
303:           false
304:         end
dealloc(key) click to toggle source
     # File lib/active_record/connection_adapters/postgresql_adapter.rb, line 296
296:         def dealloc(key)
297:           @connection.query "DEALLOCATE #{key}" if connection_active?
298:         end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.