Module: SeamlessDatabasePool::ConnectionStatistics
- Defined in:
- lib/seamless_database_pool/connection_statistics.rb
Overview
This module is included for testing. Mix it into each of your database pool connections and it will keep track of how often each connection calls update, insert, execute, or select.
Instance Method Summary collapse
-
#connection_statistics ⇒ Object
Get the connection statistics.
- #execute(sql, name = nil) ⇒ Object
- #insert(sql, name = nil) ⇒ Object
- #reset_connection_statistics ⇒ Object
- #update(sql, name = nil) ⇒ Object
Instance Method Details
#connection_statistics ⇒ Object
Get the connection statistics
7 8 9 |
# File 'lib/seamless_database_pool/connection_statistics.rb', line 7 def connection_statistics @connection_statistics ||= {} end |
#execute(sql, name = nil) ⇒ Object
27 28 29 30 31 |
# File 'lib/seamless_database_pool/connection_statistics.rb', line 27 def execute(sql, name = nil) increment_connection_statistic(:execute) do super(sql, name) end end |
#insert(sql, name = nil) ⇒ Object
21 22 23 24 25 |
# File 'lib/seamless_database_pool/connection_statistics.rb', line 21 def insert(sql, name = nil) increment_connection_statistic(:insert) do super(sql, name) end end |
#reset_connection_statistics ⇒ Object
11 12 13 |
# File 'lib/seamless_database_pool/connection_statistics.rb', line 11 def reset_connection_statistics @connection_statistics = {} end |
#update(sql, name = nil) ⇒ Object
15 16 17 18 19 |
# File 'lib/seamless_database_pool/connection_statistics.rb', line 15 def update(sql, name = nil) increment_connection_statistic(:update) do super(sql, name) end end |