sequel 5.47.0 → 5.48.0
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 +4 -4
- data/CHANGELOG +8 -0
- data/doc/querying.rdoc +1 -1
- data/doc/release_notes/5.48.0.txt +14 -0
- data/lib/sequel/adapters/shared/mssql.rb +15 -2
- data/lib/sequel/model/errors.rb +10 -1
- data/lib/sequel/plugins/unused_associations.rb +2 -1
- data/lib/sequel/plugins/validation_helpers.rb +5 -8
- data/lib/sequel/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b395c399cd3632c44311c05df70fd6cd0fa924331f665dc964e041ec87013c08
|
4
|
+
data.tar.gz: de423f5ece8a1f212f010d430d671e52cf89e00fa0e952fb69fe8cf9c7931e4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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)
|
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
|
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
|
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.
|
data/lib/sequel/model/errors.rb
CHANGED
@@ -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 :
|
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] ||= {''=>
|
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
|
-
#
|
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
|
-
#
|
73
|
-
#
|
74
|
-
#
|
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
|
data/lib/sequel/version.rb
CHANGED
@@ -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 =
|
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.
|
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-
|
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
|