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 253
253:         def initialize(connection, max)
254:           super
255:           @counter = 0
256:           @cache   = Hash.new { |h,pid| h[pid] = {} }
257:         end

Public Instance Methods

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

Private Instance Methods

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

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.