sql-logging 3.0.1 → 3.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -26,6 +26,9 @@ module SqlLogging
26
26
  @@show_top_sql_queries = value
27
27
  end
28
28
 
29
+ @@queries = @@bytes = @@rows = 0
30
+ @@top_queries = {}
31
+
29
32
  def self.reset_statistics!
30
33
  @@queries = @@bytes = @@rows = 0
31
34
  @@top_queries = {}
@@ -78,7 +81,7 @@ module SqlLogging
78
81
  def self.log_report
79
82
  Rails.logger.debug "SQL Logging: #{helper.pluralize(@@queries, 'statement')} executed, returning #{helper.number_to_human_size(@@bytes)}"
80
83
 
81
- unless @@show_top_sql_queries == false
84
+ unless @@show_top_sql_queries == false || @@top_queries.empty?
82
85
  Rails.logger.debug "Top #{@@top_sql_queries} SQL executions:"
83
86
  sorted_keys = @@top_queries.keys.sort_by { |k| @@top_queries[k][@@show_top_sql_queries] }.reverse
84
87
  sorted_keys.slice(0..@@top_sql_queries).each do |key|
@@ -1,3 +1,3 @@
1
1
  module SqlLogging
2
- VERSION = '3.0.1'
2
+ VERSION = '3.0.2'
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sql-logging
3
3
  version: !ruby/object:Gem::Version
4
- hash: 5
4
+ hash: 3
5
5
  prerelease: false
6
6
  segments:
7
7
  - 3
8
8
  - 0
9
- - 1
10
- version: 3.0.1
9
+ - 2
10
+ version: 3.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Steve Madsen