prosopite 1.3.1 → 1.3.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3620722495a4f378b76f94846d24104ec2b8bda051243246070fe9a8ab0e9e35
4
- data.tar.gz: 455827914e23b7714efe0c1851050699cabb2210d494e2cdba9102afb8ab329b
3
+ metadata.gz: 8c8b1d214700a04038d35504395ed1fa721fdd5104ae1f35543e3413911c3b02
4
+ data.tar.gz: 26916d6b3aa02125a33a68c088bfc0ea6d45c7c59176fb94cba71d141262fc15
5
5
  SHA512:
6
- metadata.gz: 4f31607760d147b9df2323d9b6032d3290a7467918a5ae2b8abfe60657b2befa322c91cd7a3d9ab62b1b7dee113c4db5bee3066a4afeb2e0691b5f24d96fd956
7
- data.tar.gz: 5c49dd603ea2720cd3c60846d0d63a9a1e818be3be287f050fc33ccf5654e619f7ee6fb9378e3f36ae07b6c3b5d5f2791e7f72078b6f6606346700587667449c
6
+ metadata.gz: 24e5417f68bdec3257ce28f1c0f08e3cd4c7ada8c39306e97afebde974e996655000dd6418799d0974c67793d83415c07ba3df68a19b66a37dc88f57166fb8ff
7
+ data.tar.gz: ffa1c74fb3e3d20fb0b34a68259ebe7098a54aade4224b7f4ae92fb933e33eee68e9ff6bb7f656d281874ee7b1a6447af72e8e063e6d11cae2271d451dac2905
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- prosopite (1.3.1)
4
+ prosopite (1.3.3)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Prosopite
4
- VERSION = "1.3.1"
4
+ VERSION = "1.3.3"
5
5
  end
data/lib/prosopite.rb CHANGED
@@ -12,12 +12,13 @@ module Prosopite
12
12
  :rails_logger,
13
13
  :prosopite_logger,
14
14
  :custom_logger,
15
- :allow_stack_paths,
16
- :ignore_queries,
17
15
  :ignore_pauses,
18
- :min_n_queries,
19
16
  :backtrace_cleaner
20
17
 
18
+ attr_accessor :allow_stack_paths,
19
+ :ignore_queries,
20
+ :min_n_queries
21
+
21
22
  def allow_list=(value)
22
23
  puts "Prosopite.allow_list= is deprecated. Use Prosopite.allow_stack_paths= instead."
23
24
 
@@ -179,6 +180,8 @@ module Prosopite
179
180
 
180
181
  query.gsub!(/\b(in|values?)(?:[\s,]*\([\s?,]*\))+/, "\\1(?+)")
181
182
 
183
+ query.gsub!(/(?<!\w)field\s*\(\s*(\S+)\s*,\s*(\?+)(?:\s*,\s*\?+)*\)/, 'field(\1, \2+)')
184
+
182
185
  query.gsub!(/\b(select\s.*?)(?:(\sunion(?:\sall)?)\s\1)+/, "\\1 /*repeat\\2*/")
183
186
 
184
187
  query.gsub!(/\blimit \?(?:, ?\?| offset \?)/, "limit ?")
@@ -244,13 +247,14 @@ module Prosopite
244
247
  sql, name = data[:sql], data[:name]
245
248
 
246
249
  if scan? && name != "SCHEMA" && sql.include?('SELECT') && data[:cached].nil? && !ignore_query?(sql)
247
- location_key = Digest::SHA1.hexdigest(caller.join)
250
+ query_caller = caller
251
+ location_key = Digest::SHA256.hexdigest(query_caller.join)
248
252
 
249
253
  tc[:prosopite_query_counter][location_key] += 1
250
254
  tc[:prosopite_query_holder][location_key] << sql
251
255
 
252
256
  if tc[:prosopite_query_counter][location_key] > 1
253
- tc[:prosopite_query_caller][location_key] = caller.dup
257
+ tc[:prosopite_query_caller][location_key] = query_caller.dup
254
258
  end
255
259
  end
256
260
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prosopite
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mpampis Kostas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-10 00:00:00.000000000 Z
11
+ date: 2023-08-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry