sql-logging 3.0.4 → 3.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -15,5 +15,31 @@ class ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
15
15
  result
16
16
  end
17
17
 
18
+ def exec_query_with_sql_logging(sql, *args)
19
+ result = nil
20
+ elapsed = Benchmark.measure do
21
+ result = exec_query_without_sql_logging(sql, *args)
22
+ end
23
+ msec = elapsed.real * 1000
24
+ if result.respond_to?(:rows)
25
+ SqlLogging::Statistics.record_query(sql, args.first, msec, result.rows)
26
+ else
27
+ SqlLogging::Statistics.record_query(sql, args.first, msec, result)
28
+ end
29
+ result
30
+ end
31
+
32
+ def exec_delete_with_sql_logging(sql, *args)
33
+ result = nil
34
+ elapsed = Benchmark.measure do
35
+ result = exec_delete_without_sql_logging(sql, *args)
36
+ end
37
+ msec = elapsed.real * 1000
38
+ SqlLogging::Statistics.record_query(sql, args.first, msec, result)
39
+ result
40
+ end
41
+
18
42
  alias_method_chain :execute, :sql_logging
43
+ alias_method_chain :exec_query, :sql_logging
44
+ alias_method_chain :exec_delete, :sql_logging
19
45
  end
@@ -1,3 +1,3 @@
1
1
  module SqlLogging
2
- VERSION = '3.0.4'
2
+ VERSION = '3.0.5'
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: 15
4
+ hash: 13
5
5
  prerelease:
6
6
  segments:
7
7
  - 3
8
8
  - 0
9
- - 4
10
- version: 3.0.4
9
+ - 5
10
+ version: 3.0.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Steve Madsen