sequel 5.11.0 → 5.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +32 -0
  3. data/doc/advanced_associations.rdoc +132 -14
  4. data/doc/postgresql.rdoc +14 -0
  5. data/doc/release_notes/5.12.0.txt +141 -0
  6. data/lib/sequel/adapters/ado/mssql.rb +1 -1
  7. data/lib/sequel/adapters/oracle.rb +5 -6
  8. data/lib/sequel/adapters/postgres.rb +18 -5
  9. data/lib/sequel/adapters/shared/mysql.rb +5 -5
  10. data/lib/sequel/adapters/sqlite.rb +0 -5
  11. data/lib/sequel/adapters/tinytds.rb +0 -5
  12. data/lib/sequel/adapters/utils/emulate_offset_with_reverse_and_count.rb +2 -5
  13. data/lib/sequel/core.rb +6 -1
  14. data/lib/sequel/dataset/graph.rb +25 -9
  15. data/lib/sequel/dataset/placeholder_literalizer.rb +47 -17
  16. data/lib/sequel/dataset/prepared_statements.rb +86 -18
  17. data/lib/sequel/dataset/sql.rb +5 -1
  18. data/lib/sequel/extensions/caller_logging.rb +79 -0
  19. data/lib/sequel/extensions/constraint_validations.rb +1 -1
  20. data/lib/sequel/extensions/pg_static_cache_updater.rb +2 -2
  21. data/lib/sequel/model/associations.rb +56 -23
  22. data/lib/sequel/model/base.rb +3 -3
  23. data/lib/sequel/plugins/eager_graph_eager.rb +139 -0
  24. data/lib/sequel/plugins/static_cache.rb +9 -8
  25. data/lib/sequel/plugins/tactical_eager_loading.rb +63 -1
  26. data/lib/sequel/version.rb +1 -1
  27. data/spec/adapters/oracle_spec.rb +44 -0
  28. data/spec/adapters/postgres_spec.rb +39 -0
  29. data/spec/core/dataset_spec.rb +23 -9
  30. data/spec/core/object_graph_spec.rb +314 -284
  31. data/spec/extensions/caller_logging_spec.rb +52 -0
  32. data/spec/extensions/eager_graph_eager_spec.rb +100 -0
  33. data/spec/extensions/finder_spec.rb +1 -1
  34. data/spec/extensions/prepared_statements_spec.rb +7 -12
  35. data/spec/extensions/static_cache_spec.rb +14 -0
  36. data/spec/extensions/tactical_eager_loading_spec.rb +262 -1
  37. data/spec/integration/associations_test.rb +72 -0
  38. data/spec/integration/dataset_test.rb +3 -3
  39. data/spec/model/eager_loading_spec.rb +90 -0
  40. metadata +8 -2
@@ -1688,6 +1688,40 @@ BasicRegularAndCompositeKeyAssociations = shared_description do
1688
1688
  a.first.albums.must_equal [@album]
1689
1689
  a.first.albums.first.artist.must_equal @artist
1690
1690
  end
1691
+
1692
+ it "should be able to eager_graph dependent eager associations using eager callback" do
1693
+ @album.update(:artist => @artist)
1694
+ @album.add_tag(@tag)
1695
+
1696
+ a = Artist.eager(:albums=>proc{|ds| ds.eager_graph(:tags, :alias_tags).unordered}).eager(:first_album).all
1697
+ a.must_equal [@artist]
1698
+ a.first.albums.must_equal [@album]
1699
+ a.first.first_album.must_equal @album
1700
+ a.first.albums.first.tags.must_equal [@tag]
1701
+ a.first.albums.first.alias_tags.must_equal [@tag]
1702
+
1703
+ a = Tag.eager(:albums=>proc{|ds| ds.eager_graph(:artist).unordered}).all
1704
+ a.must_equal [@tag]
1705
+ a.first.albums.must_equal [@album]
1706
+ a.first.albums.first.artist.must_equal @artist
1707
+ end
1708
+
1709
+ it "should be able to eager dependent eager_graph associations using eager_graph_eager" do
1710
+ @album.update(:artist => @artist)
1711
+ @album.add_tag(@tag)
1712
+
1713
+ a = Artist.eager_graph(:albums, :first_album).eager_graph_eager([:albums], :tags, :alias_tags).all
1714
+ a.must_equal [@artist]
1715
+ a.first.albums.must_equal [@album]
1716
+ a.first.first_album.must_equal @album
1717
+ a.first.albums.first.tags.must_equal [@tag]
1718
+ a.first.albums.first.alias_tags.must_equal [@tag]
1719
+
1720
+ a = Tag.eager_graph(:albums).eager_graph_eager([:albums], :artist).all
1721
+ a.must_equal [@tag]
1722
+ a.first.albums.must_equal [@album]
1723
+ a.first.albums.first.artist.must_equal @artist
1724
+ end
1691
1725
  end
1692
1726
 
1693
1727
  RegularAndCompositeKeyAssociations = shared_description do
@@ -1766,10 +1800,20 @@ RegularAndCompositeKeyAssociations = shared_description do
1766
1800
  a.first.artist.must_equal @artist
1767
1801
  a.first.artist.tags.must_equal [@tag]
1768
1802
 
1803
+ a = Album.eager(:artist=>proc{|ds| ds.eager_graph(:tags)}).all
1804
+ a.must_equal [@album]
1805
+ a.first.artist.must_equal @artist
1806
+ a.first.artist.tags.must_equal [@tag]
1807
+
1769
1808
  a = Album.eager_graph(:artist=>:tags).all
1770
1809
  a.must_equal [@album]
1771
1810
  a.first.artist.must_equal @artist
1772
1811
  a.first.artist.tags.must_equal [@tag]
1812
+
1813
+ a = Album.eager_graph(:artist).eager_graph_eager([:artist], :tags).all
1814
+ a.must_equal [@album]
1815
+ a.first.artist.must_equal @artist
1816
+ a.first.artist.tags.must_equal [@tag]
1773
1817
  end
1774
1818
 
1775
1819
  it "should work with a one_through_many association" do
@@ -1795,10 +1839,20 @@ RegularAndCompositeKeyAssociations = shared_description do
1795
1839
  a.first.artist.must_equal @artist
1796
1840
  a.first.artist.first_tag.must_equal @tag
1797
1841
 
1842
+ a = Album.eager(:artist=>proc{|ds| ds.eager_graph(:first_tag)}).all
1843
+ a.must_equal [@album]
1844
+ a.first.artist.must_equal @artist
1845
+ a.first.artist.first_tag.must_equal @tag
1846
+
1798
1847
  a = Album.eager_graph(:artist=>:first_tag).all
1799
1848
  a.must_equal [@album]
1800
1849
  a.first.artist.must_equal @artist
1801
1850
  a.first.artist.first_tag.must_equal @tag
1851
+
1852
+ a = Album.eager_graph(:artist).eager_graph_eager([:artist], :first_tag).all
1853
+ a.must_equal [@album]
1854
+ a.first.artist.must_equal @artist
1855
+ a.first.artist.first_tag.must_equal @tag
1802
1856
  end
1803
1857
  end
1804
1858
 
@@ -1828,6 +1882,7 @@ describe "Sequel::Model Simple Associations" do
1828
1882
  [:albums_tags, :tags, :albums, :artists].each{|t| @db[t].delete}
1829
1883
  class ::Artist < Sequel::Model(@db)
1830
1884
  plugin :dataset_associations
1885
+ plugin :eager_graph_eager
1831
1886
  one_to_many :albums, :order=>:name
1832
1887
  one_to_one :first_album, :clone=>:albums
1833
1888
  one_to_one :second_album, :clone=>:albums, :limit=>[nil, 1]
@@ -1852,6 +1907,7 @@ describe "Sequel::Model Simple Associations" do
1852
1907
  end
1853
1908
  class ::Album < Sequel::Model(@db)
1854
1909
  plugin :dataset_associations
1910
+ plugin :eager_graph_eager
1855
1911
  many_to_one :artist, :reciprocal=>nil
1856
1912
  many_to_one :a_artist, :clone=>:artist, :conditions=>{:name=>'Ar'}, :key=>:artist_id
1857
1913
  many_to_many :tags, :right_key=>:tag_id
@@ -1872,6 +1928,7 @@ describe "Sequel::Model Simple Associations" do
1872
1928
  end
1873
1929
  class ::Tag < Sequel::Model(@db)
1874
1930
  plugin :dataset_associations
1931
+ plugin :eager_graph_eager
1875
1932
  many_to_many :albums
1876
1933
  plugin :many_through_many
1877
1934
  many_through_many :tags, [[:albums_tags, :tag_id, :album_id], [:albums, :id, :artist_id], [:albums, :artist_id, :id], [:albums_tags, :album_id, :tag_id]], :class=>:Tag
@@ -2069,6 +2126,12 @@ describe "Sequel::Model Simple Associations" do
2069
2126
  a.must_equal [@album, album2]
2070
2127
  a.map(&:artist).must_equal [@artist, @artist]
2071
2128
  a.map(&:artist).map(&:albums).must_equal [[@album, album2], [@album, album2]]
2129
+
2130
+ a = Album.eager_graph(:artist=>:albums).eager_graph_eager([:artist], :tags).order{[albums[:id], albums_0[:id]]}.all
2131
+ a.must_equal [@album, album2]
2132
+ a.map(&:artist).must_equal [@artist, @artist]
2133
+ a.map(&:artist).map(&:albums).must_equal [[@album, album2], [@album, album2]]
2134
+ a.map(&:artist).map{|a| a.associations[:tags]}.must_equal [[], []]
2072
2135
  end
2073
2136
 
2074
2137
  it "should have remove method raise an error for one_to_many records if the object isn't already associated" do
@@ -2129,6 +2192,7 @@ describe "Sequel::Model Composite Key Associations" do
2129
2192
  [:albums_tags, :tags, :albums, :artists].each{|t| @db[t].delete}
2130
2193
  class ::Artist < Sequel::Model(@db)
2131
2194
  plugin :dataset_associations
2195
+ plugin :eager_graph_eager
2132
2196
  set_primary_key [:id1, :id2]
2133
2197
  unrestrict_primary_key
2134
2198
  one_to_many :albums, :key=>[:artist_id1, :artist_id2], :order=>:name
@@ -2155,6 +2219,7 @@ describe "Sequel::Model Composite Key Associations" do
2155
2219
  end
2156
2220
  class ::Album < Sequel::Model(@db)
2157
2221
  plugin :dataset_associations
2222
+ plugin :eager_graph_eager
2158
2223
  set_primary_key [:id1, :id2]
2159
2224
  unrestrict_primary_key
2160
2225
  many_to_one :artist, :key=>[:artist_id1, :artist_id2], :reciprocal=>nil
@@ -2177,6 +2242,7 @@ describe "Sequel::Model Composite Key Associations" do
2177
2242
  end
2178
2243
  class ::Tag < Sequel::Model(@db)
2179
2244
  plugin :dataset_associations
2245
+ plugin :eager_graph_eager
2180
2246
  set_primary_key [:id1, :id2]
2181
2247
  unrestrict_primary_key
2182
2248
  many_to_many :albums, :right_key=>[:album_id1, :album_id2], :left_key=>[:tag_id1, :tag_id2]
@@ -2286,6 +2352,7 @@ describe "Sequel::Model pg_array_to_many" do
2286
2352
  [:tags, :albums, :artists].each{|t| @db[t].delete}
2287
2353
  class ::Artist < Sequel::Model(@db)
2288
2354
  plugin :dataset_associations
2355
+ plugin :eager_graph_eager
2289
2356
  one_to_many :albums, :order=>:name
2290
2357
  one_to_one :first_album, :clone=>:albums
2291
2358
  one_to_many :a_albums, :clone=>:albums do |ds| ds.where(:name=>'Al') end
@@ -2294,6 +2361,7 @@ describe "Sequel::Model pg_array_to_many" do
2294
2361
  class ::Album < Sequel::Model(@db)
2295
2362
  plugin :dataset_associations
2296
2363
  plugin :pg_array_associations
2364
+ plugin :eager_graph_eager
2297
2365
  many_to_one :artist, :reciprocal=>nil
2298
2366
  many_to_one :a_artist, :clone=>:artist, :key=>:artist_id do |ds| ds.where(:name=>'Ar') end
2299
2367
  pg_array_to_many :tags, :key=>:tag_ids, :save_after_modify=>true
@@ -2308,6 +2376,7 @@ describe "Sequel::Model pg_array_to_many" do
2308
2376
  class ::Tag < Sequel::Model(@db)
2309
2377
  plugin :dataset_associations
2310
2378
  plugin :pg_array_associations
2379
+ plugin :eager_graph_eager
2311
2380
  many_to_pg_array :albums
2312
2381
  end
2313
2382
  @album = Album.create(:name=>'Al')
@@ -2367,6 +2436,7 @@ describe "Sequel::Model many_to_pg_array" do
2367
2436
  [:tags, :albums, :artists].each{|t| @db[t].delete}
2368
2437
  class ::Artist < Sequel::Model(@db)
2369
2438
  plugin :dataset_associations
2439
+ plugin :eager_graph_eager
2370
2440
  one_to_many :albums, :order=>:name
2371
2441
  one_to_one :first_album, :class=>:Album, :order=>:name
2372
2442
  one_to_many :a_albums, :clone=>:albums do |ds| ds.where(:name=>'Al') end
@@ -2375,6 +2445,7 @@ describe "Sequel::Model many_to_pg_array" do
2375
2445
  class ::Album < Sequel::Model(@db)
2376
2446
  plugin :dataset_associations
2377
2447
  plugin :pg_array_associations
2448
+ plugin :eager_graph_eager
2378
2449
  many_to_one :artist, :reciprocal=>nil
2379
2450
  many_to_one :a_artist, :clone=>:artist, :key=>:artist_id do |ds| ds.where(:name=>'Ar') end
2380
2451
  many_to_pg_array :tags
@@ -2389,6 +2460,7 @@ describe "Sequel::Model many_to_pg_array" do
2389
2460
  class ::Tag < Sequel::Model(@db)
2390
2461
  plugin :dataset_associations
2391
2462
  plugin :pg_array_associations
2463
+ plugin :eager_graph_eager
2392
2464
  pg_array_to_many :albums, :save_after_modify=>true
2393
2465
  end
2394
2466
  @album = Album.create(:name=>'Al')
@@ -928,11 +928,11 @@ if DB.dataset.supports_window_functions?
928
928
  it "should give correct results for aggregate window functions with groups" do
929
929
  @ds.select(:id){sum(:amount).over(:partition=>:group_id, :order=>:id, :frame=>:groups).as(:sum)}.all.
930
930
  must_equal [{:sum=>1, :id=>1}, {:sum=>11, :id=>2}, {:sum=>111, :id=>3}, {:sum=>1000, :id=>4}, {:sum=>11000, :id=>5}, {:sum=>111000, :id=>6}]
931
- @ds.select(:id){sum(:amount).over(:partition=>:group_id, :frame=>:groups).as(:sum)}.all.
932
- must_equal [{:sum=>111, :id=>1}, {:sum=>111, :id=>2}, {:sum=>111, :id=>3}, {:sum=>111000, :id=>4}, {:sum=>111000, :id=>5}, {:sum=>111000, :id=>6}]
931
+ @ds.select(:id){sum(:amount).over(:order=>:group_id, :frame=>:groups).as(:sum)}.all.
932
+ must_equal [{:sum=>111, :id=>1}, {:sum=>111, :id=>2}, {:sum=>111, :id=>3}, {:sum=>111111, :id=>4}, {:sum=>111111, :id=>5}, {:sum=>111111, :id=>6}]
933
933
  end if DB.dataset.supports_window_function_frame_option?(:groups)
934
934
 
935
- if DB.dataset.supports_window_function_frame_option?(:offset)
935
+ if DB.dataset.supports_window_function_frame_option?(:offset)
936
936
  it "should give correct results for aggregate window functions with offsets for ROWS" do
937
937
  @ds.select(:id){sum(:amount).over(:order=>:id, :frame=>{:type=>:rows, :start=>1}).as(:sum)}.all.
938
938
  must_equal [{:sum=>1, :id=>1}, {:sum=>11, :id=>2}, {:sum=>110, :id=>3}, {:sum=>1100, :id=>4}, {:sum=>11000, :id=>5}, {:sum=>110000, :id=>6}]
@@ -1225,6 +1225,96 @@ describe Sequel::Model, "#eager" do
1225
1225
  DB.sqls.must_equal []
1226
1226
  end
1227
1227
 
1228
+ it "should support eager load of many_to_one with eager_graph of many_to_one in custom callback" do
1229
+ a = EagerTrack.eager(:album=>proc{|ds| ds.eager_graph(:band).with_fetch(:id=>1, :band_id=>2, :band_id_0=>2)}).all
1230
+ a.must_equal [EagerTrack.load(:id => 3, :album_id => 1)]
1231
+ DB.sqls.must_equal ["SELECT * FROM tracks",
1232
+ "SELECT albums.id, albums.band_id, band.id AS band_id_0 FROM albums LEFT OUTER JOIN bands AS band ON (band.id = albums.band_id) WHERE (albums.id IN (1))"]
1233
+ a = a.first
1234
+ a.album.must_equal EagerAlbum.load(:id => 1, :band_id => 2)
1235
+ a.album.band.must_equal EagerBand.load(:id => 2)
1236
+ DB.sqls.must_equal []
1237
+ end
1238
+
1239
+ it "should support eager load of many_to_one with eager_graph of one_to_many in custom callback" do
1240
+ a = EagerTrack.eager(:album=>proc{|ds| ds.eager_graph(:tracks).with_fetch(:id=>1, :band_id=>2, :tracks_id=>3)}).all
1241
+ a.must_equal [EagerTrack.load(:id => 3, :album_id => 1)]
1242
+ DB.sqls.must_equal ["SELECT * FROM tracks",
1243
+ "SELECT albums.id, albums.band_id, tracks.id AS tracks_id FROM albums LEFT OUTER JOIN tracks ON (tracks.album_id = albums.id) WHERE (albums.id IN (1))"]
1244
+ a = a.first
1245
+ a.album.must_equal EagerAlbum.load(:id => 1, :band_id => 2)
1246
+ a.album.tracks.must_equal [EagerTrack.load(:id=>3)]
1247
+ DB.sqls.must_equal []
1248
+ end
1249
+
1250
+ it "should support eager load of many_to_one with eager_graph of many_to_many in custom callback" do
1251
+ a = EagerTrack.eager(:album=>proc{|ds| ds.eager_graph(:genres).with_fetch(:id=>1, :band_id=>2, :genres_id=>4)}).all
1252
+ a.must_equal [EagerTrack.load(:id => 3, :album_id => 1)]
1253
+ DB.sqls.must_equal ["SELECT * FROM tracks",
1254
+ "SELECT albums.id, albums.band_id, genres.id AS genres_id FROM albums LEFT OUTER JOIN ag ON (ag.album_id = albums.id) LEFT OUTER JOIN genres ON (genres.id = ag.genre_id) WHERE (albums.id IN (1))"]
1255
+ a = a.first
1256
+ a.album.must_equal EagerAlbum.load(:id => 1, :band_id => 2)
1257
+ a.album.genres.must_equal [EagerGenre.load(:id=>4)]
1258
+ DB.sqls.must_equal []
1259
+ end
1260
+
1261
+ it "should support eager load of many_to_many with eager_graph of many_to_one in custom callback" do
1262
+ a = EagerGenre.eager(:albums=>proc{|ds| ds.columns(:id, :band_id, :x_foreign_key_x).eager_graph(:band).with_fetch(:id=>1, :band_id=>2, :x_foreign_key_x=>4, :band_id_0=>2)}).all
1263
+ a.must_equal [EagerGenre.load(:id => 4)]
1264
+ DB.sqls.must_equal ["SELECT * FROM genres",
1265
+ "SELECT albums.id, albums.band_id, albums.x_foreign_key_x, band.id AS band_id_0 FROM (SELECT albums.*, ag.genre_id AS x_foreign_key_x FROM albums INNER JOIN ag ON (ag.album_id = albums.id) WHERE (ag.genre_id IN (4))) AS albums LEFT OUTER JOIN bands AS band ON (band.id = albums.band_id)"]
1266
+ a = a.first
1267
+ a.albums.must_equal [EagerAlbum.load(:id => 1, :band_id => 2)]
1268
+ a.albums.first.band.must_equal EagerBand.load(:id=>2)
1269
+ DB.sqls.must_equal []
1270
+ end
1271
+
1272
+ it "should support eager load of many_to_many with eager_graph of one_to_many in custom callback" do
1273
+ a = EagerGenre.eager(:albums=>proc{|ds| ds.columns(:id, :band_id, :x_foreign_key_x).eager_graph(:tracks).with_fetch(:id=>1, :band_id=>2, :x_foreign_key_x=>4, :tracks_id=>5)}).all
1274
+ a.must_equal [EagerGenre.load(:id => 4)]
1275
+ DB.sqls.must_equal ["SELECT * FROM genres",
1276
+ "SELECT albums.id, albums.band_id, albums.x_foreign_key_x, tracks.id AS tracks_id FROM (SELECT albums.*, ag.genre_id AS x_foreign_key_x FROM albums INNER JOIN ag ON (ag.album_id = albums.id) WHERE (ag.genre_id IN (4))) AS albums LEFT OUTER JOIN tracks ON (tracks.album_id = albums.id)"]
1277
+ a = a.first
1278
+ a.albums.must_equal [EagerAlbum.load(:id => 1, :band_id => 2)]
1279
+ a.albums.first.tracks.must_equal [EagerTrack.load(:id=>5)]
1280
+ DB.sqls.must_equal []
1281
+ end
1282
+
1283
+ it "should support eager load of many_to_many with eager_graph of many_to_many in custom callback" do
1284
+ a = EagerGenre.eager(:albums=>proc{|ds| ds.columns(:id, :band_id, :x_foreign_key_x).eager_graph(:genres).with_fetch(:id=>1, :band_id=>2, :x_foreign_key_x=>4, :genres_id=>4)}).all
1285
+ a.must_equal [EagerGenre.load(:id => 4)]
1286
+ DB.sqls.must_equal ["SELECT * FROM genres",
1287
+ "SELECT albums.id, albums.band_id, albums.x_foreign_key_x, genres.id AS genres_id FROM (SELECT albums.*, ag.genre_id AS x_foreign_key_x FROM albums INNER JOIN ag ON (ag.album_id = albums.id) WHERE (ag.genre_id IN (4))) AS albums LEFT OUTER JOIN ag AS ag_0 ON (ag_0.album_id = albums.id) LEFT OUTER JOIN genres ON (genres.id = ag_0.genre_id)"]
1288
+ a = a.first
1289
+ a.albums.must_equal [EagerAlbum.load(:id => 1, :band_id => 2)]
1290
+ a.albums.first.genres.must_equal [EagerGenre.load(:id=>4)]
1291
+ DB.sqls.must_equal []
1292
+ end
1293
+
1294
+ it "should support eager_graph usage with cascaded associations in custom callback" do
1295
+ a = EagerTrack.eager(:album=>proc{|ds| ds.eager_graph(:band=>:members).with_fetch(:id=>1, :band_id=>2, :band_id_0=>2, :members_id=>5)}).all
1296
+ a.must_equal [EagerTrack.load(:id => 3, :album_id => 1)]
1297
+ DB.sqls.must_equal ["SELECT * FROM tracks",
1298
+ "SELECT albums.id, albums.band_id, band.id AS band_id_0, members.id AS members_id FROM albums LEFT OUTER JOIN bands AS band ON (band.id = albums.band_id) LEFT OUTER JOIN bm ON (bm.band_id = band.id) LEFT OUTER JOIN members ON (members.id = bm.member_id) WHERE (albums.id IN (1))"]
1299
+ a = a.first
1300
+ a.album.must_equal EagerAlbum.load(:id => 1, :band_id => 2)
1301
+ a.album.band.must_equal EagerBand.load(:id => 2)
1302
+ a.album.band.members.must_equal [EagerBandMember.load(:id => 5)]
1303
+ DB.sqls.must_equal []
1304
+ end
1305
+
1306
+ it "should support eager_graph usage in custom callback with dependencies" do
1307
+ a = EagerTrack.eager(:album=>{proc{|ds| ds.eager_graph(:band).with_fetch(:id=>1, :band_id=>2, :band_id_0=>2)}=>:genre}).all
1308
+ a.must_equal [EagerTrack.load(:id => 3, :album_id => 1)]
1309
+ DB.sqls.must_equal ["SELECT * FROM tracks",
1310
+ "SELECT albums.id, albums.band_id, band.id AS band_id_0 FROM albums LEFT OUTER JOIN bands AS band ON (band.id = albums.band_id) WHERE (albums.id IN (1))",
1311
+ "SELECT genres.*, ag.album_id AS x_foreign_key_x FROM genres INNER JOIN ag ON (ag.genre_id = genres.id) WHERE (ag.album_id IN (1))"]
1312
+ a = a.first
1313
+ a.album.must_equal EagerAlbum.load(:id => 1, :band_id => 2)
1314
+ a.album.band.must_equal EagerBand.load(:id => 2)
1315
+ a.album.genre.must_equal EagerGenre.load(:id => 4)
1316
+ DB.sqls.must_equal []
1317
+ end
1228
1318
  end
1229
1319
 
1230
1320
  describe Sequel::Model, "#eager_graph" do
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.11.0
4
+ version: 5.12.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: 2018-08-01 00:00:00.000000000 Z
11
+ date: 2018-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
@@ -195,6 +195,7 @@ extra_rdoc_files:
195
195
  - doc/release_notes/5.9.0.txt
196
196
  - doc/release_notes/5.10.0.txt
197
197
  - doc/release_notes/5.11.0.txt
198
+ - doc/release_notes/5.12.0.txt
198
199
  files:
199
200
  - CHANGELOG
200
201
  - MIT-LICENSE
@@ -276,6 +277,7 @@ files:
276
277
  - doc/release_notes/5.1.0.txt
277
278
  - doc/release_notes/5.10.0.txt
278
279
  - doc/release_notes/5.11.0.txt
280
+ - doc/release_notes/5.12.0.txt
279
281
  - doc/release_notes/5.2.0.txt
280
282
  - doc/release_notes/5.3.0.txt
281
283
  - doc/release_notes/5.4.0.txt
@@ -378,6 +380,7 @@ files:
378
380
  - lib/sequel/extensions/arbitrary_servers.rb
379
381
  - lib/sequel/extensions/auto_literal_strings.rb
380
382
  - lib/sequel/extensions/blank.rb
383
+ - lib/sequel/extensions/caller_logging.rb
381
384
  - lib/sequel/extensions/columns_introspection.rb
382
385
  - lib/sequel/extensions/connection_expiration.rb
383
386
  - lib/sequel/extensions/connection_validator.rb
@@ -483,6 +486,7 @@ files:
483
486
  - lib/sequel/plugins/delay_add_association.rb
484
487
  - lib/sequel/plugins/dirty.rb
485
488
  - lib/sequel/plugins/eager_each.rb
489
+ - lib/sequel/plugins/eager_graph_eager.rb
486
490
  - lib/sequel/plugins/error_splitter.rb
487
491
  - lib/sequel/plugins/finder.rb
488
492
  - lib/sequel/plugins/force_encoding.rb
@@ -577,6 +581,7 @@ files:
577
581
  - spec/extensions/boolean_readers_spec.rb
578
582
  - spec/extensions/boolean_subsets_spec.rb
579
583
  - spec/extensions/caching_spec.rb
584
+ - spec/extensions/caller_logging_spec.rb
580
585
  - spec/extensions/class_table_inheritance_spec.rb
581
586
  - spec/extensions/column_conflicts_spec.rb
582
587
  - spec/extensions/column_select_spec.rb
@@ -600,6 +605,7 @@ files:
600
605
  - spec/extensions/dirty_spec.rb
601
606
  - spec/extensions/duplicate_columns_handler_spec.rb
602
607
  - spec/extensions/eager_each_spec.rb
608
+ - spec/extensions/eager_graph_eager_spec.rb
603
609
  - spec/extensions/empty_array_consider_nulls_spec.rb
604
610
  - spec/extensions/error_splitter_spec.rb
605
611
  - spec/extensions/error_sql_spec.rb