sequel 5.47.0 → 5.48.0

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: 191a57b6bd41c00e023891afaddbebffeb1f54017c663d2a9b32faf83584bf1f
4
- data.tar.gz: d158aa702dfe28dbe624b551ed455615017942caf990c599f077a4fb53f6b533
3
+ metadata.gz: b395c399cd3632c44311c05df70fd6cd0fa924331f665dc964e041ec87013c08
4
+ data.tar.gz: de423f5ece8a1f212f010d430d671e52cf89e00fa0e952fb69fe8cf9c7931e4c
5
5
  SHA512:
6
- metadata.gz: 5c91ce33e0191d342f34dbeb4a402153bedc6d46a1df56d99b1393cf559bb9edd837e3eca8f259e1f7856990015e40098cbb269cbc9e915fa4dac9fc254c8e0c
7
- data.tar.gz: 9d789484e942ac7380e6dbae64b3e0fb27aeaf9d3fc6764f2e6d6e86c17296cdab116cd6c8d53c429044604a429fdaf18536b6f68b728f5031a81aba81f4107b
6
+ metadata.gz: 475081e84ac0c0ef2b05e642d02cf3956cf263cebc280ecd469401a9c3ed591c8854fe42e687343e68effe47e6cc0f4f12f73734e5477a8749406a8ae94afe15
7
+ data.tar.gz: eb5a432efd4e788461422ee754ace25d14add6a6117d10064446f31b3d719943bd4a935b3e70db10613205cf1d7bb980aaaf850449299a8f1861466aa0dcb50f
data/CHANGELOG CHANGED
@@ -1,3 +1,11 @@
1
+ === 5.48.0 (2021-09-01)
2
+
3
+ * Make the unused_associations plugin association reflection tracking work correctly when combining coverage runs (jeremyevans)
4
+
5
+ * Add Database#like_without_collate on MSSQL, to avoid using COLLATE on LIKE arguments, which can significantly improve performance (jeremyevans)
6
+
7
+ * Add Model::Errors#full_message private method for easiest i18n support for errors with multiple attributes (jeremyevans) (#1779)
8
+
1
9
  === 5.47.0 (2021-08-01)
2
10
 
3
11
  * Make the unused_associations plugin track access to association reflections to determine whether associations are used (jeremyevans)
data/doc/querying.rdoc CHANGED
@@ -498,7 +498,7 @@ filters:
498
498
  # SELECT * FROM artists WHERE (id != 5)
499
499
 
500
500
  Artist.where(id: 5).exclude{name > 'A'}
501
- # SELECT * FROM artists WHERE ((id = 5) OR (name <= 'A')
501
+ # SELECT * FROM artists WHERE ((id = 5) AND (name <= 'A')
502
502
 
503
503
  So to do a NOT IN with an array:
504
504
 
@@ -0,0 +1,14 @@
1
+ = New Features
2
+
3
+ * A Sequel::Database#like_without_collate accessor has been added on
4
+ Microsoft SQL Server, which avoids using the COLLATE clause for
5
+ LIKE expressions. This can speed up query performance significantly.
6
+
7
+ * A private Sequel::Model::Errors#full_message method has been added
8
+ to make it easier to support internationalization for Sequel::Model
9
+ error messages.
10
+
11
+ = Other Improvements
12
+
13
+ * The association reflection tracking in the unused_associations
14
+ plugin now works correctly when combining coverage runs.
@@ -24,6 +24,10 @@ module Sequel
24
24
  # Database object.
25
25
  attr_accessor :mssql_unicode_strings
26
26
 
27
+ # Whether to use LIKE without COLLATE Latin1_General_CS_AS. Skipping the COLLATE
28
+ # can significantly increase performance in some cases.
29
+ attr_accessor :like_without_collate
30
+
27
31
  # Execute the given stored procedure with the given name.
28
32
  #
29
33
  # Options:
@@ -548,9 +552,9 @@ module Sequel
548
552
  when :'||'
549
553
  super(sql, :+, args)
550
554
  when :LIKE, :"NOT LIKE"
551
- super(sql, op, args.map{|a| Sequel.lit(["(", " COLLATE Latin1_General_CS_AS)"], a)})
555
+ super(sql, op, complex_expression_sql_like_args(args, " COLLATE Latin1_General_CS_AS)"))
552
556
  when :ILIKE, :"NOT ILIKE"
553
- super(sql, (op == :ILIKE ? :LIKE : :"NOT LIKE"), args.map{|a| Sequel.lit(["(", " COLLATE Latin1_General_CI_AS)"], a)})
557
+ super(sql, (op == :ILIKE ? :LIKE : :"NOT LIKE"), complex_expression_sql_like_args(args, " COLLATE Latin1_General_CI_AS)"))
554
558
  when :<<, :>>
555
559
  complex_expression_emulate_append(sql, op, args)
556
560
  when :extract
@@ -847,6 +851,15 @@ module Sequel
847
851
  server_version >= 11000000
848
852
  end
849
853
 
854
+ # Determine whether to add the COLLATE for LIKE arguments, based on the Database setting.
855
+ def complex_expression_sql_like_args(args, collation)
856
+ if db.like_without_collate
857
+ args
858
+ else
859
+ args.map{|a| Sequel.lit(["(", collation], a)}
860
+ end
861
+ end
862
+
850
863
  # Use strict ISO-8601 format with T between date and time,
851
864
  # since that is the format that is multilanguage and not
852
865
  # DATEFORMAT dependent.
@@ -38,7 +38,7 @@ module Sequel
38
38
  def full_messages
39
39
  inject([]) do |m, kv|
40
40
  att, errors = *kv
41
- errors.each {|e| m << (e.is_a?(LiteralString) ? e : "#{Array(att).join(' and ')} #{e}")}
41
+ errors.each {|e| m << (e.is_a?(LiteralString) ? e : full_message(att, e))}
42
42
  m
43
43
  end
44
44
  end
@@ -53,6 +53,15 @@ module Sequel
53
53
  v
54
54
  end
55
55
  end
56
+
57
+ private
58
+
59
+ # Create full error message to use for the given attribute (or array of attributes)
60
+ # and error message. This can be overridden for easier internalization.
61
+ def full_message(att, error_msg)
62
+ att = att.join(' and ') if att.is_a?(Array)
63
+ "#{att} #{error_msg}"
64
+ end
56
65
  end
57
66
  end
58
67
  end
@@ -316,7 +316,8 @@ module Sequel
316
316
  ([self] + descendents).each do |sc|
317
317
  next if sc.associations.empty? || !sc.name
318
318
  module_mapping[sc.send(:overridable_methods_module)] = sc
319
- coverage_data[sc.name] ||= {''=>sc.used_association_reflections.keys.map(&:to_s).sort}
319
+ cov_data = coverage_data[sc.name] ||= {''=>[]}
320
+ cov_data[''].concat(sc.used_association_reflections.keys.map(&:to_s).sort).uniq!
320
321
  end
321
322
 
322
323
  coverage_result.each do |file, coverage|
@@ -66,16 +66,13 @@ module Sequel
66
66
  # integer: "is not a number"
67
67
  #
68
68
  # Note that if you want to support internationalization of Errors#full_messages,
69
- # you need to override the method. Here's an example:
69
+ # it is easiest to override Errors#full_message (note singular form and not plural form).
70
+ # Here's an example:
70
71
  #
71
72
  # class Sequel::Model::Errors
72
- # def full_messages
73
- # inject([]) do |m, kv|
74
- # att, errors = *kv
75
- # att.is_a?(Array) ? Array(att).map!{|v| I18n.t("attributes.#{v}")} : att = I18n.t("attributes.#{att}")
76
- # errors.each {|e| m << (e.is_a?(LiteralString) ? e : "#{Array(att).join(I18n.t('errors.joiner'))} #{e}")}
77
- # m
78
- # end
73
+ # private
74
+ # def full_message(attribute, error_msg)
75
+ # "#{Array(attribute).join(I18n.t('errors.joiner'))} #{error_msg}"
79
76
  # end
80
77
  # end
81
78
  module ValidationHelpers
@@ -6,7 +6,7 @@ module Sequel
6
6
 
7
7
  # The minor version of Sequel. Bumped for every non-patch level
8
8
  # release, generally around once a month.
9
- MINOR = 47
9
+ MINOR = 48
10
10
 
11
11
  # The tiny version of Sequel. Usually 0, only bumped for bugfix
12
12
  # releases that fix regressions from previous versions.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sequel
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.47.0
4
+ version: 5.48.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Evans
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-01 00:00:00.000000000 Z
11
+ date: 2021-09-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
@@ -191,6 +191,7 @@ extra_rdoc_files:
191
191
  - doc/release_notes/5.45.0.txt
192
192
  - doc/release_notes/5.46.0.txt
193
193
  - doc/release_notes/5.47.0.txt
194
+ - doc/release_notes/5.48.0.txt
194
195
  - doc/release_notes/5.5.0.txt
195
196
  - doc/release_notes/5.6.0.txt
196
197
  - doc/release_notes/5.7.0.txt
@@ -266,6 +267,7 @@ files:
266
267
  - doc/release_notes/5.45.0.txt
267
268
  - doc/release_notes/5.46.0.txt
268
269
  - doc/release_notes/5.47.0.txt
270
+ - doc/release_notes/5.48.0.txt
269
271
  - doc/release_notes/5.5.0.txt
270
272
  - doc/release_notes/5.6.0.txt
271
273
  - doc/release_notes/5.7.0.txt