sequel 4.14.0 → 4.15.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 +32 -0
- data/README.rdoc +3 -3
- data/Rakefile +1 -1
- data/doc/opening_databases.rdoc +20 -2
- data/doc/release_notes/4.15.0.txt +56 -0
- data/doc/testing.rdoc +10 -4
- data/lib/sequel/adapters/fdbsql.rb +285 -0
- data/lib/sequel/adapters/informix.rb +15 -0
- data/lib/sequel/adapters/jdbc/fdbsql.rb +65 -0
- data/lib/sequel/adapters/mock.rb +1 -0
- data/lib/sequel/adapters/shared/fdbsql.rb +550 -0
- data/lib/sequel/adapters/shared/postgres.rb +23 -10
- data/lib/sequel/database/connecting.rb +1 -1
- data/lib/sequel/database/schema_methods.rb +10 -3
- data/lib/sequel/dataset/placeholder_literalizer.rb +7 -0
- data/lib/sequel/extensions/date_arithmetic.rb +5 -0
- data/lib/sequel/extensions/migration.rb +2 -2
- data/lib/sequel/extensions/pg_array.rb +15 -1
- data/lib/sequel/extensions/pg_json.rb +3 -0
- data/lib/sequel/extensions/pg_json_ops.rb +4 -4
- data/lib/sequel/extensions/schema_dumper.rb +9 -1
- data/lib/sequel/model/associations.rb +70 -21
- data/lib/sequel/plugins/active_model.rb +7 -2
- data/lib/sequel/plugins/many_through_many.rb +1 -0
- data/lib/sequel/plugins/pg_array_associations.rb +2 -1
- data/lib/sequel/plugins/split_values.rb +64 -0
- data/lib/sequel/version.rb +1 -1
- data/spec/adapters/fdbsql_spec.rb +429 -0
- data/spec/adapters/informix_spec.rb +6 -0
- data/spec/adapters/postgres_spec.rb +49 -1
- data/spec/adapters/spec_helper.rb +6 -1
- data/spec/adapters/sqlite_spec.rb +1 -1
- data/spec/core/placeholder_literalizer_spec.rb +10 -0
- data/spec/extensions/date_arithmetic_spec.rb +7 -0
- data/spec/extensions/many_through_many_spec.rb +14 -0
- data/spec/extensions/migration_spec.rb +3 -3
- data/spec/extensions/pg_array_associations_spec.rb +9 -0
- data/spec/extensions/pg_json_ops_spec.rb +4 -8
- data/spec/extensions/schema_dumper_spec.rb +9 -0
- data/spec/extensions/spec_helper.rb +3 -0
- data/spec/extensions/split_values_spec.rb +22 -0
- data/spec/integration/database_test.rb +1 -1
- data/spec/integration/dataset_test.rb +1 -1
- data/spec/integration/eager_loader_test.rb +1 -1
- data/spec/integration/plugin_test.rb +3 -2
- data/spec/integration/prepared_statement_test.rb +3 -3
- data/spec/integration/schema_test.rb +3 -3
- data/spec/integration/spec_helper.rb +6 -1
- data/spec/integration/timezone_test.rb +1 -1
- data/spec/model/association_reflection_spec.rb +29 -0
- data/spec/model/associations_spec.rb +36 -0
- data/spec/model/eager_loading_spec.rb +14 -0
- data/spec/model/spec_helper.rb +3 -0
- data/spec/rspec_helper.rb +4 -0
- metadata +10 -2
@@ -192,6 +192,22 @@ describe Sequel::Model, "many_to_one" do
|
|
192
192
|
DB.reset
|
193
193
|
end
|
194
194
|
|
195
|
+
it "should raise an error if associated class does not have a primary key, and :primary_key is not specified" do
|
196
|
+
@c2.no_primary_key
|
197
|
+
@c2.many_to_one :parent, :class => @c2
|
198
|
+
d = @c2.new(:id => 1, :parent_id => 234)
|
199
|
+
proc{d.parent}.should raise_error(Sequel::Error)
|
200
|
+
DB.sqls.should == []
|
201
|
+
end
|
202
|
+
|
203
|
+
it "should raise an error if associated class does not have a primary key, and :primary_key is not specified, with an association block" do
|
204
|
+
@c2.no_primary_key
|
205
|
+
@c2.many_to_one :parent, :class => @c2 do |ds| ds end
|
206
|
+
d = @c2.new(:id => 1, :parent_id => 234)
|
207
|
+
proc{d.parent}.should raise_error(Sequel::Error)
|
208
|
+
DB.sqls.should == []
|
209
|
+
end
|
210
|
+
|
195
211
|
it "should use implicit key if omitted" do
|
196
212
|
@c2.many_to_one :parent, :class => @c2
|
197
213
|
|
@@ -1129,6 +1145,12 @@ describe Sequel::Model, "one_to_many" do
|
|
1129
1145
|
DB.reset
|
1130
1146
|
end
|
1131
1147
|
|
1148
|
+
it "should raise an error if current class does not have a primary key, and :primary_key is not specified" do
|
1149
|
+
@c2.no_primary_key
|
1150
|
+
proc{@c2.one_to_many :attributes, :class => @c1}.should raise_error(Sequel::Error)
|
1151
|
+
DB.sqls.should == []
|
1152
|
+
end
|
1153
|
+
|
1132
1154
|
it "should use implicit key if omitted" do
|
1133
1155
|
@c2.one_to_many :attributes, :class => @c1
|
1134
1156
|
@c2.new(:id => 1234).attributes_dataset.sql.should == 'SELECT * FROM attributes WHERE (attributes.node_id = 1234)'
|
@@ -1858,6 +1880,20 @@ describe Sequel::Model, "many_to_many" do
|
|
1858
1880
|
DB.reset
|
1859
1881
|
end
|
1860
1882
|
|
1883
|
+
it "should raise an error if current class does not have a primary key, and :left_primary_key is not specified" do
|
1884
|
+
@c2.no_primary_key
|
1885
|
+
proc{@c2.many_to_many :attributes, :class => @c1}.should raise_error(Sequel::Error)
|
1886
|
+
DB.sqls.should == []
|
1887
|
+
end
|
1888
|
+
|
1889
|
+
it "should raise an error if associated class does not have a primary key, and :right_primary_key is not specified" do
|
1890
|
+
@c1.no_primary_key
|
1891
|
+
@c2.many_to_many :attributes, :class => @c1
|
1892
|
+
d = @c2.new(:id => 1234)
|
1893
|
+
proc{d.attributes}.should raise_error(Sequel::Error)
|
1894
|
+
DB.sqls.should == []
|
1895
|
+
end
|
1896
|
+
|
1861
1897
|
it "should use implicit key values and join table if omitted" do
|
1862
1898
|
@c2.many_to_many :attributes, :class => @c1
|
1863
1899
|
@c2.new(:id => 1234).attributes_dataset.sql.should == 'SELECT attributes.* FROM attributes INNER JOIN attributes_nodes ON (attributes_nodes.attribute_id = attributes.id) WHERE (attributes_nodes.node_id = 1234)'
|
@@ -500,6 +500,20 @@ describe Sequel::Model, "#eager" do
|
|
500
500
|
a.first.track.album2.track.should == EagerTrack.load(:id => 3, :album_id=>1)
|
501
501
|
DB.sqls.should == []
|
502
502
|
end
|
503
|
+
|
504
|
+
it "should call post_load when eager loading limited associations" do
|
505
|
+
EagerTrack.many_to_one :album2, :clone=>:album
|
506
|
+
a = []
|
507
|
+
m = Module.new do
|
508
|
+
define_method(:post_load) do |objs|
|
509
|
+
a << 1
|
510
|
+
super(objs)
|
511
|
+
end
|
512
|
+
end
|
513
|
+
EagerAlbum.one_to_one :track, :class=>'EagerTrack', :key=>:album_id, :order=>:a, :extend=>m
|
514
|
+
EagerAlbum.eager(:track).all
|
515
|
+
a.should == [1]
|
516
|
+
end
|
503
517
|
|
504
518
|
it "should cascade eagerly loading when the :eager association option is used" do
|
505
519
|
a = EagerBand.eager(:albums).all
|
data/spec/model/spec_helper.rb
CHANGED
data/spec/rspec_helper.rb
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
unless defined?(RSPEC_EXAMPLE_GROUP)
|
2
2
|
if defined?(RSpec)
|
3
3
|
require 'rspec/version'
|
4
|
+
if RSpec::Version::STRING >= '3.0.0'
|
5
|
+
skip_pending = true
|
6
|
+
end
|
4
7
|
if RSpec::Version::STRING >= '2.11.0'
|
5
8
|
RSpec.configure do |config|
|
6
9
|
config.expect_with :rspec do |c|
|
@@ -15,4 +18,5 @@ unless defined?(RSPEC_EXAMPLE_GROUP)
|
|
15
18
|
else
|
16
19
|
RSPEC_EXAMPLE_GROUP = Spec::Example::ExampleGroup
|
17
20
|
end
|
21
|
+
RSPEC_SKIP_PENDING = skip_pending
|
18
22
|
end
|
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.15.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: 2014-
|
11
|
+
date: 2014-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: The Database Toolkit for Ruby
|
14
14
|
email: code@jeremyevans.net
|
@@ -131,6 +131,7 @@ extra_rdoc_files:
|
|
131
131
|
- doc/release_notes/4.12.0.txt
|
132
132
|
- doc/release_notes/4.13.0.txt
|
133
133
|
- doc/release_notes/4.14.0.txt
|
134
|
+
- doc/release_notes/4.15.0.txt
|
134
135
|
files:
|
135
136
|
- CHANGELOG
|
136
137
|
- MIT-LICENSE
|
@@ -232,6 +233,7 @@ files:
|
|
232
233
|
- doc/release_notes/4.12.0.txt
|
233
234
|
- doc/release_notes/4.13.0.txt
|
234
235
|
- doc/release_notes/4.14.0.txt
|
236
|
+
- doc/release_notes/4.15.0.txt
|
235
237
|
- doc/release_notes/4.2.0.txt
|
236
238
|
- doc/release_notes/4.3.0.txt
|
237
239
|
- doc/release_notes/4.4.0.txt
|
@@ -261,6 +263,7 @@ files:
|
|
261
263
|
- lib/sequel/adapters/do/mysql.rb
|
262
264
|
- lib/sequel/adapters/do/postgres.rb
|
263
265
|
- lib/sequel/adapters/do/sqlite3.rb
|
266
|
+
- lib/sequel/adapters/fdbsql.rb
|
264
267
|
- lib/sequel/adapters/firebird.rb
|
265
268
|
- lib/sequel/adapters/ibmdb.rb
|
266
269
|
- lib/sequel/adapters/informix.rb
|
@@ -269,6 +272,7 @@ files:
|
|
269
272
|
- lib/sequel/adapters/jdbc/cubrid.rb
|
270
273
|
- lib/sequel/adapters/jdbc/db2.rb
|
271
274
|
- lib/sequel/adapters/jdbc/derby.rb
|
275
|
+
- lib/sequel/adapters/jdbc/fdbsql.rb
|
272
276
|
- lib/sequel/adapters/jdbc/firebirdsql.rb
|
273
277
|
- lib/sequel/adapters/jdbc/h2.rb
|
274
278
|
- lib/sequel/adapters/jdbc/hsqldb.rb
|
@@ -296,6 +300,7 @@ files:
|
|
296
300
|
- lib/sequel/adapters/shared/access.rb
|
297
301
|
- lib/sequel/adapters/shared/cubrid.rb
|
298
302
|
- lib/sequel/adapters/shared/db2.rb
|
303
|
+
- lib/sequel/adapters/shared/fdbsql.rb
|
299
304
|
- lib/sequel/adapters/shared/firebird.rb
|
300
305
|
- lib/sequel/adapters/shared/informix.rb
|
301
306
|
- lib/sequel/adapters/shared/mssql.rb
|
@@ -465,6 +470,7 @@ files:
|
|
465
470
|
- lib/sequel/plugins/sharding.rb
|
466
471
|
- lib/sequel/plugins/single_table_inheritance.rb
|
467
472
|
- lib/sequel/plugins/skip_create_refresh.rb
|
473
|
+
- lib/sequel/plugins/split_values.rb
|
468
474
|
- lib/sequel/plugins/static_cache.rb
|
469
475
|
- lib/sequel/plugins/string_stripper.rb
|
470
476
|
- lib/sequel/plugins/subclasses.rb
|
@@ -484,6 +490,7 @@ files:
|
|
484
490
|
- lib/sequel/timezones.rb
|
485
491
|
- lib/sequel/version.rb
|
486
492
|
- spec/adapters/db2_spec.rb
|
493
|
+
- spec/adapters/fdbsql_spec.rb
|
487
494
|
- spec/adapters/firebird_spec.rb
|
488
495
|
- spec/adapters/informix_spec.rb
|
489
496
|
- spec/adapters/mssql_spec.rb
|
@@ -605,6 +612,7 @@ files:
|
|
605
612
|
- spec/extensions/skip_create_refresh_spec.rb
|
606
613
|
- spec/extensions/spec_helper.rb
|
607
614
|
- spec/extensions/split_array_nil_spec.rb
|
615
|
+
- spec/extensions/split_values_spec.rb
|
608
616
|
- spec/extensions/sql_expr_spec.rb
|
609
617
|
- spec/extensions/static_cache_spec.rb
|
610
618
|
- spec/extensions/string_date_time_spec.rb
|