sequel 4.40.0 → 4.41.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 +30 -0
- data/Rakefile +6 -3
- data/doc/association_basics.rdoc +3 -3
- data/doc/opening_databases.rdoc +3 -3
- data/doc/release_notes/4.41.0.txt +77 -0
- data/doc/schema_modification.rdoc +11 -11
- data/lib/sequel/adapters/ado.rb +137 -9
- data/lib/sequel/adapters/ado/mssql.rb +1 -1
- data/lib/sequel/adapters/jdbc.rb +1 -1
- data/lib/sequel/adapters/mysql2.rb +0 -1
- data/lib/sequel/adapters/shared/db2.rb +30 -10
- data/lib/sequel/adapters/shared/mssql.rb +11 -6
- data/lib/sequel/database/query.rb +3 -6
- data/lib/sequel/database/schema_generator.rb +7 -1
- data/lib/sequel/database/schema_methods.rb +0 -6
- data/lib/sequel/dataset/actions.rb +4 -4
- data/lib/sequel/dataset/graph.rb +3 -2
- data/lib/sequel/dataset/misc.rb +23 -0
- data/lib/sequel/dataset/mutation.rb +15 -14
- data/lib/sequel/dataset/query.rb +25 -5
- data/lib/sequel/extensions/constraint_validations.rb +1 -3
- data/lib/sequel/extensions/sql_comments.rb +6 -1
- data/lib/sequel/model/associations.rb +7 -1
- data/lib/sequel/model/base.rb +1 -1
- data/lib/sequel/plugins/class_table_inheritance.rb +6 -6
- data/lib/sequel/plugins/hook_class_methods.rb +2 -2
- data/lib/sequel/plugins/json_serializer.rb +29 -7
- data/lib/sequel/version.rb +1 -1
- data/spec/adapters/firebird_spec.rb +2 -8
- data/spec/adapters/mssql_spec.rb +12 -12
- data/spec/adapters/mysql_spec.rb +11 -11
- data/spec/adapters/postgres_spec.rb +8 -9
- data/spec/adapters/spec_helper.rb +1 -0
- data/spec/adapters/sqlite_spec.rb +1 -3
- data/spec/core/database_spec.rb +3 -2
- data/spec/core/dataset_spec.rb +66 -22
- data/spec/core/expression_filters_spec.rb +4 -0
- data/spec/core/mock_adapter_spec.rb +1 -1
- data/spec/core/schema_generator_spec.rb +1 -1
- data/spec/core/schema_spec.rb +10 -1
- data/spec/core/spec_helper.rb +1 -0
- data/spec/extensions/class_table_inheritance_spec.rb +3 -0
- data/spec/extensions/connection_expiration_spec.rb +1 -1
- data/spec/extensions/graph_each_spec.rb +6 -0
- data/spec/extensions/hook_class_methods_spec.rb +46 -0
- data/spec/extensions/json_serializer_spec.rb +8 -3
- data/spec/extensions/set_overrides_spec.rb +4 -0
- data/spec/extensions/single_table_inheritance_spec.rb +2 -2
- data/spec/extensions/spec_helper.rb +1 -0
- data/spec/extensions/string_agg_spec.rb +4 -0
- data/spec/extensions/uuid_spec.rb +1 -2
- data/spec/integration/associations_test.rb +14 -0
- data/spec/integration/dataset_test.rb +17 -22
- data/spec/integration/schema_test.rb +3 -3
- data/spec/integration/spec_helper.rb +1 -0
- data/spec/integration/type_test.rb +1 -7
- data/spec/model/associations_spec.rb +26 -1
- data/spec/model/model_spec.rb +7 -1
- data/spec/model/spec_helper.rb +2 -0
- data/spec/sequel_warning.rb +4 -0
- metadata +6 -3
@@ -709,6 +709,11 @@ describe Sequel::Model, "many_to_one" do
|
|
709
709
|
@c2.many_to_one :parent, :class => @c2, :before_set=>Object.new
|
710
710
|
proc{@c2.new.parent = @c2.load(:id=>1)}.must_raise(Sequel::Error)
|
711
711
|
end
|
712
|
+
|
713
|
+
it "should have association dataset use false condition if any key is nil" do
|
714
|
+
@c2.many_to_one :parent, :class => @c2
|
715
|
+
@c2.load({}).parent_dataset.sql.must_equal "SELECT * FROM nodes WHERE 'f' LIMIT 1"
|
716
|
+
end
|
712
717
|
end
|
713
718
|
|
714
719
|
describe Sequel::Model, "one_to_one" do
|
@@ -1144,6 +1149,11 @@ describe Sequel::Model, "one_to_one" do
|
|
1144
1149
|
@c2.load(:id => 567).parent.must_equal @c2.load({})
|
1145
1150
|
DB.sqls.must_equal ["SELECT * FROM nodes WHERE (nodes.node_id = 567) LIMIT 1"]
|
1146
1151
|
end
|
1152
|
+
|
1153
|
+
it "should have association dataset use false condition if any key is nil" do
|
1154
|
+
@c2.one_to_one :parent, :class => @c2, :primary_key=>:parent_id
|
1155
|
+
@c2.load(:id=>1).parent_dataset.sql.must_equal "SELECT * FROM nodes WHERE 'f' LIMIT 1"
|
1156
|
+
end
|
1147
1157
|
end
|
1148
1158
|
|
1149
1159
|
describe Sequel::Model, "one_to_many" do
|
@@ -1909,6 +1919,11 @@ describe Sequel::Model, "one_to_many" do
|
|
1909
1919
|
p.remove_attribute(c).must_equal nil
|
1910
1920
|
p.attributes.must_equal [c]
|
1911
1921
|
end
|
1922
|
+
|
1923
|
+
it "should have association dataset use false condition if any key is nil" do
|
1924
|
+
@c1.one_to_many :children, :class => @c1, :primary_key=>:node_id
|
1925
|
+
@c1.load(:id=>1).children_dataset.sql.must_equal "SELECT * FROM attributes WHERE 'f'"
|
1926
|
+
end
|
1912
1927
|
end
|
1913
1928
|
|
1914
1929
|
describe Sequel::Model, "many_to_many" do
|
@@ -2777,6 +2792,11 @@ describe Sequel::Model, "many_to_many" do
|
|
2777
2792
|
DB.sqls.must_equal ["SELECT attributes.* FROM attributes INNER JOIN attributes_nodes ON (attributes_nodes.attribute_id = attributes.id) WHERE ((attributes_nodes.node_id = 1) AND (join_table_att = 3) AND (attributes.id = 2)) LIMIT 1",
|
2778
2793
|
"DELETE FROM attributes_nodes WHERE ((node_id = 1) AND (attribute_id = 2))"]
|
2779
2794
|
end
|
2795
|
+
|
2796
|
+
it "should have association dataset use false condition if any key is nil" do
|
2797
|
+
@c1.many_to_many :attributes, :class => @c1, :left_primary_key=>:y
|
2798
|
+
@c1.load(:id=>1).attributes_dataset.sql.must_equal "SELECT attributes.* FROM attributes INNER JOIN attributes_attributes ON (attributes_attributes.attribute_id = attributes.id) WHERE 'f'"
|
2799
|
+
end
|
2780
2800
|
end
|
2781
2801
|
|
2782
2802
|
describe Sequel::Model, "one_through_one" do
|
@@ -3051,7 +3071,7 @@ describe Sequel::Model, "one_through_one" do
|
|
3051
3071
|
it "should use a transaction in the setter method" do
|
3052
3072
|
@c2.one_through_one :attribute, :class => @c1
|
3053
3073
|
@c2.use_transactions = true
|
3054
|
-
|
3074
|
+
@c1.load(:id=>3)
|
3055
3075
|
DB.fetch = []
|
3056
3076
|
@c2.new(:id => 1234).attribute = nil
|
3057
3077
|
DB.sqls.must_equal ['BEGIN',
|
@@ -3184,6 +3204,11 @@ describe Sequel::Model, "one_through_one" do
|
|
3184
3204
|
o.attribute = nil
|
3185
3205
|
h.must_equal [1234, -3, 3, :l, 1234, :y, :x, :l]
|
3186
3206
|
end
|
3207
|
+
|
3208
|
+
it "should have association dataset use false condition if any key is nil" do
|
3209
|
+
@c1.one_through_one :attribute, :class => @c1, :left_primary_key=>:y
|
3210
|
+
@c1.load(:id=>1).attribute_dataset.sql.must_equal "SELECT attributes.* FROM attributes INNER JOIN attributes_attributes ON (attributes_attributes.attribute_id = attributes.id) WHERE 'f' LIMIT 1"
|
3211
|
+
end
|
3187
3212
|
end
|
3188
3213
|
|
3189
3214
|
describe "Filtering by associations" do
|
data/spec/model/model_spec.rb
CHANGED
@@ -109,6 +109,12 @@ describe "Sequel::Model()" do
|
|
109
109
|
Object.send(:remove_const, :Album) if defined?(::Album)
|
110
110
|
end
|
111
111
|
|
112
|
+
it "Sequel.cache_anonymous_models should return value for Sequel::Model" do
|
113
|
+
Sequel.cache_anonymous_models.must_equal true
|
114
|
+
Sequel::Model.cache_anonymous_models = false
|
115
|
+
Sequel.cache_anonymous_models.must_equal false
|
116
|
+
end
|
117
|
+
|
112
118
|
it "should work without raising an exception with a symbol" do
|
113
119
|
class ::Album < Sequel::Model(:table); end
|
114
120
|
class ::Album < Sequel::Model(:table); end
|
@@ -315,7 +321,7 @@ describe Sequel::Model do
|
|
315
321
|
def db.supports_savepoints?; true end
|
316
322
|
Sequel::Model(db[:table])
|
317
323
|
db.sqls.must_equal ["SELECT * FROM table LIMIT 1"]
|
318
|
-
|
324
|
+
db.transaction{Sequel::Model(db[:table])}
|
319
325
|
db.sqls.must_equal ["BEGIN", "SAVEPOINT autopoint_1", "SELECT * FROM table LIMIT 1", "RELEASE SAVEPOINT autopoint_1", "COMMIT"]
|
320
326
|
end
|
321
327
|
|
data/spec/model/spec_helper.rb
CHANGED
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: 4.
|
4
|
+
version: 4.41.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: 2016-
|
11
|
+
date: 2016-12-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -241,6 +241,7 @@ extra_rdoc_files:
|
|
241
241
|
- doc/release_notes/4.38.0.txt
|
242
242
|
- doc/release_notes/4.39.0.txt
|
243
243
|
- doc/release_notes/4.40.0.txt
|
244
|
+
- doc/release_notes/4.41.0.txt
|
244
245
|
files:
|
245
246
|
- CHANGELOG
|
246
247
|
- MIT-LICENSE
|
@@ -371,6 +372,7 @@ files:
|
|
371
372
|
- doc/release_notes/4.39.0.txt
|
372
373
|
- doc/release_notes/4.4.0.txt
|
373
374
|
- doc/release_notes/4.40.0.txt
|
375
|
+
- doc/release_notes/4.41.0.txt
|
374
376
|
- doc/release_notes/4.5.0.txt
|
375
377
|
- doc/release_notes/4.6.0.txt
|
376
378
|
- doc/release_notes/4.7.0.txt
|
@@ -894,6 +896,7 @@ files:
|
|
894
896
|
- spec/model_spec.rb
|
895
897
|
- spec/plugin_spec.rb
|
896
898
|
- spec/sequel_coverage.rb
|
899
|
+
- spec/sequel_warning.rb
|
897
900
|
- spec/spec_config.rb
|
898
901
|
homepage: http://sequel.jeremyevans.net
|
899
902
|
licenses:
|
@@ -922,7 +925,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
922
925
|
version: '0'
|
923
926
|
requirements: []
|
924
927
|
rubyforge_project:
|
925
|
-
rubygems_version: 2.
|
928
|
+
rubygems_version: 2.6.8
|
926
929
|
signing_key:
|
927
930
|
specification_version: 4
|
928
931
|
summary: The Database Toolkit for Ruby
|