rom-sql 3.6.2 → 3.6.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a66a6f386f99391a91f6e72d746bf252ebfcf7428c225d98b19035e6f2a1b09a
4
- data.tar.gz: 828f97dec8dbe879462a7185f7fcf68df4a70e5a76583bc033d2d28e571e4ca2
3
+ metadata.gz: a3a5d8acca77c2d148be8cdfc268eee1851619947eed8923d6b174a05c199a32
4
+ data.tar.gz: 3c3780102c9055ceada519a2638761b90b43ad3f1b8d6f71063c2aee6817f2f4
5
5
  SHA512:
6
- metadata.gz: ff8b53eda3cae629dd719e459647033c59de0f605a83d3b2b616ee1780673f1e25a655e8df9da5b9bc66ac60893be927240a906734f1f92785ee7e24dcfd637d
7
- data.tar.gz: 2d35c254478bd63ad9636c6f6f7ae516c39c463adc98eae524dcac0b04673138f43a9499c76014f98fb8c554abb14b3f734b3195bfbd6b54e75ce06d9f24c8ab
6
+ metadata.gz: 452127dc2b154c8e513efc34e698c8fe4de0be2de9e21746b584fa14cb3642d3a2ce3ba0d085db54fa6153a1b796a5fd422fce6e24095cd8588028ed7924670d
7
+ data.tar.gz: d8fec6ff6f5ad4ce1d37eca0a51a4ed0f412d8ef611ca29fbc41c285ff46ec419fd0e94cf17ebc63a4c7314791514de71400200826540d2aa5a366b21b7427ba
data/CHANGELOG.md CHANGED
@@ -1,5 +1,36 @@
1
1
  <!--- DO NOT EDIT THIS FILE - IT'S AUTOMATICALLY GENERATED VIA DEVTOOLS --->
2
2
 
3
+ ## 3.6.4 2024-07-01
4
+
5
+
6
+ ### Fixed
7
+
8
+ - Excessive logging when same gateway is shared between multiple containers (@flash-gordon)
9
+ - Warning about using color option from active-support log subscriber (@flash-gordon + @bendangelo)
10
+
11
+
12
+ [Compare v3.6.3...v3.6.4](https://github.com/rom-rb/rom-sql/compare/v3.6.3...v3.6.4)
13
+
14
+ ## 3.6.3 2024-05-06
15
+
16
+
17
+ ### Fixed
18
+
19
+ - Fix using `.filter` with a block for aggregate functions (@flash-gordon)
20
+
21
+
22
+ [Compare v3.6.2...v3.6.3](https://github.com/rom-rb/rom-sql/compare/v3.6.2...v3.6.3)
23
+
24
+ ## 3.6.2 2024-01-09
25
+
26
+
27
+ ### Fixed
28
+
29
+ - Fix Hash.new warning in Ruby 3.3 (@flash-gordon)
30
+
31
+
32
+ [Compare v3.6.1...v3.6.2](https://github.com/rom-rb/rom-sql/compare/v3.6.1...v3.6.2)
33
+
3
34
  ## 3.6.1 2022-11-22
4
35
 
5
36
  ### Fixed
@@ -35,6 +35,8 @@ module ROM
35
35
  db_notifications = relations.values.map { |r| [r.dataset.db, r.notifications] }.uniq.to_h
36
36
 
37
37
  db_notifications.each do |db, notifications|
38
+ next if db.respond_to?(:rom_instrumentation?)
39
+
38
40
  instrumenter = Instrumenter.new(db.database_type, notifications)
39
41
  db.extend(instrumenter)
40
42
  end
@@ -56,6 +58,8 @@ module ROM
56
58
 
57
59
  # @api private
58
60
  def initialize(name, notifications)
61
+ super()
62
+
59
63
  @name = name
60
64
  @notifications = notifications
61
65
  define_log_connection_yield
@@ -68,6 +72,8 @@ module ROM
68
72
  name = self.name
69
73
  notifications = self.notifications
70
74
 
75
+ define_method(:rom_instrumentation?) { true }
76
+
71
77
  define_method(:log_connection_yield) do |*args, &block|
72
78
  notifications.instrument(:sql, name: name, query: args[0]) do
73
79
  super(*args, &block)
@@ -5,6 +5,21 @@ require 'active_support/log_subscriber'
5
5
  module ROM
6
6
  module SQL
7
7
  class RailsLogSubscriber < ActiveSupport::LogSubscriber
8
+ as_version =
9
+ begin
10
+ require "active_support/gem_version"
11
+ ActiveSupport.gem_version
12
+ rescue LoadError
13
+ nil
14
+ end
15
+
16
+ COLOR_OPTION =
17
+ if as_version && as_version >= Gem::Version.new("7.2")
18
+ {color: true}
19
+ else
20
+ true
21
+ end
22
+
8
23
  def sql(event)
9
24
  return unless logger.debug?
10
25
 
@@ -15,10 +30,10 @@ module ROM
15
30
  binds = payload[:binds].to_a.inspect if payload[:binds]
16
31
 
17
32
  if odd?
18
- name = color(name, :cyan, true)
19
- sql = color(sql, nil, true)
33
+ name = color(name, :cyan, COLOR_OPTION)
34
+ sql = color(sql, nil, COLOR_OPTION)
20
35
  else
21
- name = color(name, :magenta, true)
36
+ name = color(name, :magenta, COLOR_OPTION)
22
37
  end
23
38
 
24
39
  debug " #{name} #{sql} #{binds}"
@@ -37,7 +37,7 @@ module ROM
37
37
  #
38
38
  # @api public
39
39
  def function(name, *attrs)
40
- ::ROM::SQL::Function.new(::ROM::Types::Any, schema: schema).public_send(name, *attrs)
40
+ ::ROM::SQL::Function.new(::ROM::Types::Any).meta(schema: schema).public_send(name, *attrs)
41
41
  end
42
42
  alias_method :f, :function
43
43
 
@@ -57,7 +57,7 @@ module ROM
57
57
 
58
58
  if type
59
59
  if args.empty?
60
- ::ROM::SQL::Function.new(type, schema: schema)
60
+ ::ROM::SQL::Function.new(type).meta(schema: schema)
61
61
  else
62
62
  ::ROM::SQL::Attribute[type].value(args[0])
63
63
  end
@@ -27,7 +27,7 @@ module ROM
27
27
  type = type(meth)
28
28
 
29
29
  if type
30
- ::ROM::SQL::Function.new(type)
30
+ ::ROM::SQL::Function.new(type).meta(schema: schema)
31
31
  else
32
32
  ::Sequel::VIRTUAL_ROW.__send__(meth, *args, &block)
33
33
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module ROM
4
4
  module SQL
5
- VERSION = '3.6.2'.freeze
5
+ VERSION = "3.6.4"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rom-sql
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.6.2
4
+ version: 3.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Solnica
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-09 00:00:00.000000000 Z
11
+ date: 2024-07-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sequel