sequel 3.2.0 → 3.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +40 -0
- data/Rakefile +1 -1
- data/doc/opening_databases.rdoc +7 -0
- data/doc/release_notes/3.3.0.txt +192 -0
- data/lib/sequel/adapters/ado.rb +34 -39
- data/lib/sequel/adapters/ado/mssql.rb +30 -0
- data/lib/sequel/adapters/jdbc.rb +27 -4
- data/lib/sequel/adapters/jdbc/h2.rb +14 -3
- data/lib/sequel/adapters/jdbc/mssql.rb +51 -0
- data/lib/sequel/adapters/mysql.rb +28 -12
- data/lib/sequel/adapters/odbc.rb +36 -30
- data/lib/sequel/adapters/odbc/mssql.rb +44 -0
- data/lib/sequel/adapters/shared/mssql.rb +185 -10
- data/lib/sequel/adapters/shared/mysql.rb +9 -9
- data/lib/sequel/adapters/shared/sqlite.rb +45 -47
- data/lib/sequel/connection_pool.rb +8 -5
- data/lib/sequel/core.rb +2 -8
- data/lib/sequel/database.rb +9 -10
- data/lib/sequel/database/schema_sql.rb +3 -2
- data/lib/sequel/dataset.rb +1 -0
- data/lib/sequel/dataset/sql.rb +15 -6
- data/lib/sequel/extensions/schema_dumper.rb +7 -7
- data/lib/sequel/model/associations.rb +16 -14
- data/lib/sequel/model/base.rb +25 -7
- data/lib/sequel/plugins/association_proxies.rb +41 -0
- data/lib/sequel/plugins/many_through_many.rb +0 -1
- data/lib/sequel/sql.rb +8 -11
- data/lib/sequel/version.rb +1 -1
- data/spec/adapters/mysql_spec.rb +42 -38
- data/spec/adapters/sqlite_spec.rb +0 -4
- data/spec/core/database_spec.rb +22 -1
- data/spec/core/dataset_spec.rb +37 -12
- data/spec/core/expression_filters_spec.rb +5 -0
- data/spec/core/schema_spec.rb +15 -8
- data/spec/extensions/association_proxies_spec.rb +47 -0
- data/spec/extensions/caching_spec.rb +2 -2
- data/spec/extensions/hook_class_methods_spec.rb +6 -6
- data/spec/extensions/many_through_many_spec.rb +13 -0
- data/spec/extensions/schema_dumper_spec.rb +12 -4
- data/spec/extensions/validation_class_methods_spec.rb +3 -3
- data/spec/integration/dataset_test.rb +47 -17
- data/spec/integration/prepared_statement_test.rb +5 -5
- data/spec/integration/schema_test.rb +111 -34
- data/spec/model/associations_spec.rb +128 -11
- data/spec/model/hooks_spec.rb +7 -6
- data/spec/model/model_spec.rb +54 -4
- data/spec/model/record_spec.rb +2 -3
- data/spec/model/validations_spec.rb +4 -4
- metadata +109 -101
- data/spec/adapters/ado_spec.rb +0 -93
@@ -16,6 +16,26 @@ describe Sequel::Model, "associate" do
|
|
16
16
|
klass.association_reflection(:"par_parent2s").associated_class.should == ParParent
|
17
17
|
end
|
18
18
|
|
19
|
+
it "should default to associating to other models in the same scope" do
|
20
|
+
class ::AssociationModuleTest
|
21
|
+
class Album < Sequel::Model
|
22
|
+
many_to_one :artist
|
23
|
+
many_to_many :tags
|
24
|
+
end
|
25
|
+
class Artist< Sequel::Model
|
26
|
+
one_to_many :albums
|
27
|
+
end
|
28
|
+
class Tag < Sequel::Model
|
29
|
+
many_to_many :albums
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
::AssociationModuleTest::Album.association_reflection(:artist).associated_class.should == ::AssociationModuleTest::Artist
|
34
|
+
::AssociationModuleTest::Album.association_reflection(:tags).associated_class.should == ::AssociationModuleTest::Tag
|
35
|
+
::AssociationModuleTest::Artist.association_reflection(:albums).associated_class.should == ::AssociationModuleTest::Album
|
36
|
+
::AssociationModuleTest::Tag.association_reflection(:albums).associated_class.should == ::AssociationModuleTest::Album
|
37
|
+
end
|
38
|
+
|
19
39
|
it "should add a model_object and association_reflection accessors to the dataset, and return it with the current model object" do
|
20
40
|
MODEL_DB.reset
|
21
41
|
klass = Class.new(Sequel::Model(:nodes)) do
|
@@ -974,9 +994,8 @@ describe Sequel::Model, "one_to_many" do
|
|
974
994
|
MODEL_DB.sqls.clear
|
975
995
|
attrib = @c1.load(:id=>3)
|
976
996
|
@c2.new(:id => 1234).attribute = attrib
|
977
|
-
MODEL_DB.sqls.
|
978
|
-
|
979
|
-
MODEL_DB.sqls.last.should == 'UPDATE attributes SET node_id = NULL WHERE ((node_id = 1234) AND (id != 3))'
|
997
|
+
MODEL_DB.sqls.should == ["UPDATE attributes SET node_id = 1234 WHERE (id = 3)",
|
998
|
+
'UPDATE attributes SET node_id = NULL WHERE ((node_id = 1234) AND (id != 3))']
|
980
999
|
end
|
981
1000
|
|
982
1001
|
it "should use a transaction in the setter method if the :one_to_one option is true" do
|
@@ -985,11 +1004,10 @@ describe Sequel::Model, "one_to_many" do
|
|
985
1004
|
MODEL_DB.sqls.clear
|
986
1005
|
attrib = @c1.load(:id=>3)
|
987
1006
|
@c2.new(:id => 1234).attribute = attrib
|
988
|
-
MODEL_DB.sqls.
|
989
|
-
|
990
|
-
|
991
|
-
|
992
|
-
MODEL_DB.sqls.last.should == 'COMMIT'
|
1007
|
+
MODEL_DB.sqls.should == ['BEGIN',
|
1008
|
+
"UPDATE attributes SET node_id = 1234 WHERE (id = 3)",
|
1009
|
+
'UPDATE attributes SET node_id = NULL WHERE ((node_id = 1234) AND (id != 3))',
|
1010
|
+
'COMMIT']
|
993
1011
|
end
|
994
1012
|
|
995
1013
|
it "should have the setter method for the :one_to_one option respect the :primary_key option" do
|
@@ -1006,9 +1024,8 @@ describe Sequel::Model, "one_to_many" do
|
|
1006
1024
|
MODEL_DB.sqls.clear
|
1007
1025
|
attrib = @c1.load(:id=>3)
|
1008
1026
|
@c2.new(:id => 621, :xxx=>5).attribute = attrib
|
1009
|
-
MODEL_DB.sqls.
|
1010
|
-
|
1011
|
-
MODEL_DB.sqls.last.should == 'UPDATE attributes SET node_id = NULL WHERE ((node_id = 5) AND (id != 3))'
|
1027
|
+
MODEL_DB.sqls.should == ['UPDATE attributes SET node_id = 5 WHERE (id = 3)',
|
1028
|
+
'UPDATE attributes SET node_id = NULL WHERE ((node_id = 5) AND (id != 3))']
|
1012
1029
|
end
|
1013
1030
|
|
1014
1031
|
it "should raise an error if the one_to_one getter would be the same as the association name" do
|
@@ -1042,6 +1059,20 @@ describe Sequel::Model, "one_to_many" do
|
|
1042
1059
|
p.instance_variable_get(:@x).should == c
|
1043
1060
|
end
|
1044
1061
|
|
1062
|
+
it "should allow additional arguments given to the add_ method and pass them onwards to the _add_ method" do
|
1063
|
+
@c2.one_to_many :attributes, :class => @c1
|
1064
|
+
p = @c2.load(:id=>10)
|
1065
|
+
c = @c1.load(:id=>123)
|
1066
|
+
def p._add_attribute(x,*y)
|
1067
|
+
@x = x
|
1068
|
+
@y = y
|
1069
|
+
end
|
1070
|
+
c.should_not_receive(:node_id=)
|
1071
|
+
p.add_attribute(c,:foo,:bar=>:baz)
|
1072
|
+
p.instance_variable_get(:@x).should == c
|
1073
|
+
p.instance_variable_get(:@y).should == [:foo,{:bar=>:baz}]
|
1074
|
+
end
|
1075
|
+
|
1045
1076
|
it "should call a _remove_ method internally to remove attributes" do
|
1046
1077
|
@c2.one_to_many :attributes, :class => @c1
|
1047
1078
|
@c2.private_instance_methods.collect{|x| x.to_s}.sort.should(include("_remove_attribute"))
|
@@ -1055,6 +1086,43 @@ describe Sequel::Model, "one_to_many" do
|
|
1055
1086
|
p.instance_variable_get(:@x).should == c
|
1056
1087
|
end
|
1057
1088
|
|
1089
|
+
it "should allow additional arguments given to the remove_ method and pass them onwards to the _remove_ method" do
|
1090
|
+
@c2.one_to_many :attributes, :class => @c1
|
1091
|
+
p = @c2.load(:id=>10)
|
1092
|
+
c = @c1.load(:id=>123)
|
1093
|
+
def p._remove_attribute(x,*y)
|
1094
|
+
@x = x
|
1095
|
+
@y = y
|
1096
|
+
end
|
1097
|
+
c.should_not_receive(:node_id=)
|
1098
|
+
p.remove_attribute(c,:foo,:bar=>:baz)
|
1099
|
+
p.instance_variable_get(:@x).should == c
|
1100
|
+
p.instance_variable_get(:@y).should == [:foo,{:bar=>:baz}]
|
1101
|
+
end
|
1102
|
+
|
1103
|
+
it "should allow additional arguments given to the remove_all_ method and pass them onwards to the _remove_all_ method" do
|
1104
|
+
@c2.one_to_many :attributes, :class => @c1
|
1105
|
+
p = @c2.load(:id=>10)
|
1106
|
+
c = @c1.load(:id=>123)
|
1107
|
+
def p._remove_all_attributes(*y)
|
1108
|
+
@y = y
|
1109
|
+
end
|
1110
|
+
c.should_not_receive(:node_id=)
|
1111
|
+
p.remove_all_attributes(:foo,:bar=>:baz)
|
1112
|
+
p.instance_variable_get(:@y).should == [:foo,{:bar=>:baz}]
|
1113
|
+
end
|
1114
|
+
|
1115
|
+
it "should call a _remove_all_ method internally to remove attributes" do
|
1116
|
+
@c2.one_to_many :attributes, :class => @c1
|
1117
|
+
@c2.private_instance_methods.collect{|x| x.to_s}.sort.should(include("_remove_all_attributes"))
|
1118
|
+
p = @c2.load(:id=>10)
|
1119
|
+
def p._remove_all_attributes
|
1120
|
+
@x = :foo
|
1121
|
+
end
|
1122
|
+
p.remove_all_attributes
|
1123
|
+
p.instance_variable_get(:@x).should == :foo
|
1124
|
+
end
|
1125
|
+
|
1058
1126
|
it "should support (before|after)_(add|remove) callbacks" do
|
1059
1127
|
h = []
|
1060
1128
|
@c2.one_to_many :attributes, :class => @c1, :before_add=>[proc{|x,y| h << x.pk; h << -y.pk}, :blah], :after_add=>proc{h << 3}, :before_remove=>:blah, :after_remove=>[:blahr]
|
@@ -1572,6 +1640,19 @@ describe Sequel::Model, "many_to_many" do
|
|
1572
1640
|
MODEL_DB.sqls.should == []
|
1573
1641
|
end
|
1574
1642
|
|
1643
|
+
it "should allow additional arguments given to the add_ method and pass them onwards to the _add_ method" do
|
1644
|
+
@c2.many_to_many :attributes, :class => @c1
|
1645
|
+
p = @c2.load(:id=>10)
|
1646
|
+
c = @c1.load(:id=>123)
|
1647
|
+
def p._add_attribute(x,*y)
|
1648
|
+
@x = x
|
1649
|
+
@y = y
|
1650
|
+
end
|
1651
|
+
p.add_attribute(c,:foo,:bar=>:baz)
|
1652
|
+
p.instance_variable_get(:@x).should == c
|
1653
|
+
p.instance_variable_get(:@y).should == [:foo,{:bar=>:baz}]
|
1654
|
+
end
|
1655
|
+
|
1575
1656
|
it "should call a _remove_ method internally to remove attributes" do
|
1576
1657
|
@c2.many_to_many :attributes, :class => @c1
|
1577
1658
|
@c2.private_instance_methods.collect{|x| x.to_s}.sort.should(include("_remove_attribute"))
|
@@ -1585,6 +1666,42 @@ describe Sequel::Model, "many_to_many" do
|
|
1585
1666
|
MODEL_DB.sqls.should == []
|
1586
1667
|
end
|
1587
1668
|
|
1669
|
+
it "should allow additional arguments given to the remove_ method and pass them onwards to the _remove_ method" do
|
1670
|
+
@c2.many_to_many :attributes, :class => @c1
|
1671
|
+
p = @c2.load(:id=>10)
|
1672
|
+
c = @c1.load(:id=>123)
|
1673
|
+
def p._remove_attribute(x,*y)
|
1674
|
+
@x = x
|
1675
|
+
@y = y
|
1676
|
+
end
|
1677
|
+
p.remove_attribute(c,:foo,:bar=>:baz)
|
1678
|
+
p.instance_variable_get(:@x).should == c
|
1679
|
+
p.instance_variable_get(:@y).should == [:foo,{:bar=>:baz}]
|
1680
|
+
end
|
1681
|
+
|
1682
|
+
it "should allow additional arguments given to the remove_all_ method and pass them onwards to the _remove_all_ method" do
|
1683
|
+
@c2.many_to_many :attributes, :class => @c1
|
1684
|
+
p = @c2.load(:id=>10)
|
1685
|
+
c = @c1.load(:id=>123)
|
1686
|
+
def p._remove_all_attributes(*y)
|
1687
|
+
@y = y
|
1688
|
+
end
|
1689
|
+
p.remove_all_attributes(:foo,:bar=>:baz)
|
1690
|
+
p.instance_variable_get(:@y).should == [:foo,{:bar=>:baz}]
|
1691
|
+
end
|
1692
|
+
|
1693
|
+
it "should call a _remove_all_ method internally to remove attributes" do
|
1694
|
+
@c2.many_to_many :attributes, :class => @c1
|
1695
|
+
@c2.private_instance_methods.collect{|x| x.to_s}.sort.should(include("_remove_all_attributes"))
|
1696
|
+
p = @c2.load(:id=>10)
|
1697
|
+
def p._remove_all_attributes
|
1698
|
+
@x = :foo
|
1699
|
+
end
|
1700
|
+
p.remove_all_attributes
|
1701
|
+
p.instance_variable_get(:@x).should == :foo
|
1702
|
+
MODEL_DB.sqls.should == []
|
1703
|
+
end
|
1704
|
+
|
1588
1705
|
it "should support (before|after)_(add|remove) callbacks" do
|
1589
1706
|
h = []
|
1590
1707
|
@c2.many_to_many :attributes, :class => @c1, :before_add=>[proc{|x,y| h << x.pk; h << -y.pk}, :blah], :after_add=>proc{h << 3}, :before_remove=>:blah, :after_remove=>[:blahr]
|
data/spec/model/hooks_spec.rb
CHANGED
@@ -66,17 +66,18 @@ describe "Model#before_update && Model#after_update" do
|
|
66
66
|
|
67
67
|
@c = Class.new(Sequel::Model(:items))
|
68
68
|
@c.class_eval do
|
69
|
+
columns :id, :x
|
69
70
|
def after_update; MODEL_DB << "BLAH after" end
|
70
71
|
end
|
71
72
|
end
|
72
73
|
|
73
74
|
specify "should be called around record update" do
|
74
75
|
@c.send(:define_method, :before_update){MODEL_DB << "BLAH before"}
|
75
|
-
m = @c.load(:id => 2233)
|
76
|
+
m = @c.load(:id => 2233, :x=>123)
|
76
77
|
m.save
|
77
78
|
MODEL_DB.sqls.should == [
|
78
79
|
'BLAH before',
|
79
|
-
'UPDATE items SET
|
80
|
+
'UPDATE items SET x = 123 WHERE (id = 2233)',
|
80
81
|
'BLAH after'
|
81
82
|
]
|
82
83
|
end
|
@@ -109,11 +110,11 @@ describe "Model#before_save && Model#after_save" do
|
|
109
110
|
|
110
111
|
specify "should be called around record update" do
|
111
112
|
@c.send(:define_method, :before_save){MODEL_DB << "BLAH before"}
|
112
|
-
m = @c.load(:id => 2233)
|
113
|
+
m = @c.load(:id => 2233, :x=>123)
|
113
114
|
m.save
|
114
115
|
MODEL_DB.sqls.should == [
|
115
116
|
'BLAH before',
|
116
|
-
'UPDATE items SET
|
117
|
+
'UPDATE items SET x = 123 WHERE (id = 2233)',
|
117
118
|
'BLAH after'
|
118
119
|
]
|
119
120
|
end
|
@@ -212,9 +213,9 @@ describe "Model#before_validation && Model#after_validation" do
|
|
212
213
|
|
213
214
|
specify "should be called when calling save" do
|
214
215
|
@c.send(:define_method, :before_validation){MODEL_DB << "BLAH before"}
|
215
|
-
m = @c.load(:id => 2233)
|
216
|
+
m = @c.load(:id => 2233, :x=>123)
|
216
217
|
m.save.should == m
|
217
|
-
MODEL_DB.sqls.should == ['BLAH before', 'BLAH after', 'UPDATE items SET
|
218
|
+
MODEL_DB.sqls.should == ['BLAH before', 'BLAH after', 'UPDATE items SET x = 123 WHERE (id = 2233)']
|
218
219
|
|
219
220
|
MODEL_DB.sqls.clear
|
220
221
|
m = @c.load(:id => 22)
|
data/spec/model/model_spec.rb
CHANGED
@@ -64,6 +64,16 @@ describe Sequel::Model, "dataset & schema" do
|
|
64
64
|
ds.should respond_to(:destroy)
|
65
65
|
end
|
66
66
|
|
67
|
+
it "should raise an error on set_dataset if there is an error connecting to the database" do
|
68
|
+
@model.meta_def(:columns){raise Sequel::DatabaseConnectionError}
|
69
|
+
proc{@model.set_dataset(MODEL_DB[:foo].join(:blah))}.should raise_error
|
70
|
+
end
|
71
|
+
|
72
|
+
it "should not raise an error if there is a problem getting the columns for a dataset" do
|
73
|
+
@model.meta_def(:columns){raise Sequel::Error}
|
74
|
+
proc{@model.set_dataset(MODEL_DB[:foo].join(:blah))}.should_not raise_error
|
75
|
+
end
|
76
|
+
|
67
77
|
it "doesn't raise an error on set_dataset if there is an error raised getting the schema" do
|
68
78
|
@model.meta_def(:get_db_schema){raise Sequel::Error}
|
69
79
|
proc{@model.set_dataset(MODEL_DB[:foo])}.should_not raise_error
|
@@ -449,25 +459,65 @@ context "Model.db_schema" do
|
|
449
459
|
@c.db_schema.should == {:x=>{:type=>:integer}, :z=>{}}
|
450
460
|
end
|
451
461
|
|
452
|
-
specify "should not use
|
462
|
+
specify "should not use schema if the dataset uses multiple tables or custom sql" do
|
453
463
|
ds = @dataset.join(:x, :id)
|
454
464
|
d = ds.db
|
455
465
|
e = false
|
456
|
-
d.meta_def(:schema){|table| e = true}
|
466
|
+
d.meta_def(:schema){|table, *opts| e = true}
|
457
467
|
def @c.columns; [:x]; end
|
458
468
|
@c.dataset = ds
|
459
469
|
@c.db_schema.should == {:x=>{}}
|
460
470
|
e.should == false
|
461
471
|
end
|
462
472
|
|
463
|
-
specify "should fallback to fetching records if
|
473
|
+
specify "should fallback to fetching records if schema raises an error" do
|
464
474
|
ds = @dataset.join(:x, :id)
|
465
475
|
d = ds.db
|
466
|
-
def d.schema(table)
|
476
|
+
def d.schema(table, opts={})
|
467
477
|
raise StandardError
|
468
478
|
end
|
469
479
|
def @c.columns; [:x]; end
|
470
480
|
@c.dataset = ds
|
471
481
|
@c.db_schema.should == {:x=>{}}
|
472
482
|
end
|
483
|
+
|
484
|
+
specify "should automatically set a singular primary key based on the schema" do
|
485
|
+
ds = @dataset
|
486
|
+
d = ds.db
|
487
|
+
d.meta_def(:schema){|table, *opts| [[:x, {:primary_key=>true}]]}
|
488
|
+
@c.primary_key.should == :id
|
489
|
+
@c.dataset = ds
|
490
|
+
@c.db_schema.should == {:x=>{:primary_key=>true}}
|
491
|
+
@c.primary_key.should == :x
|
492
|
+
end
|
493
|
+
|
494
|
+
specify "should automatically set the composite primary key based on the schema" do
|
495
|
+
ds = @dataset
|
496
|
+
d = ds.db
|
497
|
+
d.meta_def(:schema){|table, *opts| [[:x, {:primary_key=>true}], [:y, {:primary_key=>true}]]}
|
498
|
+
@c.primary_key.should == :id
|
499
|
+
@c.dataset = ds
|
500
|
+
@c.db_schema.should == {:x=>{:primary_key=>true}, :y=>{:primary_key=>true}}
|
501
|
+
@c.primary_key.should == [:x, :y]
|
502
|
+
end
|
503
|
+
|
504
|
+
specify "should automatically set no primary key based on the schema" do
|
505
|
+
ds = @dataset
|
506
|
+
d = ds.db
|
507
|
+
d.meta_def(:schema){|table, *opts| [[:x, {:primary_key=>false}], [:y, {:primary_key=>false}]]}
|
508
|
+
@c.primary_key.should == :id
|
509
|
+
@c.dataset = ds
|
510
|
+
@c.db_schema.should == {:x=>{:primary_key=>false}, :y=>{:primary_key=>false}}
|
511
|
+
@c.primary_key.should == nil
|
512
|
+
end
|
513
|
+
|
514
|
+
specify "should not modify the primary key unless all column schema hashes have a :primary_key entry" do
|
515
|
+
ds = @dataset
|
516
|
+
d = ds.db
|
517
|
+
d.meta_def(:schema){|table, *opts| [[:x, {:primary_key=>false}], [:y, {}]]}
|
518
|
+
@c.primary_key.should == :id
|
519
|
+
@c.dataset = ds
|
520
|
+
@c.db_schema.should == {:x=>{:primary_key=>false}, :y=>{}}
|
521
|
+
@c.primary_key.should == :id
|
522
|
+
end
|
473
523
|
end
|
data/spec/model/record_spec.rb
CHANGED
@@ -94,8 +94,7 @@ describe "Model#save" do
|
|
94
94
|
it "should update a record for an existing model instance" do
|
95
95
|
o = @c.load(:id => 3, :x => 1)
|
96
96
|
o.save
|
97
|
-
MODEL_DB.sqls.
|
98
|
-
MODEL_DB.sqls.first.should =~ /UPDATE items SET (id = 3, x = 1|x = 1, id = 3) WHERE \(id = 3\)/
|
97
|
+
MODEL_DB.sqls.should == ["UPDATE items SET x = 1 WHERE (id = 3)"]
|
99
98
|
end
|
100
99
|
|
101
100
|
it "should update only the given columns if given" do
|
@@ -128,7 +127,7 @@ describe "Model#save" do
|
|
128
127
|
o = @c.load(:id => 23,:x => 1, :y => nil)
|
129
128
|
o[:x] = 2
|
130
129
|
o.save
|
131
|
-
res.should == [{:
|
130
|
+
res.should == [{:x => 2, :y => nil}, nil]
|
132
131
|
o.after_save
|
133
132
|
res.should == [nil, nil]
|
134
133
|
|
@@ -109,13 +109,13 @@ end
|
|
109
109
|
describe "Model#save" do
|
110
110
|
before do
|
111
111
|
@c = Class.new(Sequel::Model(:people)) do
|
112
|
-
columns :id
|
112
|
+
columns :id, :x
|
113
113
|
|
114
114
|
def validate
|
115
115
|
errors[:id] << 'blah' unless id == 5
|
116
116
|
end
|
117
117
|
end
|
118
|
-
@m = @c.load(:id => 4)
|
118
|
+
@m = @c.load(:id => 4, :x=>6)
|
119
119
|
MODEL_DB.reset
|
120
120
|
end
|
121
121
|
|
@@ -128,14 +128,14 @@ describe "Model#save" do
|
|
128
128
|
@m.id = 5
|
129
129
|
@m.should be_valid
|
130
130
|
@m.save.should_not be_false
|
131
|
-
MODEL_DB.sqls.should == ['UPDATE people SET
|
131
|
+
MODEL_DB.sqls.should == ['UPDATE people SET x = 6 WHERE (id = 5)']
|
132
132
|
end
|
133
133
|
|
134
134
|
specify "should skip validations if the :validate=>false option is used" do
|
135
135
|
@m.raise_on_save_failure = false
|
136
136
|
@m.should_not be_valid
|
137
137
|
@m.save(:validate=>false)
|
138
|
-
MODEL_DB.sqls.should == ['UPDATE people SET
|
138
|
+
MODEL_DB.sqls.should == ['UPDATE people SET x = 6 WHERE (id = 4)']
|
139
139
|
end
|
140
140
|
|
141
141
|
specify "should raise error if validations fail and raise_on_save_faiure is true" do
|
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.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Evans
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-08-03 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -26,33 +26,34 @@ extra_rdoc_files:
|
|
26
26
|
- doc/advanced_associations.rdoc
|
27
27
|
- doc/cheat_sheet.rdoc
|
28
28
|
- doc/dataset_filtering.rdoc
|
29
|
+
- doc/opening_databases.rdoc
|
29
30
|
- doc/prepared_statements.rdoc
|
31
|
+
- doc/reflection.rdoc
|
30
32
|
- doc/schema.rdoc
|
31
33
|
- doc/sharding.rdoc
|
32
34
|
- doc/virtual_rows.rdoc
|
33
|
-
- doc/
|
34
|
-
- doc/opening_databases.rdoc
|
35
|
-
- doc/release_notes/2.10.0.txt
|
36
|
-
- doc/release_notes/2.9.0.txt
|
37
|
-
- doc/release_notes/2.8.0.txt
|
38
|
-
- doc/release_notes/2.7.0.txt
|
39
|
-
- doc/release_notes/2.6.0.txt
|
40
|
-
- doc/release_notes/2.5.0.txt
|
41
|
-
- doc/release_notes/2.4.0.txt
|
42
|
-
- doc/release_notes/2.3.0.txt
|
43
|
-
- doc/release_notes/2.2.0.txt
|
44
|
-
- doc/release_notes/2.1.0.txt
|
45
|
-
- doc/release_notes/2.0.0.txt
|
46
|
-
- doc/release_notes/1.5.0.txt
|
47
|
-
- doc/release_notes/1.4.0.txt
|
35
|
+
- doc/release_notes/1.0.txt
|
48
36
|
- doc/release_notes/1.1.txt
|
49
37
|
- doc/release_notes/1.3.txt
|
50
|
-
- doc/release_notes/1.0.txt
|
38
|
+
- doc/release_notes/1.4.0.txt
|
39
|
+
- doc/release_notes/1.5.0.txt
|
40
|
+
- doc/release_notes/2.0.0.txt
|
41
|
+
- doc/release_notes/2.1.0.txt
|
42
|
+
- doc/release_notes/2.10.0.txt
|
51
43
|
- doc/release_notes/2.11.0.txt
|
52
44
|
- doc/release_notes/2.12.0.txt
|
45
|
+
- doc/release_notes/2.2.0.txt
|
46
|
+
- doc/release_notes/2.3.0.txt
|
47
|
+
- doc/release_notes/2.4.0.txt
|
48
|
+
- doc/release_notes/2.5.0.txt
|
49
|
+
- doc/release_notes/2.6.0.txt
|
50
|
+
- doc/release_notes/2.7.0.txt
|
51
|
+
- doc/release_notes/2.8.0.txt
|
52
|
+
- doc/release_notes/2.9.0.txt
|
53
53
|
- doc/release_notes/3.0.0.txt
|
54
54
|
- doc/release_notes/3.1.0.txt
|
55
55
|
- doc/release_notes/3.2.0.txt
|
56
|
+
- doc/release_notes/3.3.0.txt
|
56
57
|
files:
|
57
58
|
- COPYING
|
58
59
|
- CHANGELOG
|
@@ -62,128 +63,107 @@ files:
|
|
62
63
|
- doc/advanced_associations.rdoc
|
63
64
|
- doc/cheat_sheet.rdoc
|
64
65
|
- doc/dataset_filtering.rdoc
|
66
|
+
- doc/opening_databases.rdoc
|
65
67
|
- doc/prepared_statements.rdoc
|
66
|
-
- doc/
|
67
|
-
- doc/sharding.rdoc
|
68
|
+
- doc/reflection.rdoc
|
68
69
|
- doc/release_notes
|
69
|
-
- doc/release_notes/
|
70
|
-
- doc/release_notes/2.9.0.txt
|
71
|
-
- doc/release_notes/2.8.0.txt
|
72
|
-
- doc/release_notes/2.7.0.txt
|
73
|
-
- doc/release_notes/2.6.0.txt
|
74
|
-
- doc/release_notes/2.5.0.txt
|
75
|
-
- doc/release_notes/2.4.0.txt
|
76
|
-
- doc/release_notes/2.3.0.txt
|
77
|
-
- doc/release_notes/2.2.0.txt
|
78
|
-
- doc/release_notes/2.1.0.txt
|
79
|
-
- doc/release_notes/2.0.0.txt
|
80
|
-
- doc/release_notes/1.5.0.txt
|
81
|
-
- doc/release_notes/1.4.0.txt
|
70
|
+
- doc/release_notes/1.0.txt
|
82
71
|
- doc/release_notes/1.1.txt
|
83
72
|
- doc/release_notes/1.3.txt
|
84
|
-
- doc/release_notes/1.0.txt
|
73
|
+
- doc/release_notes/1.4.0.txt
|
74
|
+
- doc/release_notes/1.5.0.txt
|
75
|
+
- doc/release_notes/2.0.0.txt
|
76
|
+
- doc/release_notes/2.1.0.txt
|
77
|
+
- doc/release_notes/2.10.0.txt
|
85
78
|
- doc/release_notes/2.11.0.txt
|
86
79
|
- doc/release_notes/2.12.0.txt
|
80
|
+
- doc/release_notes/2.2.0.txt
|
81
|
+
- doc/release_notes/2.3.0.txt
|
82
|
+
- doc/release_notes/2.4.0.txt
|
83
|
+
- doc/release_notes/2.5.0.txt
|
84
|
+
- doc/release_notes/2.6.0.txt
|
85
|
+
- doc/release_notes/2.7.0.txt
|
86
|
+
- doc/release_notes/2.8.0.txt
|
87
|
+
- doc/release_notes/2.9.0.txt
|
87
88
|
- doc/release_notes/3.0.0.txt
|
88
89
|
- doc/release_notes/3.1.0.txt
|
89
90
|
- doc/release_notes/3.2.0.txt
|
91
|
+
- doc/release_notes/3.3.0.txt
|
92
|
+
- doc/schema.rdoc
|
93
|
+
- doc/sharding.rdoc
|
90
94
|
- doc/virtual_rows.rdoc
|
91
|
-
- doc/reflection.rdoc
|
92
|
-
- doc/opening_databases.rdoc
|
93
95
|
- spec/adapters
|
94
|
-
- spec/adapters/
|
96
|
+
- spec/adapters/firebird_spec.rb
|
95
97
|
- spec/adapters/informix_spec.rb
|
96
98
|
- spec/adapters/mysql_spec.rb
|
97
99
|
- spec/adapters/oracle_spec.rb
|
98
100
|
- spec/adapters/postgres_spec.rb
|
99
101
|
- spec/adapters/spec_helper.rb
|
100
102
|
- spec/adapters/sqlite_spec.rb
|
101
|
-
- spec/adapters/firebird_spec.rb
|
102
|
-
- spec/integration
|
103
|
-
- spec/integration/dataset_test.rb
|
104
|
-
- spec/integration/eager_loader_test.rb
|
105
|
-
- spec/integration/prepared_statement_test.rb
|
106
|
-
- spec/integration/schema_test.rb
|
107
|
-
- spec/integration/spec_helper.rb
|
108
|
-
- spec/integration/type_test.rb
|
109
|
-
- spec/integration/transaction_test.rb
|
110
|
-
- spec/integration/database_test.rb
|
111
|
-
- spec/rcov.opts
|
112
103
|
- spec/core
|
113
104
|
- spec/core/connection_pool_spec.rb
|
114
|
-
- spec/core/database_spec.rb
|
115
105
|
- spec/core/core_sql_spec.rb
|
106
|
+
- spec/core/database_spec.rb
|
116
107
|
- spec/core/dataset_spec.rb
|
117
108
|
- spec/core/expression_filters_spec.rb
|
118
|
-
- spec/core/schema_spec.rb
|
119
109
|
- spec/core/object_graph_spec.rb
|
120
110
|
- spec/core/schema_generator_spec.rb
|
111
|
+
- spec/core/schema_spec.rb
|
121
112
|
- spec/core/spec_helper.rb
|
122
113
|
- spec/core/version_spec.rb
|
114
|
+
- spec/extensions
|
115
|
+
- spec/extensions/blank_spec.rb
|
116
|
+
- spec/extensions/caching_spec.rb
|
117
|
+
- spec/extensions/hook_class_methods_spec.rb
|
118
|
+
- spec/extensions/identity_map_spec.rb
|
119
|
+
- spec/extensions/inflector_spec.rb
|
120
|
+
- spec/extensions/lazy_attributes_spec.rb
|
121
|
+
- spec/extensions/many_through_many_spec.rb
|
122
|
+
- spec/extensions/migration_spec.rb
|
123
|
+
- spec/extensions/pagination_spec.rb
|
124
|
+
- spec/extensions/pretty_table_spec.rb
|
125
|
+
- spec/extensions/query_spec.rb
|
126
|
+
- spec/extensions/schema_dumper_spec.rb
|
127
|
+
- spec/extensions/schema_spec.rb
|
128
|
+
- spec/extensions/serialization_spec.rb
|
129
|
+
- spec/extensions/single_table_inheritance_spec.rb
|
130
|
+
- spec/extensions/spec_helper.rb
|
131
|
+
- spec/extensions/string_date_time_spec.rb
|
132
|
+
- spec/extensions/tactical_eager_loading_spec.rb
|
133
|
+
- spec/extensions/validation_class_methods_spec.rb
|
134
|
+
- spec/extensions/validation_helpers_spec.rb
|
135
|
+
- spec/extensions/association_proxies_spec.rb
|
136
|
+
- spec/integration
|
137
|
+
- spec/integration/database_test.rb
|
138
|
+
- spec/integration/dataset_test.rb
|
139
|
+
- spec/integration/eager_loader_test.rb
|
140
|
+
- spec/integration/prepared_statement_test.rb
|
141
|
+
- spec/integration/schema_test.rb
|
142
|
+
- spec/integration/spec_helper.rb
|
143
|
+
- spec/integration/transaction_test.rb
|
144
|
+
- spec/integration/type_test.rb
|
123
145
|
- spec/model
|
124
146
|
- spec/model/association_reflection_spec.rb
|
125
147
|
- spec/model/associations_spec.rb
|
126
148
|
- spec/model/base_spec.rb
|
127
|
-
- spec/model/plugins_spec.rb
|
128
149
|
- spec/model/dataset_methods_spec.rb
|
129
150
|
- spec/model/eager_loading_spec.rb
|
130
151
|
- spec/model/hooks_spec.rb
|
131
152
|
- spec/model/inflector_spec.rb
|
132
153
|
- spec/model/model_spec.rb
|
154
|
+
- spec/model/plugins_spec.rb
|
133
155
|
- spec/model/record_spec.rb
|
134
156
|
- spec/model/spec_helper.rb
|
135
157
|
- spec/model/validations_spec.rb
|
158
|
+
- spec/rcov.opts
|
136
159
|
- spec/spec.opts
|
137
|
-
- spec/spec_config.rb.example
|
138
160
|
- spec/spec_config.rb
|
139
|
-
- spec/
|
140
|
-
- spec/extensions/spec_helper.rb
|
141
|
-
- spec/extensions/caching_spec.rb
|
142
|
-
- spec/extensions/schema_spec.rb
|
143
|
-
- spec/extensions/inflector_spec.rb
|
144
|
-
- spec/extensions/hook_class_methods_spec.rb
|
145
|
-
- spec/extensions/string_date_time_spec.rb
|
146
|
-
- spec/extensions/single_table_inheritance_spec.rb
|
147
|
-
- spec/extensions/validation_class_methods_spec.rb
|
148
|
-
- spec/extensions/query_spec.rb
|
149
|
-
- spec/extensions/pagination_spec.rb
|
150
|
-
- spec/extensions/pretty_table_spec.rb
|
151
|
-
- spec/extensions/blank_spec.rb
|
152
|
-
- spec/extensions/migration_spec.rb
|
153
|
-
- spec/extensions/serialization_spec.rb
|
154
|
-
- spec/extensions/validation_helpers_spec.rb
|
155
|
-
- spec/extensions/schema_dumper_spec.rb
|
156
|
-
- spec/extensions/identity_map_spec.rb
|
157
|
-
- spec/extensions/tactical_eager_loading_spec.rb
|
158
|
-
- spec/extensions/lazy_attributes_spec.rb
|
159
|
-
- spec/extensions/many_through_many_spec.rb
|
161
|
+
- spec/spec_config.rb.example
|
160
162
|
- lib/sequel.rb
|
161
|
-
- lib/sequel_core.rb
|
162
|
-
- lib/sequel_model.rb
|
163
163
|
- lib/sequel
|
164
|
-
- lib/sequel/plugins
|
165
|
-
- lib/sequel/plugins/hook_class_methods.rb
|
166
|
-
- lib/sequel/plugins/single_table_inheritance.rb
|
167
|
-
- lib/sequel/plugins/caching.rb
|
168
|
-
- lib/sequel/plugins/schema.rb
|
169
|
-
- lib/sequel/plugins/validation_class_methods.rb
|
170
|
-
- lib/sequel/plugins/serialization.rb
|
171
|
-
- lib/sequel/plugins/validation_helpers.rb
|
172
|
-
- lib/sequel/plugins/identity_map.rb
|
173
|
-
- lib/sequel/plugins/tactical_eager_loading.rb
|
174
|
-
- lib/sequel/plugins/lazy_attributes.rb
|
175
|
-
- lib/sequel/plugins/many_through_many.rb
|
176
|
-
- lib/sequel/extensions
|
177
|
-
- lib/sequel/extensions/string_date_time.rb
|
178
|
-
- lib/sequel/extensions/inflector.rb
|
179
|
-
- lib/sequel/extensions/pagination.rb
|
180
|
-
- lib/sequel/extensions/query.rb
|
181
|
-
- lib/sequel/extensions/pretty_table.rb
|
182
|
-
- lib/sequel/extensions/blank.rb
|
183
|
-
- lib/sequel/extensions/migration.rb
|
184
|
-
- lib/sequel/extensions/schema_dumper.rb
|
185
164
|
- lib/sequel/adapters
|
186
165
|
- lib/sequel/adapters/ado.rb
|
166
|
+
- lib/sequel/adapters/amalgalite.rb
|
187
167
|
- lib/sequel/adapters/db2.rb
|
188
168
|
- lib/sequel/adapters/dbi.rb
|
189
169
|
- lib/sequel/adapters/do.rb
|
@@ -200,6 +180,7 @@ files:
|
|
200
180
|
- lib/sequel/adapters/jdbc/oracle.rb
|
201
181
|
- lib/sequel/adapters/jdbc/postgresql.rb
|
202
182
|
- lib/sequel/adapters/jdbc/sqlite.rb
|
183
|
+
- lib/sequel/adapters/jdbc/mssql.rb
|
203
184
|
- lib/sequel/adapters/mysql.rb
|
204
185
|
- lib/sequel/adapters/odbc.rb
|
205
186
|
- lib/sequel/adapters/openbase.rb
|
@@ -215,7 +196,10 @@ files:
|
|
215
196
|
- lib/sequel/adapters/sqlite.rb
|
216
197
|
- lib/sequel/adapters/utils
|
217
198
|
- lib/sequel/adapters/utils/stored_procedures.rb
|
218
|
-
- lib/sequel/adapters/
|
199
|
+
- lib/sequel/adapters/ado
|
200
|
+
- lib/sequel/adapters/ado/mssql.rb
|
201
|
+
- lib/sequel/adapters/odbc
|
202
|
+
- lib/sequel/adapters/odbc/mssql.rb
|
219
203
|
- lib/sequel/connection_pool.rb
|
220
204
|
- lib/sequel/core.rb
|
221
205
|
- lib/sequel/core_sql.rb
|
@@ -227,21 +211,45 @@ files:
|
|
227
211
|
- lib/sequel/dataset.rb
|
228
212
|
- lib/sequel/dataset
|
229
213
|
- lib/sequel/dataset/convenience.rb
|
214
|
+
- lib/sequel/dataset/graph.rb
|
230
215
|
- lib/sequel/dataset/prepared_statements.rb
|
231
216
|
- lib/sequel/dataset/sql.rb
|
232
|
-
- lib/sequel/dataset/graph.rb
|
233
|
-
- lib/sequel/model.rb
|
234
217
|
- lib/sequel/exceptions.rb
|
218
|
+
- lib/sequel/extensions
|
219
|
+
- lib/sequel/extensions/blank.rb
|
220
|
+
- lib/sequel/extensions/inflector.rb
|
221
|
+
- lib/sequel/extensions/migration.rb
|
222
|
+
- lib/sequel/extensions/pagination.rb
|
223
|
+
- lib/sequel/extensions/pretty_table.rb
|
224
|
+
- lib/sequel/extensions/query.rb
|
225
|
+
- lib/sequel/extensions/schema_dumper.rb
|
226
|
+
- lib/sequel/extensions/string_date_time.rb
|
235
227
|
- lib/sequel/metaprogramming.rb
|
236
|
-
- lib/sequel/
|
228
|
+
- lib/sequel/model.rb
|
237
229
|
- lib/sequel/model
|
238
230
|
- lib/sequel/model/associations.rb
|
239
231
|
- lib/sequel/model/base.rb
|
240
|
-
- lib/sequel/model/plugins.rb
|
241
232
|
- lib/sequel/model/errors.rb
|
242
233
|
- lib/sequel/model/exceptions.rb
|
243
234
|
- lib/sequel/model/inflections.rb
|
235
|
+
- lib/sequel/model/plugins.rb
|
236
|
+
- lib/sequel/plugins
|
237
|
+
- lib/sequel/plugins/caching.rb
|
238
|
+
- lib/sequel/plugins/hook_class_methods.rb
|
239
|
+
- lib/sequel/plugins/identity_map.rb
|
240
|
+
- lib/sequel/plugins/lazy_attributes.rb
|
241
|
+
- lib/sequel/plugins/many_through_many.rb
|
242
|
+
- lib/sequel/plugins/schema.rb
|
243
|
+
- lib/sequel/plugins/serialization.rb
|
244
|
+
- lib/sequel/plugins/single_table_inheritance.rb
|
245
|
+
- lib/sequel/plugins/tactical_eager_loading.rb
|
246
|
+
- lib/sequel/plugins/validation_class_methods.rb
|
247
|
+
- lib/sequel/plugins/validation_helpers.rb
|
248
|
+
- lib/sequel/plugins/association_proxies.rb
|
249
|
+
- lib/sequel/sql.rb
|
244
250
|
- lib/sequel/version.rb
|
251
|
+
- lib/sequel_core.rb
|
252
|
+
- lib/sequel_model.rb
|
245
253
|
has_rdoc: true
|
246
254
|
homepage: http://sequel.rubyforge.org
|
247
255
|
post_install_message:
|