sequel 3.36.1 → 3.37.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +84 -0
- data/Rakefile +13 -0
- data/bin/sequel +12 -16
- data/doc/advanced_associations.rdoc +36 -67
- data/doc/association_basics.rdoc +11 -16
- data/doc/release_notes/3.37.0.txt +338 -0
- data/doc/schema_modification.rdoc +4 -0
- data/lib/sequel/adapters/jdbc/h2.rb +1 -1
- data/lib/sequel/adapters/jdbc/postgresql.rb +26 -8
- data/lib/sequel/adapters/mysql2.rb +4 -3
- data/lib/sequel/adapters/odbc/mssql.rb +2 -2
- data/lib/sequel/adapters/postgres.rb +4 -60
- data/lib/sequel/adapters/shared/mssql.rb +2 -1
- data/lib/sequel/adapters/shared/mysql.rb +0 -5
- data/lib/sequel/adapters/shared/postgres.rb +68 -2
- data/lib/sequel/adapters/shared/sqlite.rb +17 -1
- data/lib/sequel/adapters/utils/emulate_offset_with_row_number.rb +12 -1
- data/lib/sequel/adapters/utils/pg_types.rb +76 -0
- data/lib/sequel/core.rb +13 -0
- data/lib/sequel/database/misc.rb +41 -1
- data/lib/sequel/database/schema_generator.rb +23 -10
- data/lib/sequel/database/schema_methods.rb +26 -4
- data/lib/sequel/dataset/graph.rb +2 -1
- data/lib/sequel/dataset/query.rb +62 -2
- data/lib/sequel/extensions/_pretty_table.rb +7 -3
- data/lib/sequel/extensions/arbitrary_servers.rb +5 -4
- data/lib/sequel/extensions/blank.rb +4 -0
- data/lib/sequel/extensions/columns_introspection.rb +13 -2
- data/lib/sequel/extensions/core_extensions.rb +6 -0
- data/lib/sequel/extensions/eval_inspect.rb +158 -0
- data/lib/sequel/extensions/inflector.rb +4 -0
- data/lib/sequel/extensions/looser_typecasting.rb +5 -4
- data/lib/sequel/extensions/migration.rb +4 -1
- data/lib/sequel/extensions/named_timezones.rb +4 -0
- data/lib/sequel/extensions/null_dataset.rb +4 -0
- data/lib/sequel/extensions/pagination.rb +4 -0
- data/lib/sequel/extensions/pg_array.rb +219 -168
- data/lib/sequel/extensions/pg_array_ops.rb +7 -2
- data/lib/sequel/extensions/pg_auto_parameterize.rb +10 -4
- data/lib/sequel/extensions/pg_hstore.rb +3 -1
- data/lib/sequel/extensions/pg_hstore_ops.rb +7 -2
- data/lib/sequel/extensions/pg_inet.rb +28 -3
- data/lib/sequel/extensions/pg_interval.rb +192 -0
- data/lib/sequel/extensions/pg_json.rb +21 -9
- data/lib/sequel/extensions/pg_range.rb +487 -0
- data/lib/sequel/extensions/pg_range_ops.rb +122 -0
- data/lib/sequel/extensions/pg_statement_cache.rb +3 -2
- data/lib/sequel/extensions/pretty_table.rb +12 -1
- data/lib/sequel/extensions/query.rb +4 -0
- data/lib/sequel/extensions/query_literals.rb +6 -6
- data/lib/sequel/extensions/schema_dumper.rb +39 -38
- data/lib/sequel/extensions/select_remove.rb +4 -0
- data/lib/sequel/extensions/server_block.rb +3 -2
- data/lib/sequel/extensions/split_array_nil.rb +65 -0
- data/lib/sequel/extensions/sql_expr.rb +4 -0
- data/lib/sequel/extensions/string_date_time.rb +4 -0
- data/lib/sequel/extensions/thread_local_timezones.rb +9 -3
- data/lib/sequel/extensions/to_dot.rb +4 -0
- data/lib/sequel/model/associations.rb +150 -91
- data/lib/sequel/plugins/identity_map.rb +2 -2
- data/lib/sequel/plugins/list.rb +1 -0
- data/lib/sequel/plugins/many_through_many.rb +33 -32
- data/lib/sequel/plugins/nested_attributes.rb +11 -3
- data/lib/sequel/plugins/rcte_tree.rb +2 -2
- data/lib/sequel/plugins/schema.rb +1 -1
- data/lib/sequel/sql.rb +14 -14
- data/lib/sequel/version.rb +2 -2
- data/spec/adapters/mysql_spec.rb +25 -0
- data/spec/adapters/postgres_spec.rb +572 -28
- data/spec/adapters/sqlite_spec.rb +16 -1
- data/spec/core/database_spec.rb +61 -2
- data/spec/core/dataset_spec.rb +92 -0
- data/spec/core/expression_filters_spec.rb +12 -0
- data/spec/extensions/arbitrary_servers_spec.rb +1 -1
- data/spec/extensions/boolean_readers_spec.rb +25 -25
- data/spec/extensions/eval_inspect_spec.rb +58 -0
- data/spec/extensions/json_serializer_spec.rb +0 -6
- data/spec/extensions/list_spec.rb +1 -1
- data/spec/extensions/looser_typecasting_spec.rb +7 -7
- data/spec/extensions/many_through_many_spec.rb +81 -0
- data/spec/extensions/nested_attributes_spec.rb +21 -4
- data/spec/extensions/pg_array_ops_spec.rb +1 -11
- data/spec/extensions/pg_array_spec.rb +181 -90
- data/spec/extensions/pg_auto_parameterize_spec.rb +3 -3
- data/spec/extensions/pg_hstore_spec.rb +1 -3
- data/spec/extensions/pg_inet_spec.rb +6 -1
- data/spec/extensions/pg_interval_spec.rb +73 -0
- data/spec/extensions/pg_json_spec.rb +5 -9
- data/spec/extensions/pg_range_ops_spec.rb +49 -0
- data/spec/extensions/pg_range_spec.rb +372 -0
- data/spec/extensions/pg_statement_cache_spec.rb +1 -2
- data/spec/extensions/query_literals_spec.rb +1 -2
- data/spec/extensions/schema_dumper_spec.rb +48 -89
- data/spec/extensions/serialization_spec.rb +1 -5
- data/spec/extensions/server_block_spec.rb +2 -2
- data/spec/extensions/spec_helper.rb +12 -2
- data/spec/extensions/split_array_nil_spec.rb +24 -0
- data/spec/integration/associations_test.rb +4 -4
- data/spec/integration/database_test.rb +2 -2
- data/spec/integration/dataset_test.rb +4 -4
- data/spec/integration/eager_loader_test.rb +6 -6
- data/spec/integration/plugin_test.rb +2 -2
- data/spec/integration/spec_helper.rb +2 -2
- data/spec/model/association_reflection_spec.rb +5 -0
- data/spec/model/associations_spec.rb +156 -49
- data/spec/model/eager_loading_spec.rb +137 -2
- data/spec/model/model_spec.rb +10 -10
- metadata +15 -2
@@ -13,6 +13,10 @@ describe Sequel::Model, "#eager" do
|
|
13
13
|
many_to_one :band_name, :class=>'EagerBand', :key=>:band_id, :select=>[:id, :name]
|
14
14
|
one_to_many :track_names, :class=>'EagerTrack', :key=>:album_id, :select=>[:id, :name]
|
15
15
|
many_to_many :genre_names, :class=>'EagerGenre', :left_key=>:album_id, :right_key=>:genre_id, :join_table=>:ag, :select=>[:id]
|
16
|
+
|
17
|
+
def band_id3
|
18
|
+
band_id*3
|
19
|
+
end
|
16
20
|
end
|
17
21
|
|
18
22
|
class ::EagerBand < Sequel::Model(:bands)
|
@@ -29,6 +33,10 @@ describe Sequel::Model, "#eager" do
|
|
29
33
|
end
|
30
34
|
one_to_many :albums_by_name, :class=>'EagerAlbum', :key=>:band_id, :order=>:name, :allow_eager=>false
|
31
35
|
one_to_many :top_10_albums, :class=>'EagerAlbum', :key=>:band_id, :limit=>10
|
36
|
+
|
37
|
+
def id3
|
38
|
+
id/3
|
39
|
+
end
|
32
40
|
end
|
33
41
|
|
34
42
|
class ::EagerTrack < Sequel::Model(:tracks)
|
@@ -90,6 +98,26 @@ describe Sequel::Model, "#eager" do
|
|
90
98
|
[:EagerAlbum, :EagerBand, :EagerTrack, :EagerGenre, :EagerBandMember].each{|x| Object.send(:remove_const, x)}
|
91
99
|
end
|
92
100
|
|
101
|
+
it "should populate :key_hash and :id_map option correctly for custom eager loaders" do
|
102
|
+
khs = {}
|
103
|
+
pr = proc{|a, m| proc{|h| khs[a] = h[:key_hash][m]; h[:id_map].should == h[:key_hash][m]}}
|
104
|
+
EagerAlbum.many_to_one :sband, :clone=>:band, :eager_loader=>pr.call(:sband, :band_id)
|
105
|
+
EagerAlbum.one_to_many :stracks, :clone=>:tracks, :eager_loader=>pr.call(:stracks, :id)
|
106
|
+
EagerAlbum.many_to_many :sgenres, :clone=>:genres, :eager_loader=>pr.call(:sgenres, :id)
|
107
|
+
EagerAlbum.eager(:sband, :stracks, :sgenres).all
|
108
|
+
khs.should == {:sband=>{2=>[EagerAlbum.load(:band_id=>2, :id=>1)]}, :stracks=>{1=>[EagerAlbum.load(:band_id=>2, :id=>1)]}, :sgenres=>{1=>[EagerAlbum.load(:band_id=>2, :id=>1)]}}
|
109
|
+
end
|
110
|
+
|
111
|
+
it "should populate :key_hash using the method symbol" do
|
112
|
+
khs = {}
|
113
|
+
pr = proc{|a, m| proc{|h| khs[a] = h[:key_hash][m]}}
|
114
|
+
EagerAlbum.many_to_one :sband, :clone=>:band, :eager_loader=>pr.call(:sband, :band_id), :key=>:band_id, :key_column=>:b_id
|
115
|
+
EagerAlbum.one_to_many :stracks, :clone=>:tracks, :eager_loader=>pr.call(:stracks, :id), :primary_key=>:id, :primary_key_column=>:i
|
116
|
+
EagerAlbum.many_to_many :sgenres, :clone=>:genres, :eager_loader=>pr.call(:sgenres, :id), :left_primary_key=>:id, :left_primary_key_column=>:i
|
117
|
+
EagerAlbum.eager(:sband, :stracks, :sgenres).all
|
118
|
+
khs.should == {:sband=>{2=>[EagerAlbum.load(:band_id=>2, :id=>1)]}, :stracks=>{1=>[EagerAlbum.load(:band_id=>2, :id=>1)]}, :sgenres=>{1=>[EagerAlbum.load(:band_id=>2, :id=>1)]}}
|
119
|
+
end
|
120
|
+
|
93
121
|
it "should raise an error if called without a symbol or hash" do
|
94
122
|
proc{EagerAlbum.eager(Object.new)}.should raise_error(Sequel::Error)
|
95
123
|
end
|
@@ -189,6 +217,80 @@ describe Sequel::Model, "#eager" do
|
|
189
217
|
MODEL_DB.sqls.should == []
|
190
218
|
end
|
191
219
|
|
220
|
+
it "should support using a custom :key option when eager loading many_to_one associations" do
|
221
|
+
EagerAlbum.many_to_one :sband, :clone=>:band, :key=>:band_id3
|
222
|
+
EagerBand.dataset._fetch = {:id=>6}
|
223
|
+
a = EagerAlbum.eager(:sband).all
|
224
|
+
MODEL_DB.sqls.should == ['SELECT * FROM albums', 'SELECT * FROM bands WHERE (bands.id IN (6))']
|
225
|
+
a.should == [EagerAlbum.load(:id => 1, :band_id => 2)]
|
226
|
+
a.first.sband.should == EagerBand.load(:id=>6)
|
227
|
+
MODEL_DB.sqls.should == []
|
228
|
+
end
|
229
|
+
|
230
|
+
it "should support using a custom :primary_key option when eager loading one_to_many associations" do
|
231
|
+
EagerBand.one_to_many :salbums, :clone=>:albums, :primary_key=>:id3, :eager=>nil
|
232
|
+
EagerBand.dataset._fetch = {:id=>6}
|
233
|
+
a = EagerBand.eager(:salbums).all
|
234
|
+
MODEL_DB.sqls.should == ['SELECT * FROM bands', 'SELECT * FROM albums WHERE (albums.band_id IN (2))']
|
235
|
+
a.should == [EagerBand.load(:id => 6)]
|
236
|
+
a.first.salbums.should == [EagerAlbum.load(:id => 1, :band_id => 2)]
|
237
|
+
MODEL_DB.sqls.should == []
|
238
|
+
end
|
239
|
+
|
240
|
+
it "should support using a custom :left_primary_key option when eager loading many_to_many associations" do
|
241
|
+
EagerAlbum.many_to_many :sgenres, :clone=>:genres, :left_primary_key=>:band_id3
|
242
|
+
EagerGenre.dataset._fetch = {:id=>4, :x_foreign_key_x=>6}
|
243
|
+
a = EagerAlbum.eager(:sgenres).all
|
244
|
+
a.should == [EagerAlbum.load(:id => 1, :band_id => 2)]
|
245
|
+
MODEL_DB.sqls.should == ['SELECT * FROM albums', "SELECT genres.*, ag.album_id AS x_foreign_key_x FROM genres INNER JOIN ag ON ((ag.genre_id = genres.id) AND (ag.album_id IN (6)))"]
|
246
|
+
a.first.sgenres.should == [EagerGenre.load(:id=>4)]
|
247
|
+
MODEL_DB.sqls.should == []
|
248
|
+
end
|
249
|
+
|
250
|
+
it "should handle a :eager_loading_predicate_key option to change the SQL used in the lookup, for many_to_one associations" do
|
251
|
+
EagerAlbum.many_to_one :sband, :clone=>:band, :eager_loading_predicate_key=>Sequel./(:bands__id, 3), :primary_key_method=>:id3
|
252
|
+
EagerBand.dataset._fetch = {:id=>6}
|
253
|
+
a = EagerAlbum.eager(:sband).all
|
254
|
+
MODEL_DB.sqls.should == ['SELECT * FROM albums', 'SELECT * FROM bands WHERE ((bands.id / 3) IN (2))']
|
255
|
+
a.should == [EagerAlbum.load(:id => 1, :band_id => 2)]
|
256
|
+
a.first.sband.should == EagerBand.load(:id=>6)
|
257
|
+
MODEL_DB.sqls.should == []
|
258
|
+
end
|
259
|
+
|
260
|
+
it "should handle a :eager_loading_predicate_key option to change the SQL used in the lookup, for one_to_many associations" do
|
261
|
+
EagerBand.one_to_many :salbums, :clone=>:albums, :eager_loading_predicate_key=>Sequel.*(:albums__band_id, 3), :key_method=>:band_id3, :eager=>nil
|
262
|
+
EagerBand.dataset._fetch = {:id=>6}
|
263
|
+
a = EagerBand.eager(:salbums).all
|
264
|
+
MODEL_DB.sqls.should == ['SELECT * FROM bands', 'SELECT * FROM albums WHERE ((albums.band_id * 3) IN (6))']
|
265
|
+
a.should == [EagerBand.load(:id => 6)]
|
266
|
+
a.first.salbums.should == [EagerAlbum.load(:id => 1, :band_id => 2)]
|
267
|
+
MODEL_DB.sqls.should == []
|
268
|
+
end
|
269
|
+
|
270
|
+
it "should handle a :eager_loading_predicate_key option to change the SQL used in the lookup, for many_to_many associations" do
|
271
|
+
EagerAlbum.many_to_many :sgenres, :clone=>:genres, :eager_loading_predicate_key=>Sequel.*(:ag__album_id, 1)
|
272
|
+
a = EagerAlbum.eager(:sgenres).all
|
273
|
+
a.should == [EagerAlbum.load(:id => 1, :band_id => 2)]
|
274
|
+
MODEL_DB.sqls.should == ['SELECT * FROM albums', "SELECT genres.*, (ag.album_id * 1) AS x_foreign_key_x FROM genres INNER JOIN ag ON ((ag.genre_id = genres.id) AND ((ag.album_id * 1) IN (1)))"]
|
275
|
+
a.first.sgenres.should == [EagerGenre.load(:id=>4)]
|
276
|
+
MODEL_DB.sqls.should == []
|
277
|
+
end
|
278
|
+
|
279
|
+
it "should raise an error for an unhandled :eager_loader_key option" do
|
280
|
+
EagerAlbum.many_to_many :sgenres, :clone=>:genres, :eager_loader_key=>1
|
281
|
+
ds = EagerAlbum.eager(:sgenres)
|
282
|
+
proc{ds.all}.should raise_error(Sequel::Error)
|
283
|
+
end
|
284
|
+
|
285
|
+
it "should not add entry to key_hash for :eager_loader_key=>nil option" do
|
286
|
+
eo = nil
|
287
|
+
EagerAlbum.many_to_many :sgenres, :clone=>:genres, :eager_loader_key=>nil, :eager_loader=>proc{|o| eo = o}
|
288
|
+
ds = EagerAlbum.eager(:sgenres)
|
289
|
+
ds.all
|
290
|
+
eo[:key_hash].should == {}
|
291
|
+
eo[:id_map].should == nil
|
292
|
+
end
|
293
|
+
|
192
294
|
it "should correctly handle a :select=>[] option to many_to_many" do
|
193
295
|
EagerAlbum.many_to_many :sgenres, :clone=>:genres, :select=>[]
|
194
296
|
a = EagerAlbum.eager(:sgenres).all
|
@@ -349,7 +451,9 @@ describe Sequel::Model, "#eager" do
|
|
349
451
|
it "should cache the negative lookup when eagerly loading a *_to_many associations" do
|
350
452
|
a = EagerBand.eager(:albums).filter('id > 100').all
|
351
453
|
a.should == [EagerBand.load(:id => 101), EagerBand.load(:id =>102)]
|
352
|
-
|
454
|
+
sqls = MODEL_DB.sqls
|
455
|
+
['SELECT * FROM albums WHERE (albums.band_id IN (101, 102))', 'SELECT * FROM albums WHERE (albums.band_id IN (102, 101))'].should include(sqls.delete_at(1))
|
456
|
+
sqls.should == ['SELECT * FROM bands WHERE (id > 100)', "SELECT * FROM tracks WHERE (tracks.album_id IN (101))"]
|
353
457
|
a.map{|b| b.associations[:albums]}.should == [[EagerAlbum.load({:band_id=>101, :id=>101})], []]
|
354
458
|
MODEL_DB.sqls.should == []
|
355
459
|
end
|
@@ -545,7 +649,7 @@ describe Sequel::Model, "#eager" do
|
|
545
649
|
end
|
546
650
|
|
547
651
|
it "should use the :eager_loader association option when eager loading" do
|
548
|
-
EagerAlbum.many_to_one :special_band, :eager_loader=>(proc do |key_hash, records, assocs|
|
652
|
+
EagerAlbum.many_to_one :special_band, :key=>:band_id, :eager_loader=>(proc do |key_hash, records, assocs|
|
549
653
|
item = EagerBand.filter(:album_id=>records.collect{|r| [r.pk, r.pk*2]}.flatten).order(:name).first
|
550
654
|
records.each{|r| r.associations[:special_band] = item}
|
551
655
|
end)
|
@@ -758,6 +862,37 @@ describe Sequel::Model, "#eager_graph" do
|
|
758
862
|
proc{ds2.eager_graph(:tracks)}.should_not raise_error
|
759
863
|
end
|
760
864
|
|
865
|
+
it "should allow manually selecting the alias base per call via an AliasedExpression" do
|
866
|
+
ds = GraphAlbum.eager_graph(Sequel.as(:band, :b))
|
867
|
+
ds.sql.should == 'SELECT albums.id, albums.band_id, b.id AS b_id, b.vocalist_id FROM albums LEFT OUTER JOIN bands AS b ON (b.id = albums.band_id)'
|
868
|
+
ds._fetch = {:id=>1, :band_id=>2, :b_id=>2, :vocalist_id=>3}
|
869
|
+
a = ds.all
|
870
|
+
a.should == [GraphAlbum.load(:id => 1, :band_id => 2)]
|
871
|
+
a.first.band.should == GraphBand.load(:id => 2, :vocalist_id=>3)
|
872
|
+
end
|
873
|
+
|
874
|
+
it "should handle multiple associations using the same alias base" do
|
875
|
+
ds = GraphAlbum.eager_graph(Sequel.as(:genres, :b), Sequel.as(:tracks, :b), Sequel.as(:band, :b))
|
876
|
+
ds.sql.should == 'SELECT albums.id, albums.band_id, b.id AS b_id, b_0.id AS b_0_id, b_0.album_id, b_1.id AS b_1_id, b_1.vocalist_id FROM albums LEFT OUTER JOIN ag ON (ag.album_id = albums.id) LEFT OUTER JOIN genres AS b ON (b.id = ag.genre_id) LEFT OUTER JOIN tracks AS b_0 ON (b_0.album_id = albums.id) LEFT OUTER JOIN bands AS b_1 ON (b_1.id = albums.band_id)'
|
877
|
+
ds._fetch = {:id=>1, :band_id=>2, :b_id=>4, :b_0_id=>3, :album_id=>1, :b_1_id=>2, :vocalist_id=>6}
|
878
|
+
a = ds.all
|
879
|
+
a.should == [GraphAlbum.load(:id => 1, :band_id => 2)]
|
880
|
+
a = a.first
|
881
|
+
a.band.should == GraphBand.load(:id => 2, :vocalist_id=>6)
|
882
|
+
a.tracks.should == [GraphTrack.load({:id => 3, :album_id=>1})]
|
883
|
+
a.genres.should == [GraphGenre.load(:id => 4)]
|
884
|
+
|
885
|
+
ds = GraphTrack.eager_graph(Sequel.as(:album, :b)=>{Sequel.as(:band, :b)=>Sequel.as(:members, :b)})
|
886
|
+
ds.sql.should == 'SELECT tracks.id, tracks.album_id, b.id AS b_id, b.band_id, b_0.id AS b_0_id, b_0.vocalist_id, b_1.id AS b_1_id FROM tracks LEFT OUTER JOIN albums AS b ON (b.id = tracks.album_id) LEFT OUTER JOIN bands AS b_0 ON (b_0.id = b.band_id) LEFT OUTER JOIN bm ON (bm.band_id = b_0.id) LEFT OUTER JOIN members AS b_1 ON (b_1.id = bm.member_id)'
|
887
|
+
ds._fetch = {:id=>3, :album_id=>1, :b_id=>1, :band_id=>2, :b_1_id=>5, :b_0_id=>2, :vocalist_id=>6}
|
888
|
+
a = ds.all
|
889
|
+
a.should == [GraphTrack.load(:id => 3, :album_id => 1)]
|
890
|
+
a = a.first
|
891
|
+
a.album.should == GraphAlbum.load(:id => 1, :band_id => 2)
|
892
|
+
a.album.band.should == GraphBand.load(:id => 2, :vocalist_id=>6)
|
893
|
+
a.album.band.members.should == [GraphBandMember.load(:id => 5)]
|
894
|
+
end
|
895
|
+
|
761
896
|
it "should eagerly load a single many_to_one association" do
|
762
897
|
ds = GraphAlbum.eager_graph(:band)
|
763
898
|
ds.sql.should == 'SELECT albums.id, albums.band_id, band.id AS band_id_0, band.vocalist_id FROM albums LEFT OUTER JOIN bands AS band ON (band.id = albums.band_id)'
|
data/spec/model/model_spec.rb
CHANGED
@@ -502,24 +502,24 @@ describe Sequel::Model, "attribute accessors" do
|
|
502
502
|
before do
|
503
503
|
db = Sequel.mock
|
504
504
|
def db.schema(*)
|
505
|
-
[[:x, {:type=>:integer}], [:
|
505
|
+
[[:x, {:type=>:integer}], [:z, {:type=>:integer}]]
|
506
506
|
end
|
507
|
-
@dataset = db[:items].columns(:x, :
|
507
|
+
@dataset = db[:items].columns(:x, :z)
|
508
508
|
@c = Class.new(Sequel::Model)
|
509
509
|
MODEL_DB.reset
|
510
510
|
end
|
511
511
|
|
512
512
|
it "should be created on set_dataset" do
|
513
|
-
%w'x
|
514
|
-
@c.instance_methods.collect{|
|
513
|
+
%w'x z x= z='.each do |x|
|
514
|
+
@c.instance_methods.collect{|z| z.to_s}.should_not include(x)
|
515
515
|
end
|
516
516
|
@c.set_dataset(@dataset)
|
517
|
-
%w'x
|
518
|
-
@c.instance_methods.collect{|
|
517
|
+
%w'x z x= z='.each do |x|
|
518
|
+
@c.instance_methods.collect{|z| z.to_s}.should include(x)
|
519
519
|
end
|
520
520
|
o = @c.new
|
521
|
-
%w'x
|
522
|
-
o.methods.collect{|
|
521
|
+
%w'x z x= z='.each do |x|
|
522
|
+
o.methods.collect{|z| z.to_s}.should include(x)
|
523
523
|
end
|
524
524
|
|
525
525
|
o.x.should be_nil
|
@@ -538,7 +538,7 @@ describe Sequel::Model, "attribute accessors" do
|
|
538
538
|
end
|
539
539
|
|
540
540
|
it "should have a working typecasting setter even if the column is not selected" do
|
541
|
-
@c.set_dataset(@dataset.select(:
|
541
|
+
@c.set_dataset(@dataset.select(:z).columns(:z))
|
542
542
|
o = @c.new
|
543
543
|
|
544
544
|
o.x = '34'
|
@@ -546,7 +546,7 @@ describe Sequel::Model, "attribute accessors" do
|
|
546
546
|
end
|
547
547
|
|
548
548
|
it "should typecast if the new value is the same as the existing but has a different class" do
|
549
|
-
@c.set_dataset(@dataset.select(:
|
549
|
+
@c.set_dataset(@dataset.select(:z).columns(:z))
|
550
550
|
o = @c.new
|
551
551
|
|
552
552
|
o.x = 34
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sequel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.37.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-07-02 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: The Database Toolkit for Ruby
|
15
15
|
email: code@jeremyevans.net
|
@@ -97,6 +97,7 @@ extra_rdoc_files:
|
|
97
97
|
- doc/release_notes/3.34.0.txt
|
98
98
|
- doc/release_notes/3.35.0.txt
|
99
99
|
- doc/release_notes/3.36.0.txt
|
100
|
+
- doc/release_notes/3.37.0.txt
|
100
101
|
files:
|
101
102
|
- MIT-LICENSE
|
102
103
|
- CHANGELOG
|
@@ -170,6 +171,7 @@ files:
|
|
170
171
|
- doc/release_notes/3.34.0.txt
|
171
172
|
- doc/release_notes/3.35.0.txt
|
172
173
|
- doc/release_notes/3.36.0.txt
|
174
|
+
- doc/release_notes/3.37.0.txt
|
173
175
|
- doc/sharding.rdoc
|
174
176
|
- doc/sql.rdoc
|
175
177
|
- doc/validations.rdoc
|
@@ -276,6 +278,11 @@ files:
|
|
276
278
|
- spec/extensions/pg_json_spec.rb
|
277
279
|
- spec/extensions/core_extensions_spec.rb
|
278
280
|
- spec/extensions/pg_inet_spec.rb
|
281
|
+
- spec/extensions/eval_inspect_spec.rb
|
282
|
+
- spec/extensions/pg_range_spec.rb
|
283
|
+
- spec/extensions/split_array_nil_spec.rb
|
284
|
+
- spec/extensions/pg_range_ops_spec.rb
|
285
|
+
- spec/extensions/pg_interval_spec.rb
|
279
286
|
- spec/extensions/columns_introspection_spec.rb
|
280
287
|
- spec/integration/associations_test.rb
|
281
288
|
- spec/integration/database_test.rb
|
@@ -398,6 +405,7 @@ files:
|
|
398
405
|
- lib/sequel/adapters/sqlite.rb
|
399
406
|
- lib/sequel/adapters/utils/stored_procedures.rb
|
400
407
|
- lib/sequel/adapters/utils/emulate_offset_with_row_number.rb
|
408
|
+
- lib/sequel/adapters/utils/pg_types.rb
|
401
409
|
- lib/sequel/adapters/mysql2.rb
|
402
410
|
- lib/sequel/adapters/swift.rb
|
403
411
|
- lib/sequel/adapters/swift/mysql.rb
|
@@ -462,6 +470,11 @@ files:
|
|
462
470
|
- lib/sequel/extensions/core_extensions.rb
|
463
471
|
- lib/sequel/extensions/query_literals.rb
|
464
472
|
- lib/sequel/extensions/pg_inet.rb
|
473
|
+
- lib/sequel/extensions/eval_inspect.rb
|
474
|
+
- lib/sequel/extensions/pg_range.rb
|
475
|
+
- lib/sequel/extensions/split_array_nil.rb
|
476
|
+
- lib/sequel/extensions/pg_range_ops.rb
|
477
|
+
- lib/sequel/extensions/pg_interval.rb
|
465
478
|
- lib/sequel/metaprogramming.rb
|
466
479
|
- lib/sequel/model.rb
|
467
480
|
- lib/sequel/model/associations.rb
|