sequel 3.14.0 → 3.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.
- data/CHANGELOG +30 -0
- data/README.rdoc +2 -2
- data/doc/cheat_sheet.rdoc +1 -1
- data/doc/release_notes/3.15.0.txt +78 -0
- data/lib/sequel/adapters/do/postgres.rb +1 -1
- data/lib/sequel/adapters/jdbc.rb +15 -7
- data/lib/sequel/adapters/jdbc/mssql.rb +22 -0
- data/lib/sequel/adapters/mysql.rb +2 -6
- data/lib/sequel/adapters/mysql2.rb +176 -0
- data/lib/sequel/adapters/odbc.rb +1 -1
- data/lib/sequel/adapters/postgres.rb +13 -0
- data/lib/sequel/adapters/shared/mysql.rb +9 -1
- data/lib/sequel/adapters/shared/postgres.rb +1 -1
- data/lib/sequel/adapters/shared/sqlite.rb +41 -13
- data/lib/sequel/core.rb +8 -0
- data/lib/sequel/database/connecting.rb +1 -1
- data/lib/sequel/dataset/actions.rb +1 -1
- data/lib/sequel/dataset/misc.rb +32 -0
- data/lib/sequel/dataset/query.rb +3 -1
- data/lib/sequel/extensions/named_timezones.rb +1 -2
- data/lib/sequel/model.rb +2 -1
- data/lib/sequel/model/associations.rb +3 -1
- data/lib/sequel/model/base.rb +44 -4
- data/lib/sequel/plugins/active_model.rb +5 -3
- data/lib/sequel/plugins/class_table_inheritance.rb +3 -3
- data/lib/sequel/version.rb +1 -1
- data/spec/adapters/mysql_spec.rb +12 -2
- data/spec/adapters/sqlite_spec.rb +31 -1
- data/spec/core/dataset_spec.rb +61 -1
- data/spec/core/spec_helper.rb +1 -0
- data/spec/extensions/active_model_spec.rb +10 -0
- data/spec/extensions/lazy_attributes_spec.rb +19 -11
- data/spec/extensions/named_timezones_spec.rb +13 -11
- data/spec/extensions/spec_helper.rb +1 -5
- data/spec/integration/associations_test.rb +23 -0
- data/spec/integration/dataset_test.rb +3 -3
- data/spec/integration/plugin_test.rb +6 -0
- data/spec/integration/schema_test.rb +7 -0
- data/spec/integration/timezone_test.rb +2 -2
- data/spec/integration/type_test.rb +1 -1
- data/spec/model/associations_spec.rb +7 -0
- data/spec/model/base_spec.rb +6 -6
- data/spec/model/model_spec.rb +38 -3
- data/spec/model/record_spec.rb +24 -0
- metadata +7 -4
data/spec/model/base_spec.rb
CHANGED
@@ -408,18 +408,18 @@ describe Sequel::Model, ".require_modification" do
|
|
408
408
|
end
|
409
409
|
|
410
410
|
it "should depend on whether the dataset provides an accurate number of rows matched by default" do
|
411
|
-
Class.new(Sequel::Model(@ds1)
|
412
|
-
Class.new(Sequel::Model(@ds2)
|
411
|
+
Class.new(Sequel::Model).set_dataset(@ds1).require_modification.should == false
|
412
|
+
Class.new(Sequel::Model).set_dataset(@ds2).require_modification.should == true
|
413
413
|
end
|
414
414
|
|
415
415
|
it "should obey global setting regardless of dataset support if set" do
|
416
416
|
Sequel::Model.require_modification = true
|
417
|
-
Class.new(Sequel::Model(@ds1)
|
418
|
-
Class.new(Sequel::Model(@ds2)
|
417
|
+
Class.new(Sequel::Model).set_dataset(@ds1).require_modification.should == true
|
418
|
+
Class.new(Sequel::Model).set_dataset(@ds2).require_modification.should == true
|
419
419
|
|
420
420
|
Sequel::Model.require_modification = false
|
421
|
-
Class.new(Sequel::Model(@ds1)
|
422
|
-
Class.new(Sequel::Model(@
|
421
|
+
Class.new(Sequel::Model).set_dataset(@ds1).require_modification.should == false
|
422
|
+
Class.new(Sequel::Model).set_dataset(@ds1).require_modification.should == false
|
423
423
|
end
|
424
424
|
end
|
425
425
|
|
data/spec/model/model_spec.rb
CHANGED
@@ -30,6 +30,33 @@ describe "Sequel::Model()" do
|
|
30
30
|
SmBlahTest.db.should == db
|
31
31
|
SmBlahTest.table_name.should == :sm_blah_tests
|
32
32
|
end
|
33
|
+
|
34
|
+
describe "reloading" do
|
35
|
+
after do
|
36
|
+
Object.send(:remove_const, :Album) if defined?(::Album)
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should work without raising an exception with a symbol" do
|
40
|
+
proc do
|
41
|
+
class ::Album < Sequel::Model(:table); end
|
42
|
+
class ::Album < Sequel::Model(:table); end
|
43
|
+
end.should_not raise_error
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should work without raising an exception with a database" do
|
47
|
+
proc do
|
48
|
+
class ::Album < Sequel::Model(@db); end
|
49
|
+
class ::Album < Sequel::Model(@db); end
|
50
|
+
end.should_not raise_error
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should work without raising an exception with a dataset" do
|
54
|
+
proc do
|
55
|
+
class ::Album < Sequel::Model(@db[:table]); end
|
56
|
+
class ::Album < Sequel::Model(@db[:table]); end
|
57
|
+
end.should_not raise_error
|
58
|
+
end
|
59
|
+
end
|
33
60
|
end
|
34
61
|
|
35
62
|
describe Sequel::Model do
|
@@ -381,7 +408,7 @@ describe Sequel::Model, "attribute accessors" do
|
|
381
408
|
@c = Class.new(Sequel::Model) do
|
382
409
|
def self.db_schema
|
383
410
|
set_columns(Array(@columns))
|
384
|
-
@db_schema = {:x=>{}, :y=>{}}
|
411
|
+
@db_schema = {:x=>{:type=>:integer}, :y=>{:type=>:integer}}
|
385
412
|
end
|
386
413
|
def self.set_dataset(ds, opts={})
|
387
414
|
@columns = ds.columns
|
@@ -417,6 +444,14 @@ describe Sequel::Model, "attribute accessors" do
|
|
417
444
|
proc{o.send(:x=)}.should raise_error
|
418
445
|
proc{o.send(:x=, 3, 4)}.should raise_error
|
419
446
|
end
|
447
|
+
|
448
|
+
it "should have a working typecasting setter even if the column is not selected" do
|
449
|
+
@c.set_dataset(@dataset.select(:y))
|
450
|
+
o = @c.new
|
451
|
+
|
452
|
+
o.x = '34'
|
453
|
+
o.x.should == 34
|
454
|
+
end
|
420
455
|
end
|
421
456
|
|
422
457
|
describe Sequel::Model, ".[]" do
|
@@ -498,7 +533,7 @@ context "Model.db_schema" do
|
|
498
533
|
@c.dataset.instance_variable_get(:@columns).should == [:x, :y]
|
499
534
|
end
|
500
535
|
|
501
|
-
specify "should restrict the schema
|
536
|
+
specify "should not restrict the schema for datasets with a :select option" do
|
502
537
|
ds = @dataset.select(:x, :y___z)
|
503
538
|
d = ds.db
|
504
539
|
def d.schema(table, opts = {})
|
@@ -506,7 +541,7 @@ context "Model.db_schema" do
|
|
506
541
|
end
|
507
542
|
def @c.columns; [:x, :z]; end
|
508
543
|
@c.dataset = ds
|
509
|
-
@c.db_schema.should == {:x=>{:type=>:integer}, :z=>{}}
|
544
|
+
@c.db_schema.should == {:x=>{:type=>:integer}, :z=>{}, :y=>{:type=>:string}}
|
510
545
|
end
|
511
546
|
|
512
547
|
specify "should not use schema if the dataset uses multiple tables or custom sql" do
|
data/spec/model/record_spec.rb
CHANGED
@@ -715,6 +715,30 @@ describe Sequel::Model, "#set" do
|
|
715
715
|
returned_value.should == @o1
|
716
716
|
MODEL_DB.sqls.should == []
|
717
717
|
end
|
718
|
+
|
719
|
+
it "#set should correctly handle cases where an instance method is added to the class" do
|
720
|
+
@o1.set(:x => 1)
|
721
|
+
@o1.values.should == {:x => 1}
|
722
|
+
|
723
|
+
@c.class_eval do
|
724
|
+
def z=(v)
|
725
|
+
self[:z] = v
|
726
|
+
end
|
727
|
+
end
|
728
|
+
@o1.set(:x => 2, :z => 3)
|
729
|
+
@o1.values.should == {:x => 2, :z=>3}
|
730
|
+
end
|
731
|
+
|
732
|
+
it "#set should correctly handle cases where a singleton method is added to the object" do
|
733
|
+
@o1.set(:x => 1)
|
734
|
+
@o1.values.should == {:x => 1}
|
735
|
+
|
736
|
+
def @o1.z=(v)
|
737
|
+
self[:z] = v
|
738
|
+
end
|
739
|
+
@o1.set(:x => 2, :z => 3)
|
740
|
+
@o1.values.should == {:x => 2, :z=>3}
|
741
|
+
end
|
718
742
|
end
|
719
743
|
|
720
744
|
describe Sequel::Model, "#update" do
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sequel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 59
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 3
|
8
|
-
-
|
8
|
+
- 15
|
9
9
|
- 0
|
10
|
-
version: 3.
|
10
|
+
version: 3.15.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jeremy Evans
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-09-01 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|
@@ -78,6 +78,7 @@ extra_rdoc_files:
|
|
78
78
|
- doc/release_notes/3.12.0.txt
|
79
79
|
- doc/release_notes/3.13.0.txt
|
80
80
|
- doc/release_notes/3.14.0.txt
|
81
|
+
- doc/release_notes/3.15.0.txt
|
81
82
|
files:
|
82
83
|
- COPYING
|
83
84
|
- CHANGELOG
|
@@ -123,6 +124,7 @@ files:
|
|
123
124
|
- doc/release_notes/3.12.0.txt
|
124
125
|
- doc/release_notes/3.13.0.txt
|
125
126
|
- doc/release_notes/3.14.0.txt
|
127
|
+
- doc/release_notes/3.15.0.txt
|
126
128
|
- doc/sharding.rdoc
|
127
129
|
- doc/sql.rdoc
|
128
130
|
- doc/virtual_rows.rdoc
|
@@ -297,6 +299,7 @@ files:
|
|
297
299
|
- lib/sequel/adapters/shared/sqlite.rb
|
298
300
|
- lib/sequel/adapters/sqlite.rb
|
299
301
|
- lib/sequel/adapters/utils/stored_procedures.rb
|
302
|
+
- lib/sequel/adapters/mysql2.rb
|
300
303
|
- lib/sequel/connection_pool.rb
|
301
304
|
- lib/sequel/connection_pool/sharded_single.rb
|
302
305
|
- lib/sequel/connection_pool/sharded_threaded.rb
|