sequel 4.26.0 → 4.29.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 +62 -0
- data/README.rdoc +4 -4
- data/bin/sequel +8 -0
- data/doc/opening_databases.rdoc +5 -7
- data/doc/postgresql.rdoc +13 -0
- data/doc/release_notes/4.27.0.txt +78 -0
- data/doc/release_notes/4.28.0.txt +57 -0
- data/doc/release_notes/4.29.0.txt +41 -0
- data/doc/thread_safety.rdoc +1 -1
- data/doc/transactions.rdoc +4 -1
- data/doc/validations.rdoc +1 -1
- data/lib/sequel/adapters/jdbc/postgresql.rb +1 -1
- data/lib/sequel/adapters/oracle.rb +1 -1
- data/lib/sequel/adapters/postgres.rb +9 -3
- data/lib/sequel/adapters/shared/postgres.rb +2 -2
- data/lib/sequel/adapters/sqlanywhere.rb +3 -3
- data/lib/sequel/core.rb +8 -18
- data/lib/sequel/database/query.rb +7 -2
- data/lib/sequel/database/schema_generator.rb +17 -4
- data/lib/sequel/database/transactions.rb +3 -3
- data/lib/sequel/dataset/actions.rb +38 -9
- data/lib/sequel/dataset/sql.rb +8 -3
- data/lib/sequel/extensions/date_arithmetic.rb +3 -0
- data/lib/sequel/extensions/pg_json_ops.rb +58 -5
- data/lib/sequel/extensions/schema_dumper.rb +12 -1
- data/lib/sequel/model/base.rb +32 -16
- data/lib/sequel/plugins/active_model.rb +7 -0
- data/lib/sequel/plugins/before_after_save.rb +48 -0
- data/lib/sequel/plugins/boolean_subsets.rb +56 -0
- data/lib/sequel/plugins/csv_serializer.rb +1 -1
- data/lib/sequel/plugins/defaults_setter.rb +8 -4
- data/lib/sequel/plugins/json_serializer.rb +25 -4
- data/lib/sequel/plugins/list.rb +9 -9
- data/lib/sequel/plugins/subset_conditions.rb +36 -0
- data/lib/sequel/plugins/uuid.rb +72 -0
- data/lib/sequel/version.rb +1 -1
- data/spec/adapters/postgres_spec.rb +11 -1
- data/spec/bin_spec.rb +4 -0
- data/spec/core/database_spec.rb +35 -0
- data/spec/core/dataset_spec.rb +34 -0
- data/spec/core/schema_generator_spec.rb +13 -0
- data/spec/core/schema_spec.rb +17 -0
- data/spec/extensions/active_model_spec.rb +70 -108
- data/spec/extensions/before_after_save_spec.rb +40 -0
- data/spec/extensions/boolean_subsets_spec.rb +47 -0
- data/spec/extensions/date_arithmetic_spec.rb +17 -0
- data/spec/extensions/json_serializer_spec.rb +7 -0
- data/spec/extensions/list_spec.rb +11 -0
- data/spec/extensions/pg_json_ops_spec.rb +46 -0
- data/spec/extensions/schema_dumper_spec.rb +18 -0
- data/spec/extensions/subset_conditions_spec.rb +38 -0
- data/spec/extensions/uuid_spec.rb +106 -0
- data/spec/integration/dataset_test.rb +14 -0
- data/spec/integration/prepared_statement_test.rb +3 -3
- data/spec/integration/schema_test.rb +7 -1
- data/spec/integration/transaction_test.rb +22 -0
- data/spec/model/class_dataset_methods_spec.rb +4 -0
- data/spec/model/model_spec.rb +1 -1
- data/spec/model/record_spec.rb +7 -1
- metadata +16 -2
|
@@ -36,6 +36,17 @@ describe "Sequel::Schema::Generator dump methods" do
|
|
|
36
36
|
g.indexes.must_equal g2.indexes
|
|
37
37
|
end
|
|
38
38
|
|
|
39
|
+
it "should respect :keep_order option to primary_key" do
|
|
40
|
+
g = @g.new(@d) do
|
|
41
|
+
Integer :a
|
|
42
|
+
primary_key :c, :keep_order=>true
|
|
43
|
+
end
|
|
44
|
+
g2 = @g.new(@d) do
|
|
45
|
+
instance_eval(g.dump_columns, __FILE__, __LINE__)
|
|
46
|
+
end
|
|
47
|
+
g.columns.must_equal g2.columns
|
|
48
|
+
end
|
|
49
|
+
|
|
39
50
|
it "should allow dumping indexes as separate add_index and drop_index methods" do
|
|
40
51
|
g = @g.new(@d) do
|
|
41
52
|
index :a
|
|
@@ -73,6 +84,9 @@ describe "Sequel::Database dump methods" do
|
|
|
73
84
|
when :t2
|
|
74
85
|
[[:c1, {:db_type=>'integer', :primary_key=>true, :allow_null=>false}],
|
|
75
86
|
[:c2, {:db_type=>'numeric', :primary_key=>true, :allow_null=>false}]]
|
|
87
|
+
when :t3
|
|
88
|
+
[[:c2, {:db_type=>'varchar(20)', :allow_null=>true}],
|
|
89
|
+
[:c1, {:db_type=>'integer', :primary_key=>true, :auto_increment=>true, :allow_null=>false}]]
|
|
76
90
|
when :t5
|
|
77
91
|
[[:c1, {:db_type=>'blahblah', :allow_null=>true}]]
|
|
78
92
|
end
|
|
@@ -96,6 +110,10 @@ describe "Sequel::Database dump methods" do
|
|
|
96
110
|
@d.dump_table_schema(:t6).must_equal "create_table(:t6) do\n primary_key :c1, :type=>Bignum\nend"
|
|
97
111
|
end
|
|
98
112
|
|
|
113
|
+
it "should dump auto incrementing primary keys with :keep_order option if they are not first" do
|
|
114
|
+
@d.dump_table_schema(:t3).must_equal "create_table(:t3) do\n String :c2, :size=>20\n primary_key :c1, :keep_order=>true\nend"
|
|
115
|
+
end
|
|
116
|
+
|
|
99
117
|
it "should handle foreign keys" do
|
|
100
118
|
@d.meta_def(:schema){|*s| [[:c1, {:db_type=>'integer', :allow_null=>true}]]}
|
|
101
119
|
@d.meta_def(:supports_foreign_key_parsing?){true}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
require File.join(File.dirname(File.expand_path(__FILE__)), 'spec_helper')
|
|
2
|
+
|
|
3
|
+
describe "subset_conditions plugin" do
|
|
4
|
+
before do
|
|
5
|
+
@c = Class.new(Sequel::Model(:a))
|
|
6
|
+
@c.plugin :subset_conditions
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
it "should provide *_conditions method return the arguments passed" do
|
|
10
|
+
@c.subset(:published, :published => true)
|
|
11
|
+
@c.where(@c.published_conditions).sql.must_equal @c.published.sql
|
|
12
|
+
|
|
13
|
+
@c.subset(:active, :active)
|
|
14
|
+
@c.where(@c.active_conditions).sql.must_equal @c.active.sql
|
|
15
|
+
|
|
16
|
+
@c.subset(:active_published, :active, :published => true)
|
|
17
|
+
@c.where(@c.active_published_conditions).sql.must_equal @c.active_published.sql
|
|
18
|
+
@c.where(Sequel.&(@c.active_conditions, @c.published_conditions)).sql.must_equal @c.active_published.sql
|
|
19
|
+
@c.where(Sequel.|(@c.active_conditions, @c.published_conditions)).sql.must_equal "SELECT * FROM a WHERE (active OR (published IS TRUE))"
|
|
20
|
+
@c.where(Sequel.|(@c.active_published_conditions, :foo)).sql.must_equal "SELECT * FROM a WHERE ((active AND (published IS TRUE)) OR foo)"
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
it "should work with blocks" do
|
|
24
|
+
p1 = proc{{:published=>true}}
|
|
25
|
+
@c.subset(:published, &p1)
|
|
26
|
+
@c.where(@c.published_conditions).sql.must_equal @c.published.sql
|
|
27
|
+
|
|
28
|
+
p2 = proc{:active}
|
|
29
|
+
@c.subset(:active, &p2)
|
|
30
|
+
@c.where(@c.active_conditions).sql.must_equal @c.active.sql
|
|
31
|
+
|
|
32
|
+
@c.subset(:active_published, p2, &p1)
|
|
33
|
+
@c.where(@c.active_published_conditions).sql.must_equal @c.active_published.sql
|
|
34
|
+
@c.where(Sequel.&(@c.active_conditions, @c.published_conditions)).sql.must_equal @c.active_published.sql
|
|
35
|
+
@c.where(Sequel.|(@c.active_conditions, @c.published_conditions)).sql.must_equal "SELECT * FROM a WHERE (active OR (published IS TRUE))"
|
|
36
|
+
@c.where(Sequel.|(@c.active_published_conditions, :foo)).sql.must_equal "SELECT * FROM a WHERE ((active AND (published IS TRUE)) OR foo)"
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
require File.join(File.dirname(File.expand_path(__FILE__)), "spec_helper")
|
|
2
|
+
|
|
3
|
+
describe "Sequel::Plugins::Uuid" do
|
|
4
|
+
before do
|
|
5
|
+
uuid = @uuid = '57308544-4e83-47b8-b87f-6f68b987f4f9'
|
|
6
|
+
@alt_uuid = 'd5d1ec46-5e8e-4a7b-adc9-50e76b819e19'
|
|
7
|
+
dc = Object.new
|
|
8
|
+
@c = Class.new(Sequel::Model(:t))
|
|
9
|
+
@c.class_eval do
|
|
10
|
+
columns :id, :uuid
|
|
11
|
+
plugin :uuid
|
|
12
|
+
def _save_refresh(*) end
|
|
13
|
+
define_method(:create_uuid) do
|
|
14
|
+
uuid
|
|
15
|
+
end
|
|
16
|
+
db.reset
|
|
17
|
+
end
|
|
18
|
+
@c.dataset.autoid = nil
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
it "should handle validations on the uuid field for new objects" do
|
|
22
|
+
@c.plugin :uuid, :force=>true
|
|
23
|
+
o = @c.new
|
|
24
|
+
def o.validate
|
|
25
|
+
errors.add(model.uuid_field, 'not present') unless send(model.uuid_field)
|
|
26
|
+
end
|
|
27
|
+
o.valid?.must_equal true
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
it "should set uuid field when skipping validations" do
|
|
31
|
+
@c.plugin :uuid
|
|
32
|
+
@c.new.save(:validate=>false)
|
|
33
|
+
@c.db.sqls.must_equal ["INSERT INTO t (uuid) VALUES ('#{@uuid}')"]
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
it "should set the uuid field on creation" do
|
|
37
|
+
o = @c.create
|
|
38
|
+
@c.db.sqls.must_equal ["INSERT INTO t (uuid) VALUES ('#{@uuid}')"]
|
|
39
|
+
o.uuid.must_equal @uuid
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
if RUBY_VERSION >= '1.9'
|
|
43
|
+
it "should allow specifying the uuid field via the :field option" do
|
|
44
|
+
c = Class.new(Sequel::Model(:t))
|
|
45
|
+
c.class_eval do
|
|
46
|
+
columns :id, :u
|
|
47
|
+
plugin :uuid, :field=>:u
|
|
48
|
+
def _save_refresh(*) end
|
|
49
|
+
end
|
|
50
|
+
o = c.create
|
|
51
|
+
c.db.sqls.first.must_match(/INSERT INTO t \(u\) VALUES \('[-0-9a-f]+'\)/)
|
|
52
|
+
o.u.must_match /[-0-9a-f]+/
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
it "should not raise an error if the model doesn't have the uuid column" do
|
|
57
|
+
@c.columns :id, :x
|
|
58
|
+
@c.send(:undef_method, :uuid)
|
|
59
|
+
@c.create(:x=>2)
|
|
60
|
+
@c.load(:id=>1, :x=>2).save
|
|
61
|
+
@c.db.sqls.must_equal ["INSERT INTO t (x) VALUES (2)", "UPDATE t SET x = 2 WHERE (id = 1)"]
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
it "should not overwrite an existing uuid value" do
|
|
65
|
+
o = @c.create(:uuid=>@alt_uuid)
|
|
66
|
+
@c.db.sqls.must_equal ["INSERT INTO t (uuid) VALUES ('#{@alt_uuid}')"]
|
|
67
|
+
o.uuid.must_equal @alt_uuid
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
it "should overwrite an existing uuid if the :force option is used" do
|
|
71
|
+
@c.plugin :uuid, :force=>true
|
|
72
|
+
o = @c.create(:uuid=>@alt_uuid)
|
|
73
|
+
@c.db.sqls.must_equal ["INSERT INTO t (uuid) VALUES ('#{@uuid}')"]
|
|
74
|
+
o.uuid.must_equal @uuid
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
it "should have uuid_field give the uuid field" do
|
|
78
|
+
@c.uuid_field.must_equal :uuid
|
|
79
|
+
@c.plugin :uuid, :field=>:u
|
|
80
|
+
@c.uuid_field.must_equal :u
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
it "should have uuid_overwrite? give the whether to overwrite an existing uuid" do
|
|
84
|
+
@c.uuid_overwrite?.must_equal false
|
|
85
|
+
@c.plugin :uuid, :force=>true
|
|
86
|
+
@c.uuid_overwrite?.must_equal true
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
it "should work with subclasses" do
|
|
90
|
+
c = Class.new(@c)
|
|
91
|
+
o = c.create
|
|
92
|
+
o.uuid.must_equal @uuid
|
|
93
|
+
c.db.sqls.must_equal ["INSERT INTO t (uuid) VALUES ('#{@uuid}')"]
|
|
94
|
+
c.create(:uuid=>@alt_uuid).uuid.must_equal @alt_uuid
|
|
95
|
+
|
|
96
|
+
c.class_eval do
|
|
97
|
+
columns :id, :u
|
|
98
|
+
plugin :uuid, :field=>:u, :force=>true
|
|
99
|
+
end
|
|
100
|
+
c2 = Class.new(c)
|
|
101
|
+
c2.db.reset
|
|
102
|
+
o = c2.create
|
|
103
|
+
o.u.must_equal @uuid
|
|
104
|
+
c2.db.sqls.first.must_match(/INSERT INTO t \([u]\) VALUES \('#{@uuid}'\)/)
|
|
105
|
+
end
|
|
106
|
+
end
|
|
@@ -173,6 +173,20 @@ describe "Simple Dataset operations" do
|
|
|
173
173
|
|
|
174
174
|
it "should fetch a single row correctly" do
|
|
175
175
|
@ds.first.must_equal(:id=>1, :number=>10)
|
|
176
|
+
@ds.single_record.must_equal(:id=>1, :number=>10)
|
|
177
|
+
@ds.single_record!.must_equal(:id=>1, :number=>10)
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
it "should work correctly when returning from each without iterating over the whole result set" do
|
|
181
|
+
@ds.insert(:number=>20)
|
|
182
|
+
@ds.order(:id).each{|v| break v}.must_equal(:id=>1, :number=>10)
|
|
183
|
+
@ds.reverse(:id).each{|v| break v}.must_equal(:id=>2, :number=>20)
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
it "should fetch a single value correctly" do
|
|
187
|
+
@ds.get(:id).must_equal 1
|
|
188
|
+
@ds.select(:id).single_value.must_equal 1
|
|
189
|
+
@ds.select(:id).single_value!.must_equal 1
|
|
176
190
|
end
|
|
177
191
|
|
|
178
192
|
it "should have distinct work with limit" do
|
|
@@ -355,13 +355,13 @@ describe "Bound Argument Types" do
|
|
|
355
355
|
@ds.literal(@ds.filter(:t=>:$x).prepare(:first, :ps_time).call(:x=>fract_time)[:t]).must_equal @ds.literal(fract_time)
|
|
356
356
|
end
|
|
357
357
|
|
|
358
|
-
cspecify "should handle blob type", [:odbc]
|
|
358
|
+
cspecify "should handle blob type", [:odbc] do
|
|
359
359
|
@ds.delete
|
|
360
360
|
@ds.prepare(:insert, :ps_blob, {:file=>:$x}).call(:x=>@vs[:file])
|
|
361
361
|
@ds.get(:file).must_equal @vs[:file]
|
|
362
362
|
end
|
|
363
363
|
|
|
364
|
-
cspecify "should handle blob type with special characters", [:odbc]
|
|
364
|
+
cspecify "should handle blob type with special characters", [:odbc] do
|
|
365
365
|
@ds.delete
|
|
366
366
|
blob = Sequel.blob("\"'[]`a0 ")
|
|
367
367
|
@ds.prepare(:insert, :ps_blob, {:file=>:$x}).call(:x=>blob)
|
|
@@ -374,7 +374,7 @@ describe "Bound Argument Types" do
|
|
|
374
374
|
@ds.get(:file).must_equal nil
|
|
375
375
|
end
|
|
376
376
|
|
|
377
|
-
cspecify "should handle blob type with embedded zeros", [:odbc]
|
|
377
|
+
cspecify "should handle blob type with embedded zeros", [:odbc] do
|
|
378
378
|
zero_blob = Sequel::SQL::Blob.new("a\0"*100)
|
|
379
379
|
@ds.delete
|
|
380
380
|
@ds.prepare(:insert, :ps_blob, {:file=>:$x}).call(:x=>zero_blob)
|
|
@@ -259,6 +259,12 @@ describe "Database foreign key parsing" do
|
|
|
259
259
|
@db.create_table!(:b, :engine=>:InnoDB){Integer :e, :null=>false; Integer :f, :null=>false; Integer :g, :null=>false; foreign_key [:e, :f], :a; foreign_key [:g, :f], :a, :key=>[:d, :c]}
|
|
260
260
|
@pr[:b, [[:e, :f], :a, [:pk, :b, :c]], [[:g, :f], :a, [:d, :c]]]
|
|
261
261
|
end
|
|
262
|
+
|
|
263
|
+
it "should handle self-referential composite foreign and primary keys" do
|
|
264
|
+
@db.create_table!(:a, :engine=>:InnoDB){Integer :b, :null=>false; Integer :c, :null=>false; Integer :d, :null=>false; primary_key [:b, :c]; unique [:d, :b]}
|
|
265
|
+
@db.alter_table(:a){add_foreign_key [:b, :d], :a; add_foreign_key [:d, :c], :a; add_foreign_key [:c, :b], :a, :key=>[:d, :b]}
|
|
266
|
+
@pr[:a, [[:b, :d], :a, [:pk, :b, :c]], [[:c, :b], :a, [:d, :b]], [[:d, :c], :a, [:pk, :b, :c]]]
|
|
267
|
+
end
|
|
262
268
|
end if DB.supports_foreign_key_parsing?
|
|
263
269
|
|
|
264
270
|
describe "Database schema modifiers" do
|
|
@@ -576,7 +582,7 @@ describe "Database schema modifiers" do
|
|
|
576
582
|
@db.schema(:items, :reload=>true).map{|x| x.first}.must_equal [:id]
|
|
577
583
|
@ds.columns!.must_equal [:id]
|
|
578
584
|
@ds.insert(:id=>'20')
|
|
579
|
-
@ds.all.must_equal [{:id=>"10"}, {:id=>"20"}]
|
|
585
|
+
@ds.order(:id).all.must_equal [{:id=>"10"}, {:id=>"20"}]
|
|
580
586
|
end
|
|
581
587
|
|
|
582
588
|
cspecify "should set column types without modifying NULL/NOT NULL", [:jdbc, :db2], [:db2], :oracle, :derby do
|
|
@@ -84,6 +84,28 @@ describe "Database transactions" do
|
|
|
84
84
|
end
|
|
85
85
|
|
|
86
86
|
if DB.supports_savepoints?
|
|
87
|
+
it "should handle table_exists? failures inside transactions" do
|
|
88
|
+
@db.transaction do
|
|
89
|
+
@d << {:name => '1'}
|
|
90
|
+
@db.table_exists?(:asadf098asd9asd98sa).must_equal false
|
|
91
|
+
@d << {:name => '2'}
|
|
92
|
+
end
|
|
93
|
+
@d.select_order_map(:name).must_equal %w'1 2'
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
it "should handle table_exists? failures inside savepoints" do
|
|
97
|
+
@db.transaction do
|
|
98
|
+
@d << {:name => '1'}
|
|
99
|
+
@db.transaction(:savepoint=>true) do
|
|
100
|
+
@d << {:name => '2'}
|
|
101
|
+
@db.table_exists?(:asadf098asd9asd98sa).must_equal false
|
|
102
|
+
@d << {:name => '3'}
|
|
103
|
+
end
|
|
104
|
+
@d << {:name => '4'}
|
|
105
|
+
end
|
|
106
|
+
@d.select_order_map(:name).must_equal %w'1 2 3 4'
|
|
107
|
+
end
|
|
108
|
+
|
|
87
109
|
it "should support nested transactions through savepoints using the savepoint option" do
|
|
88
110
|
@db.transaction do
|
|
89
111
|
@d << {:name => '1'}
|
|
@@ -110,8 +110,12 @@ describe Sequel::Model, "class dataset methods" do
|
|
|
110
110
|
@c.set_graph_aliases(:a=>:b).opts[:graph_aliases].must_equal(:a=>[:b, :a])
|
|
111
111
|
@c.single_record.must_equal @c.load(:id=>1)
|
|
112
112
|
@db.sqls.must_equal ["SELECT * FROM items LIMIT 1"]
|
|
113
|
+
@c.single_record!.must_equal @c.load(:id=>1)
|
|
114
|
+
@db.sqls.must_equal ["SELECT * FROM items"]
|
|
113
115
|
@c.single_value.must_equal 1
|
|
114
116
|
@db.sqls.must_equal ["SELECT * FROM items LIMIT 1"]
|
|
117
|
+
@c.single_value!.must_equal 1
|
|
118
|
+
@db.sqls.must_equal ["SELECT * FROM items"]
|
|
115
119
|
@c.sum(:id).must_equal 1
|
|
116
120
|
@db.sqls.must_equal ["SELECT sum(id) AS sum FROM items LIMIT 1"]
|
|
117
121
|
@c.to_hash(:id, :id).must_equal(1=>1)
|
data/spec/model/model_spec.rb
CHANGED
|
@@ -474,7 +474,7 @@ describe Sequel::Model, ".finder" do
|
|
|
474
474
|
@c.each_foo(3, 4){|r| a << r}
|
|
475
475
|
a.must_equal [@o]
|
|
476
476
|
|
|
477
|
-
@c.get_foo(5, 6).must_equal
|
|
477
|
+
@c.get_foo(5, 6).must_equal 1
|
|
478
478
|
|
|
479
479
|
@db.sqls.must_equal ["SELECT * FROM items WHERE (bar = 1) ORDER BY 2", "SELECT * FROM items WHERE (bar = 3) ORDER BY 4", "SELECT * FROM items WHERE (bar = 5) ORDER BY 6 LIMIT 1"]
|
|
480
480
|
end
|
data/spec/model/record_spec.rb
CHANGED
|
@@ -67,6 +67,12 @@ describe "Model#save" do
|
|
|
67
67
|
DB.sqls.must_equal ["INSERT INTO items (x) VALUES (1)", "SELECT * FROM items WHERE (id = 13) LIMIT 1"]
|
|
68
68
|
end
|
|
69
69
|
|
|
70
|
+
it "should raise if the object can't be refreshed after save" do
|
|
71
|
+
o = @c.new(:x => 1)
|
|
72
|
+
@c.instance_dataset._fetch =@c.dataset._fetch = []
|
|
73
|
+
proc{o.save}.must_raise(Sequel::NoExistingObject)
|
|
74
|
+
end
|
|
75
|
+
|
|
70
76
|
it "should use dataset's insert_select method if present" do
|
|
71
77
|
ds = @c.instance_dataset
|
|
72
78
|
ds._fetch = {:y=>2}
|
|
@@ -1738,7 +1744,7 @@ describe Sequel::Model, "#refresh" do
|
|
|
1738
1744
|
it "should raise if the instance is not found" do
|
|
1739
1745
|
@m = @c.new(:id => 555)
|
|
1740
1746
|
@c.instance_dataset._fetch =@c.dataset._fetch = []
|
|
1741
|
-
proc {@m.refresh}.must_raise(Sequel::
|
|
1747
|
+
proc {@m.refresh}.must_raise(Sequel::NoExistingObject)
|
|
1742
1748
|
DB.sqls.must_equal ["SELECT * FROM items WHERE (id = 555) LIMIT 1"]
|
|
1743
1749
|
end
|
|
1744
1750
|
|
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.29.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: 2015-
|
|
11
|
+
date: 2015-12-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: minitest
|
|
@@ -227,6 +227,9 @@ extra_rdoc_files:
|
|
|
227
227
|
- doc/release_notes/4.24.0.txt
|
|
228
228
|
- doc/release_notes/4.25.0.txt
|
|
229
229
|
- doc/release_notes/4.26.0.txt
|
|
230
|
+
- doc/release_notes/4.27.0.txt
|
|
231
|
+
- doc/release_notes/4.28.0.txt
|
|
232
|
+
- doc/release_notes/4.29.0.txt
|
|
230
233
|
files:
|
|
231
234
|
- CHANGELOG
|
|
232
235
|
- MIT-LICENSE
|
|
@@ -341,6 +344,9 @@ files:
|
|
|
341
344
|
- doc/release_notes/4.24.0.txt
|
|
342
345
|
- doc/release_notes/4.25.0.txt
|
|
343
346
|
- doc/release_notes/4.26.0.txt
|
|
347
|
+
- doc/release_notes/4.27.0.txt
|
|
348
|
+
- doc/release_notes/4.28.0.txt
|
|
349
|
+
- doc/release_notes/4.29.0.txt
|
|
344
350
|
- doc/release_notes/4.3.0.txt
|
|
345
351
|
- doc/release_notes/4.4.0.txt
|
|
346
352
|
- doc/release_notes/4.5.0.txt
|
|
@@ -530,8 +536,10 @@ files:
|
|
|
530
536
|
- lib/sequel/plugins/association_pks.rb
|
|
531
537
|
- lib/sequel/plugins/association_proxies.rb
|
|
532
538
|
- lib/sequel/plugins/auto_validations.rb
|
|
539
|
+
- lib/sequel/plugins/before_after_save.rb
|
|
533
540
|
- lib/sequel/plugins/blacklist_security.rb
|
|
534
541
|
- lib/sequel/plugins/boolean_readers.rb
|
|
542
|
+
- lib/sequel/plugins/boolean_subsets.rb
|
|
535
543
|
- lib/sequel/plugins/caching.rb
|
|
536
544
|
- lib/sequel/plugins/class_table_inheritance.rb
|
|
537
545
|
- lib/sequel/plugins/column_conflicts.rb
|
|
@@ -581,6 +589,7 @@ files:
|
|
|
581
589
|
- lib/sequel/plugins/static_cache.rb
|
|
582
590
|
- lib/sequel/plugins/string_stripper.rb
|
|
583
591
|
- lib/sequel/plugins/subclasses.rb
|
|
592
|
+
- lib/sequel/plugins/subset_conditions.rb
|
|
584
593
|
- lib/sequel/plugins/table_select.rb
|
|
585
594
|
- lib/sequel/plugins/tactical_eager_loading.rb
|
|
586
595
|
- lib/sequel/plugins/timestamps.rb
|
|
@@ -591,6 +600,7 @@ files:
|
|
|
591
600
|
- lib/sequel/plugins/update_or_create.rb
|
|
592
601
|
- lib/sequel/plugins/update_primary_key.rb
|
|
593
602
|
- lib/sequel/plugins/update_refresh.rb
|
|
603
|
+
- lib/sequel/plugins/uuid.rb
|
|
594
604
|
- lib/sequel/plugins/validate_associated.rb
|
|
595
605
|
- lib/sequel/plugins/validation_class_methods.rb
|
|
596
606
|
- lib/sequel/plugins/validation_helpers.rb
|
|
@@ -630,9 +640,11 @@ files:
|
|
|
630
640
|
- spec/extensions/association_pks_spec.rb
|
|
631
641
|
- spec/extensions/association_proxies_spec.rb
|
|
632
642
|
- spec/extensions/auto_validations_spec.rb
|
|
643
|
+
- spec/extensions/before_after_save_spec.rb
|
|
633
644
|
- spec/extensions/blacklist_security_spec.rb
|
|
634
645
|
- spec/extensions/blank_spec.rb
|
|
635
646
|
- spec/extensions/boolean_readers_spec.rb
|
|
647
|
+
- spec/extensions/boolean_subsets_spec.rb
|
|
636
648
|
- spec/extensions/caching_spec.rb
|
|
637
649
|
- spec/extensions/class_table_inheritance_spec.rb
|
|
638
650
|
- spec/extensions/column_conflicts_spec.rb
|
|
@@ -733,6 +745,7 @@ files:
|
|
|
733
745
|
- spec/extensions/string_date_time_spec.rb
|
|
734
746
|
- spec/extensions/string_stripper_spec.rb
|
|
735
747
|
- spec/extensions/subclasses_spec.rb
|
|
748
|
+
- spec/extensions/subset_conditions_spec.rb
|
|
736
749
|
- spec/extensions/table_select_spec.rb
|
|
737
750
|
- spec/extensions/tactical_eager_loading_spec.rb
|
|
738
751
|
- spec/extensions/thread_local_timezones_spec.rb
|
|
@@ -745,6 +758,7 @@ files:
|
|
|
745
758
|
- spec/extensions/update_or_create_spec.rb
|
|
746
759
|
- spec/extensions/update_primary_key_spec.rb
|
|
747
760
|
- spec/extensions/update_refresh_spec.rb
|
|
761
|
+
- spec/extensions/uuid_spec.rb
|
|
748
762
|
- spec/extensions/validate_associated_spec.rb
|
|
749
763
|
- spec/extensions/validation_class_methods_spec.rb
|
|
750
764
|
- spec/extensions/validation_helpers_spec.rb
|