viking-sequel 3.10.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +3134 -0
- data/COPYING +19 -0
- data/README.rdoc +723 -0
- data/Rakefile +193 -0
- data/bin/sequel +196 -0
- data/doc/advanced_associations.rdoc +644 -0
- data/doc/cheat_sheet.rdoc +218 -0
- data/doc/dataset_basics.rdoc +106 -0
- data/doc/dataset_filtering.rdoc +158 -0
- data/doc/opening_databases.rdoc +296 -0
- data/doc/prepared_statements.rdoc +104 -0
- data/doc/reflection.rdoc +84 -0
- data/doc/release_notes/1.0.txt +38 -0
- data/doc/release_notes/1.1.txt +143 -0
- data/doc/release_notes/1.3.txt +101 -0
- data/doc/release_notes/1.4.0.txt +53 -0
- data/doc/release_notes/1.5.0.txt +155 -0
- data/doc/release_notes/2.0.0.txt +298 -0
- data/doc/release_notes/2.1.0.txt +271 -0
- data/doc/release_notes/2.10.0.txt +328 -0
- data/doc/release_notes/2.11.0.txt +215 -0
- data/doc/release_notes/2.12.0.txt +534 -0
- data/doc/release_notes/2.2.0.txt +253 -0
- data/doc/release_notes/2.3.0.txt +88 -0
- data/doc/release_notes/2.4.0.txt +106 -0
- data/doc/release_notes/2.5.0.txt +137 -0
- data/doc/release_notes/2.6.0.txt +157 -0
- data/doc/release_notes/2.7.0.txt +166 -0
- data/doc/release_notes/2.8.0.txt +171 -0
- data/doc/release_notes/2.9.0.txt +97 -0
- data/doc/release_notes/3.0.0.txt +221 -0
- data/doc/release_notes/3.1.0.txt +406 -0
- data/doc/release_notes/3.10.0.txt +286 -0
- data/doc/release_notes/3.2.0.txt +268 -0
- data/doc/release_notes/3.3.0.txt +192 -0
- data/doc/release_notes/3.4.0.txt +325 -0
- data/doc/release_notes/3.5.0.txt +510 -0
- data/doc/release_notes/3.6.0.txt +366 -0
- data/doc/release_notes/3.7.0.txt +179 -0
- data/doc/release_notes/3.8.0.txt +151 -0
- data/doc/release_notes/3.9.0.txt +233 -0
- data/doc/schema.rdoc +36 -0
- data/doc/sharding.rdoc +113 -0
- data/doc/virtual_rows.rdoc +205 -0
- data/lib/sequel.rb +1 -0
- data/lib/sequel/adapters/ado.rb +90 -0
- data/lib/sequel/adapters/ado/mssql.rb +30 -0
- data/lib/sequel/adapters/amalgalite.rb +176 -0
- data/lib/sequel/adapters/db2.rb +139 -0
- data/lib/sequel/adapters/dbi.rb +113 -0
- data/lib/sequel/adapters/do.rb +188 -0
- data/lib/sequel/adapters/do/mysql.rb +49 -0
- data/lib/sequel/adapters/do/postgres.rb +91 -0
- data/lib/sequel/adapters/do/sqlite.rb +40 -0
- data/lib/sequel/adapters/firebird.rb +283 -0
- data/lib/sequel/adapters/informix.rb +77 -0
- data/lib/sequel/adapters/jdbc.rb +587 -0
- data/lib/sequel/adapters/jdbc/as400.rb +58 -0
- data/lib/sequel/adapters/jdbc/h2.rb +133 -0
- data/lib/sequel/adapters/jdbc/mssql.rb +57 -0
- data/lib/sequel/adapters/jdbc/mysql.rb +78 -0
- data/lib/sequel/adapters/jdbc/oracle.rb +50 -0
- data/lib/sequel/adapters/jdbc/postgresql.rb +108 -0
- data/lib/sequel/adapters/jdbc/sqlite.rb +55 -0
- data/lib/sequel/adapters/mysql.rb +421 -0
- data/lib/sequel/adapters/odbc.rb +143 -0
- data/lib/sequel/adapters/odbc/mssql.rb +42 -0
- data/lib/sequel/adapters/openbase.rb +64 -0
- data/lib/sequel/adapters/oracle.rb +131 -0
- data/lib/sequel/adapters/postgres.rb +504 -0
- data/lib/sequel/adapters/shared/mssql.rb +490 -0
- data/lib/sequel/adapters/shared/mysql.rb +498 -0
- data/lib/sequel/adapters/shared/oracle.rb +195 -0
- data/lib/sequel/adapters/shared/postgres.rb +830 -0
- data/lib/sequel/adapters/shared/progress.rb +44 -0
- data/lib/sequel/adapters/shared/sqlite.rb +389 -0
- data/lib/sequel/adapters/sqlite.rb +224 -0
- data/lib/sequel/adapters/utils/stored_procedures.rb +84 -0
- data/lib/sequel/connection_pool.rb +99 -0
- data/lib/sequel/connection_pool/sharded_single.rb +84 -0
- data/lib/sequel/connection_pool/sharded_threaded.rb +211 -0
- data/lib/sequel/connection_pool/single.rb +29 -0
- data/lib/sequel/connection_pool/threaded.rb +150 -0
- data/lib/sequel/core.rb +293 -0
- data/lib/sequel/core_sql.rb +241 -0
- data/lib/sequel/database.rb +1079 -0
- data/lib/sequel/database/schema_generator.rb +327 -0
- data/lib/sequel/database/schema_methods.rb +203 -0
- data/lib/sequel/database/schema_sql.rb +320 -0
- data/lib/sequel/dataset.rb +32 -0
- data/lib/sequel/dataset/actions.rb +441 -0
- data/lib/sequel/dataset/features.rb +86 -0
- data/lib/sequel/dataset/graph.rb +254 -0
- data/lib/sequel/dataset/misc.rb +119 -0
- data/lib/sequel/dataset/mutation.rb +64 -0
- data/lib/sequel/dataset/prepared_statements.rb +227 -0
- data/lib/sequel/dataset/query.rb +709 -0
- data/lib/sequel/dataset/sql.rb +996 -0
- data/lib/sequel/exceptions.rb +51 -0
- data/lib/sequel/extensions/blank.rb +43 -0
- data/lib/sequel/extensions/inflector.rb +242 -0
- data/lib/sequel/extensions/looser_typecasting.rb +21 -0
- data/lib/sequel/extensions/migration.rb +239 -0
- data/lib/sequel/extensions/named_timezones.rb +61 -0
- data/lib/sequel/extensions/pagination.rb +100 -0
- data/lib/sequel/extensions/pretty_table.rb +82 -0
- data/lib/sequel/extensions/query.rb +52 -0
- data/lib/sequel/extensions/schema_dumper.rb +271 -0
- data/lib/sequel/extensions/sql_expr.rb +122 -0
- data/lib/sequel/extensions/string_date_time.rb +46 -0
- data/lib/sequel/extensions/thread_local_timezones.rb +48 -0
- data/lib/sequel/metaprogramming.rb +9 -0
- data/lib/sequel/model.rb +120 -0
- data/lib/sequel/model/associations.rb +1514 -0
- data/lib/sequel/model/base.rb +1069 -0
- data/lib/sequel/model/default_inflections.rb +45 -0
- data/lib/sequel/model/errors.rb +39 -0
- data/lib/sequel/model/exceptions.rb +21 -0
- data/lib/sequel/model/inflections.rb +162 -0
- data/lib/sequel/model/plugins.rb +70 -0
- data/lib/sequel/plugins/active_model.rb +59 -0
- data/lib/sequel/plugins/association_dependencies.rb +103 -0
- data/lib/sequel/plugins/association_proxies.rb +41 -0
- data/lib/sequel/plugins/boolean_readers.rb +53 -0
- data/lib/sequel/plugins/caching.rb +141 -0
- data/lib/sequel/plugins/class_table_inheritance.rb +214 -0
- data/lib/sequel/plugins/composition.rb +138 -0
- data/lib/sequel/plugins/force_encoding.rb +72 -0
- data/lib/sequel/plugins/hook_class_methods.rb +126 -0
- data/lib/sequel/plugins/identity_map.rb +116 -0
- data/lib/sequel/plugins/instance_filters.rb +98 -0
- data/lib/sequel/plugins/instance_hooks.rb +57 -0
- data/lib/sequel/plugins/lazy_attributes.rb +77 -0
- data/lib/sequel/plugins/many_through_many.rb +208 -0
- data/lib/sequel/plugins/nested_attributes.rb +206 -0
- data/lib/sequel/plugins/optimistic_locking.rb +81 -0
- data/lib/sequel/plugins/rcte_tree.rb +281 -0
- data/lib/sequel/plugins/schema.rb +66 -0
- data/lib/sequel/plugins/serialization.rb +166 -0
- data/lib/sequel/plugins/single_table_inheritance.rb +74 -0
- data/lib/sequel/plugins/subclasses.rb +45 -0
- data/lib/sequel/plugins/tactical_eager_loading.rb +61 -0
- data/lib/sequel/plugins/timestamps.rb +87 -0
- data/lib/sequel/plugins/touch.rb +118 -0
- data/lib/sequel/plugins/typecast_on_load.rb +72 -0
- data/lib/sequel/plugins/validation_class_methods.rb +405 -0
- data/lib/sequel/plugins/validation_helpers.rb +223 -0
- data/lib/sequel/sql.rb +1020 -0
- data/lib/sequel/timezones.rb +161 -0
- data/lib/sequel/version.rb +12 -0
- data/lib/sequel_core.rb +1 -0
- data/lib/sequel_model.rb +1 -0
- data/spec/adapters/firebird_spec.rb +407 -0
- data/spec/adapters/informix_spec.rb +97 -0
- data/spec/adapters/mssql_spec.rb +403 -0
- data/spec/adapters/mysql_spec.rb +1019 -0
- data/spec/adapters/oracle_spec.rb +286 -0
- data/spec/adapters/postgres_spec.rb +969 -0
- data/spec/adapters/spec_helper.rb +51 -0
- data/spec/adapters/sqlite_spec.rb +432 -0
- data/spec/core/connection_pool_spec.rb +808 -0
- data/spec/core/core_sql_spec.rb +417 -0
- data/spec/core/database_spec.rb +1662 -0
- data/spec/core/dataset_spec.rb +3827 -0
- data/spec/core/expression_filters_spec.rb +595 -0
- data/spec/core/object_graph_spec.rb +296 -0
- data/spec/core/schema_generator_spec.rb +159 -0
- data/spec/core/schema_spec.rb +830 -0
- data/spec/core/spec_helper.rb +56 -0
- data/spec/core/version_spec.rb +7 -0
- data/spec/extensions/active_model_spec.rb +76 -0
- data/spec/extensions/association_dependencies_spec.rb +127 -0
- data/spec/extensions/association_proxies_spec.rb +50 -0
- data/spec/extensions/blank_spec.rb +67 -0
- data/spec/extensions/boolean_readers_spec.rb +92 -0
- data/spec/extensions/caching_spec.rb +250 -0
- data/spec/extensions/class_table_inheritance_spec.rb +252 -0
- data/spec/extensions/composition_spec.rb +194 -0
- data/spec/extensions/force_encoding_spec.rb +117 -0
- data/spec/extensions/hook_class_methods_spec.rb +470 -0
- data/spec/extensions/identity_map_spec.rb +202 -0
- data/spec/extensions/inflector_spec.rb +181 -0
- data/spec/extensions/instance_filters_spec.rb +55 -0
- data/spec/extensions/instance_hooks_spec.rb +133 -0
- data/spec/extensions/lazy_attributes_spec.rb +153 -0
- data/spec/extensions/looser_typecasting_spec.rb +39 -0
- data/spec/extensions/many_through_many_spec.rb +884 -0
- data/spec/extensions/migration_spec.rb +332 -0
- data/spec/extensions/named_timezones_spec.rb +72 -0
- data/spec/extensions/nested_attributes_spec.rb +396 -0
- data/spec/extensions/optimistic_locking_spec.rb +100 -0
- data/spec/extensions/pagination_spec.rb +99 -0
- data/spec/extensions/pretty_table_spec.rb +91 -0
- data/spec/extensions/query_spec.rb +85 -0
- data/spec/extensions/rcte_tree_spec.rb +205 -0
- data/spec/extensions/schema_dumper_spec.rb +357 -0
- data/spec/extensions/schema_spec.rb +127 -0
- data/spec/extensions/serialization_spec.rb +209 -0
- data/spec/extensions/single_table_inheritance_spec.rb +96 -0
- data/spec/extensions/spec_helper.rb +91 -0
- data/spec/extensions/sql_expr_spec.rb +89 -0
- data/spec/extensions/string_date_time_spec.rb +93 -0
- data/spec/extensions/subclasses_spec.rb +52 -0
- data/spec/extensions/tactical_eager_loading_spec.rb +65 -0
- data/spec/extensions/thread_local_timezones_spec.rb +45 -0
- data/spec/extensions/timestamps_spec.rb +150 -0
- data/spec/extensions/touch_spec.rb +155 -0
- data/spec/extensions/typecast_on_load_spec.rb +69 -0
- data/spec/extensions/validation_class_methods_spec.rb +984 -0
- data/spec/extensions/validation_helpers_spec.rb +438 -0
- data/spec/integration/associations_test.rb +281 -0
- data/spec/integration/database_test.rb +26 -0
- data/spec/integration/dataset_test.rb +963 -0
- data/spec/integration/eager_loader_test.rb +734 -0
- data/spec/integration/model_test.rb +130 -0
- data/spec/integration/plugin_test.rb +814 -0
- data/spec/integration/prepared_statement_test.rb +213 -0
- data/spec/integration/schema_test.rb +361 -0
- data/spec/integration/spec_helper.rb +73 -0
- data/spec/integration/timezone_test.rb +55 -0
- data/spec/integration/transaction_test.rb +122 -0
- data/spec/integration/type_test.rb +96 -0
- data/spec/model/association_reflection_spec.rb +175 -0
- data/spec/model/associations_spec.rb +2633 -0
- data/spec/model/base_spec.rb +418 -0
- data/spec/model/dataset_methods_spec.rb +78 -0
- data/spec/model/eager_loading_spec.rb +1391 -0
- data/spec/model/hooks_spec.rb +240 -0
- data/spec/model/inflector_spec.rb +26 -0
- data/spec/model/model_spec.rb +593 -0
- data/spec/model/plugins_spec.rb +236 -0
- data/spec/model/record_spec.rb +1500 -0
- data/spec/model/spec_helper.rb +97 -0
- data/spec/model/validations_spec.rb +153 -0
- data/spec/rcov.opts +6 -0
- data/spec/spec_config.rb.example +10 -0
- metadata +346 -0
@@ -0,0 +1,97 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
unless Object.const_defined?('Sequel')
|
3
|
+
$:.unshift(File.join(File.dirname(__FILE__), "../../lib/"))
|
4
|
+
require 'sequel/core'
|
5
|
+
end
|
6
|
+
unless Sequel.const_defined?('Model')
|
7
|
+
$:.unshift(File.join(File.dirname(__FILE__), "../../lib/"))
|
8
|
+
require 'sequel/model'
|
9
|
+
end
|
10
|
+
|
11
|
+
class MockDataset < Sequel::Dataset
|
12
|
+
def insert(*args)
|
13
|
+
@db.execute insert_sql(*args)
|
14
|
+
end
|
15
|
+
|
16
|
+
def update(*args)
|
17
|
+
@db.execute update_sql(*args)
|
18
|
+
1
|
19
|
+
end
|
20
|
+
|
21
|
+
def delete(*args)
|
22
|
+
@db.execute delete_sql(*args)
|
23
|
+
1
|
24
|
+
end
|
25
|
+
|
26
|
+
def fetch_rows(sql)
|
27
|
+
return if sql =~ /information_schema/
|
28
|
+
@db.execute(sql)
|
29
|
+
yield({:id => 1, :x => 1})
|
30
|
+
end
|
31
|
+
|
32
|
+
def quoted_identifier(c)
|
33
|
+
"\"#{c}\""
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
class MockDatabase < Sequel::Database
|
38
|
+
@@quote_identifiers = false
|
39
|
+
self.identifier_input_method = nil
|
40
|
+
self.identifier_output_method = nil
|
41
|
+
attr_reader :sqls
|
42
|
+
|
43
|
+
def execute(sql, opts={})
|
44
|
+
@sqls ||= []
|
45
|
+
@sqls << sql
|
46
|
+
end
|
47
|
+
|
48
|
+
def reset
|
49
|
+
@sqls = []
|
50
|
+
end
|
51
|
+
|
52
|
+
def schema(table_name, opts)
|
53
|
+
if table_name
|
54
|
+
[[:id, {:primary_key=>true}]]
|
55
|
+
else
|
56
|
+
{table_name=>[[:id, {:primary_key=>true}]]}
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def transaction(opts={})
|
61
|
+
return yield if @transactions.include?(Thread.current)
|
62
|
+
execute('BEGIN')
|
63
|
+
begin
|
64
|
+
@transactions << Thread.current
|
65
|
+
yield
|
66
|
+
rescue Exception => e
|
67
|
+
execute('ROLLBACK')
|
68
|
+
transaction_error(e)
|
69
|
+
ensure
|
70
|
+
unless e
|
71
|
+
execute('COMMIT')
|
72
|
+
end
|
73
|
+
@transactions.delete(Thread.current)
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
def dataset(opts=nil); MockDataset.new(self, opts); end
|
78
|
+
end
|
79
|
+
|
80
|
+
class << Sequel::Model
|
81
|
+
alias orig_columns columns
|
82
|
+
def columns(*cols)
|
83
|
+
return if cols.empty?
|
84
|
+
define_method(:columns){cols}
|
85
|
+
@dataset.instance_variable_set(:@columns, cols) if @dataset
|
86
|
+
def_column_accessor(*cols)
|
87
|
+
@columns = cols
|
88
|
+
@db_schema = {}
|
89
|
+
cols.each{|c| @db_schema[c] = {}}
|
90
|
+
end
|
91
|
+
def simple_table
|
92
|
+
nil
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
Sequel::Model.use_transactions = false
|
97
|
+
Sequel::Model.db = MODEL_DB = MockDatabase.new
|
@@ -0,0 +1,153 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "spec_helper")
|
2
|
+
|
3
|
+
describe Sequel::Model::Errors do
|
4
|
+
before do
|
5
|
+
@errors = Sequel::Model::Errors.new
|
6
|
+
end
|
7
|
+
|
8
|
+
specify "should be clearable using #clear" do
|
9
|
+
@errors.add(:a, 'b')
|
10
|
+
@errors.should == {:a=>['b']}
|
11
|
+
@errors.clear
|
12
|
+
@errors.should == {}
|
13
|
+
end
|
14
|
+
|
15
|
+
specify "should be empty if no errors are added" do
|
16
|
+
@errors.should be_empty
|
17
|
+
@errors[:blah] << "blah"
|
18
|
+
@errors.should_not be_empty
|
19
|
+
end
|
20
|
+
|
21
|
+
specify "should return errors for a specific attribute using #on or #[]" do
|
22
|
+
@errors[:blah].should == []
|
23
|
+
@errors.on(:blah).should == []
|
24
|
+
|
25
|
+
@errors[:blah] << 'blah'
|
26
|
+
@errors[:blah].should == ['blah']
|
27
|
+
@errors.on(:blah).should == ['blah']
|
28
|
+
|
29
|
+
@errors[:bleu].should == []
|
30
|
+
@errors.on(:bleu).should == []
|
31
|
+
end
|
32
|
+
|
33
|
+
specify "should accept errors using #[] << or #add" do
|
34
|
+
@errors[:blah] << 'blah'
|
35
|
+
@errors[:blah].should == ['blah']
|
36
|
+
|
37
|
+
@errors.add :blah, 'zzzz'
|
38
|
+
@errors[:blah].should == ['blah', 'zzzz']
|
39
|
+
end
|
40
|
+
|
41
|
+
specify "should return full messages using #full_messages" do
|
42
|
+
@errors.full_messages.should == []
|
43
|
+
|
44
|
+
@errors[:blow] << 'blieuh'
|
45
|
+
@errors[:blow] << 'blich'
|
46
|
+
@errors[:blay] << 'bliu'
|
47
|
+
msgs = @errors.full_messages
|
48
|
+
msgs.size.should == 3
|
49
|
+
msgs.should include('blow blieuh', 'blow blich', 'blay bliu')
|
50
|
+
end
|
51
|
+
|
52
|
+
specify "should return the number of error messages using #count" do
|
53
|
+
@errors.count.should == 0
|
54
|
+
@errors.add(:a, 'b')
|
55
|
+
@errors.count.should == 1
|
56
|
+
@errors.add(:a, 'c')
|
57
|
+
@errors.count.should == 2
|
58
|
+
@errors.add(:b, 'c')
|
59
|
+
@errors.count.should == 3
|
60
|
+
end
|
61
|
+
|
62
|
+
specify "should return the array of error messages for a given attribute using #on" do
|
63
|
+
@errors.add(:a, 'b')
|
64
|
+
@errors.on(:a).should == ['b']
|
65
|
+
@errors.add(:a, 'c')
|
66
|
+
@errors.on(:a).should == ['b', 'c']
|
67
|
+
@errors.add(:b, 'c')
|
68
|
+
@errors.on(:a).should == ['b', 'c']
|
69
|
+
end
|
70
|
+
|
71
|
+
specify "should return nil if there are no error messages for a given attribute using #on" do
|
72
|
+
@errors.on(:a).should == nil
|
73
|
+
@errors.add(:b, 'b')
|
74
|
+
@errors.on(:a).should == nil
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
describe Sequel::Model do
|
79
|
+
before do
|
80
|
+
@c = Class.new(Sequel::Model) do
|
81
|
+
columns :score
|
82
|
+
def validate
|
83
|
+
errors[:score] << 'too low' if score < 87
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
@o = @c.new
|
88
|
+
end
|
89
|
+
|
90
|
+
specify "should supply a #valid? method that returns true if validations pass" do
|
91
|
+
@o.score = 50
|
92
|
+
@o.should_not be_valid
|
93
|
+
@o.score = 100
|
94
|
+
@o.should be_valid
|
95
|
+
end
|
96
|
+
|
97
|
+
specify "should provide an errors object" do
|
98
|
+
@o.score = 100
|
99
|
+
@o.should be_valid
|
100
|
+
@o.errors.should be_empty
|
101
|
+
|
102
|
+
@o.score = 86
|
103
|
+
@o.should_not be_valid
|
104
|
+
@o.errors[:score].should == ['too low']
|
105
|
+
@o.errors[:blah].should be_empty
|
106
|
+
end
|
107
|
+
|
108
|
+
specify "should allow raising of ValidationFailed with a string" do
|
109
|
+
proc{raise Sequel::ValidationFailed, "no reason"}.should raise_error(Sequel::ValidationFailed, "no reason")
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
describe "Model#save" do
|
114
|
+
before do
|
115
|
+
@c = Class.new(Sequel::Model(:people)) do
|
116
|
+
columns :id, :x
|
117
|
+
|
118
|
+
def validate
|
119
|
+
errors[:id] << 'blah' unless id == 5
|
120
|
+
end
|
121
|
+
end
|
122
|
+
@m = @c.load(:id => 4, :x=>6)
|
123
|
+
MODEL_DB.reset
|
124
|
+
end
|
125
|
+
|
126
|
+
specify "should save only if validations pass" do
|
127
|
+
@m.raise_on_save_failure = false
|
128
|
+
@m.should_not be_valid
|
129
|
+
@m.save
|
130
|
+
MODEL_DB.sqls.should be_empty
|
131
|
+
|
132
|
+
@m.id = 5
|
133
|
+
@m.should be_valid
|
134
|
+
@m.save.should_not be_false
|
135
|
+
MODEL_DB.sqls.should == ['UPDATE people SET x = 6 WHERE (id = 5)']
|
136
|
+
end
|
137
|
+
|
138
|
+
specify "should skip validations if the :validate=>false option is used" do
|
139
|
+
@m.raise_on_save_failure = false
|
140
|
+
@m.should_not be_valid
|
141
|
+
@m.save(:validate=>false)
|
142
|
+
MODEL_DB.sqls.should == ['UPDATE people SET x = 6 WHERE (id = 4)']
|
143
|
+
end
|
144
|
+
|
145
|
+
specify "should raise error if validations fail and raise_on_save_faiure is true" do
|
146
|
+
proc{@m.save}.should raise_error(Sequel::ValidationFailed){ |e| e.errors.should == @m.errors }
|
147
|
+
end
|
148
|
+
|
149
|
+
specify "should return nil if validations fail and raise_on_save_faiure is false" do
|
150
|
+
@m.raise_on_save_failure = false
|
151
|
+
@m.save.should == nil
|
152
|
+
end
|
153
|
+
end
|
data/spec/rcov.opts
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
# database objects for running adapter specs
|
2
|
+
# ADO_DB = Sequel.connect(:adapter => 'ado', :driver => "{Microsoft Access Driver (*.mdb)}; DBQ=c:\\Nwind.mdb")
|
3
|
+
# INFORMIX_DB = Sequel.connect('informix://localhost/mydb')
|
4
|
+
# INTEGRATION_URL = 'sqlite:/'
|
5
|
+
# MYSQL_USER = 'root'
|
6
|
+
# MYSQL_URL = "mysql://#{MYSQL_USER}@localhost/sandbox"
|
7
|
+
# MYSQL_SOCKET_FILE = '/tmp/mysql.sock'
|
8
|
+
# ORACLE_DB = Sequel.connect('oracle://hr:hr@localhost/XE')
|
9
|
+
# POSTGRES_URL = 'postgres://postgres:postgres@localhost:5432/reality_spec'
|
10
|
+
# SQLITE_URL = 'sqlite:/'
|
metadata
ADDED
@@ -0,0 +1,346 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: viking-sequel
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 3
|
7
|
+
- 10
|
8
|
+
- 0
|
9
|
+
version: 3.10.0
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Jeremy Evans
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-04-22 00:00:00 -05:00
|
18
|
+
default_executable:
|
19
|
+
dependencies: []
|
20
|
+
|
21
|
+
description: The Database Toolkit for Ruby
|
22
|
+
email: code@jeremyevans.net
|
23
|
+
executables:
|
24
|
+
- sequel
|
25
|
+
extensions: []
|
26
|
+
|
27
|
+
extra_rdoc_files:
|
28
|
+
- README.rdoc
|
29
|
+
- CHANGELOG
|
30
|
+
- COPYING
|
31
|
+
- doc/schema.rdoc
|
32
|
+
- doc/cheat_sheet.rdoc
|
33
|
+
- doc/opening_databases.rdoc
|
34
|
+
- doc/reflection.rdoc
|
35
|
+
- doc/sharding.rdoc
|
36
|
+
- doc/advanced_associations.rdoc
|
37
|
+
- doc/virtual_rows.rdoc
|
38
|
+
- doc/dataset_filtering.rdoc
|
39
|
+
- doc/prepared_statements.rdoc
|
40
|
+
- doc/dataset_basics.rdoc
|
41
|
+
- doc/release_notes/2.9.0.txt
|
42
|
+
- doc/release_notes/2.12.0.txt
|
43
|
+
- doc/release_notes/3.5.0.txt
|
44
|
+
- doc/release_notes/2.7.0.txt
|
45
|
+
- doc/release_notes/1.4.0.txt
|
46
|
+
- doc/release_notes/2.5.0.txt
|
47
|
+
- doc/release_notes/3.3.0.txt
|
48
|
+
- doc/release_notes/2.8.0.txt
|
49
|
+
- doc/release_notes/2.0.0.txt
|
50
|
+
- doc/release_notes/1.5.0.txt
|
51
|
+
- doc/release_notes/2.4.0.txt
|
52
|
+
- doc/release_notes/3.6.0.txt
|
53
|
+
- doc/release_notes/1.3.txt
|
54
|
+
- doc/release_notes/3.8.0.txt
|
55
|
+
- doc/release_notes/3.2.0.txt
|
56
|
+
- doc/release_notes/1.1.txt
|
57
|
+
- doc/release_notes/3.10.0.txt
|
58
|
+
- doc/release_notes/3.9.0.txt
|
59
|
+
- doc/release_notes/1.0.txt
|
60
|
+
- doc/release_notes/2.3.0.txt
|
61
|
+
- doc/release_notes/2.6.0.txt
|
62
|
+
- doc/release_notes/3.7.0.txt
|
63
|
+
- doc/release_notes/2.1.0.txt
|
64
|
+
- doc/release_notes/2.11.0.txt
|
65
|
+
- doc/release_notes/2.10.0.txt
|
66
|
+
- doc/release_notes/3.1.0.txt
|
67
|
+
- doc/release_notes/3.4.0.txt
|
68
|
+
- doc/release_notes/2.2.0.txt
|
69
|
+
- doc/release_notes/3.0.0.txt
|
70
|
+
files:
|
71
|
+
- COPYING
|
72
|
+
- CHANGELOG
|
73
|
+
- README.rdoc
|
74
|
+
- Rakefile
|
75
|
+
- bin/sequel
|
76
|
+
- doc/schema.rdoc
|
77
|
+
- doc/cheat_sheet.rdoc
|
78
|
+
- doc/opening_databases.rdoc
|
79
|
+
- doc/reflection.rdoc
|
80
|
+
- doc/sharding.rdoc
|
81
|
+
- doc/advanced_associations.rdoc
|
82
|
+
- doc/virtual_rows.rdoc
|
83
|
+
- doc/dataset_filtering.rdoc
|
84
|
+
- doc/prepared_statements.rdoc
|
85
|
+
- doc/dataset_basics.rdoc
|
86
|
+
- doc/release_notes/2.9.0.txt
|
87
|
+
- doc/release_notes/2.12.0.txt
|
88
|
+
- doc/release_notes/3.5.0.txt
|
89
|
+
- doc/release_notes/2.7.0.txt
|
90
|
+
- doc/release_notes/1.4.0.txt
|
91
|
+
- doc/release_notes/2.5.0.txt
|
92
|
+
- doc/release_notes/3.3.0.txt
|
93
|
+
- doc/release_notes/2.8.0.txt
|
94
|
+
- doc/release_notes/2.0.0.txt
|
95
|
+
- doc/release_notes/1.5.0.txt
|
96
|
+
- doc/release_notes/2.4.0.txt
|
97
|
+
- doc/release_notes/3.6.0.txt
|
98
|
+
- doc/release_notes/1.3.txt
|
99
|
+
- doc/release_notes/3.8.0.txt
|
100
|
+
- doc/release_notes/3.2.0.txt
|
101
|
+
- doc/release_notes/1.1.txt
|
102
|
+
- doc/release_notes/3.10.0.txt
|
103
|
+
- doc/release_notes/3.9.0.txt
|
104
|
+
- doc/release_notes/1.0.txt
|
105
|
+
- doc/release_notes/2.3.0.txt
|
106
|
+
- doc/release_notes/2.6.0.txt
|
107
|
+
- doc/release_notes/3.7.0.txt
|
108
|
+
- doc/release_notes/2.1.0.txt
|
109
|
+
- doc/release_notes/2.11.0.txt
|
110
|
+
- doc/release_notes/2.10.0.txt
|
111
|
+
- doc/release_notes/3.1.0.txt
|
112
|
+
- doc/release_notes/3.4.0.txt
|
113
|
+
- doc/release_notes/2.2.0.txt
|
114
|
+
- doc/release_notes/3.0.0.txt
|
115
|
+
- spec/rcov.opts
|
116
|
+
- spec/spec_config.rb.example
|
117
|
+
- spec/core/expression_filters_spec.rb
|
118
|
+
- spec/core/schema_generator_spec.rb
|
119
|
+
- spec/core/dataset_spec.rb
|
120
|
+
- spec/core/version_spec.rb
|
121
|
+
- spec/core/connection_pool_spec.rb
|
122
|
+
- spec/core/core_sql_spec.rb
|
123
|
+
- spec/core/spec_helper.rb
|
124
|
+
- spec/core/database_spec.rb
|
125
|
+
- spec/core/schema_spec.rb
|
126
|
+
- spec/core/object_graph_spec.rb
|
127
|
+
- spec/model/eager_loading_spec.rb
|
128
|
+
- spec/model/model_spec.rb
|
129
|
+
- spec/model/association_reflection_spec.rb
|
130
|
+
- spec/model/dataset_methods_spec.rb
|
131
|
+
- spec/model/plugins_spec.rb
|
132
|
+
- spec/model/associations_spec.rb
|
133
|
+
- spec/model/record_spec.rb
|
134
|
+
- spec/model/spec_helper.rb
|
135
|
+
- spec/model/base_spec.rb
|
136
|
+
- spec/model/inflector_spec.rb
|
137
|
+
- spec/model/hooks_spec.rb
|
138
|
+
- spec/model/validations_spec.rb
|
139
|
+
- spec/adapters/mssql_spec.rb
|
140
|
+
- spec/adapters/sqlite_spec.rb
|
141
|
+
- spec/adapters/oracle_spec.rb
|
142
|
+
- spec/adapters/mysql_spec.rb
|
143
|
+
- spec/adapters/informix_spec.rb
|
144
|
+
- spec/adapters/firebird_spec.rb
|
145
|
+
- spec/adapters/spec_helper.rb
|
146
|
+
- spec/adapters/postgres_spec.rb
|
147
|
+
- spec/extensions/single_table_inheritance_spec.rb
|
148
|
+
- spec/extensions/validation_helpers_spec.rb
|
149
|
+
- spec/extensions/validation_class_methods_spec.rb
|
150
|
+
- spec/extensions/subclasses_spec.rb
|
151
|
+
- spec/extensions/sql_expr_spec.rb
|
152
|
+
- spec/extensions/instance_hooks_spec.rb
|
153
|
+
- spec/extensions/active_model_spec.rb
|
154
|
+
- spec/extensions/typecast_on_load_spec.rb
|
155
|
+
- spec/extensions/composition_spec.rb
|
156
|
+
- spec/extensions/lazy_attributes_spec.rb
|
157
|
+
- spec/extensions/force_encoding_spec.rb
|
158
|
+
- spec/extensions/association_dependencies_spec.rb
|
159
|
+
- spec/extensions/optimistic_locking_spec.rb
|
160
|
+
- spec/extensions/named_timezones_spec.rb
|
161
|
+
- spec/extensions/schema_dumper_spec.rb
|
162
|
+
- spec/extensions/blank_spec.rb
|
163
|
+
- spec/extensions/timestamps_spec.rb
|
164
|
+
- spec/extensions/migration_spec.rb
|
165
|
+
- spec/extensions/nested_attributes_spec.rb
|
166
|
+
- spec/extensions/touch_spec.rb
|
167
|
+
- spec/extensions/thread_local_timezones_spec.rb
|
168
|
+
- spec/extensions/caching_spec.rb
|
169
|
+
- spec/extensions/string_date_time_spec.rb
|
170
|
+
- spec/extensions/rcte_tree_spec.rb
|
171
|
+
- spec/extensions/pagination_spec.rb
|
172
|
+
- spec/extensions/tactical_eager_loading_spec.rb
|
173
|
+
- spec/extensions/class_table_inheritance_spec.rb
|
174
|
+
- spec/extensions/boolean_readers_spec.rb
|
175
|
+
- spec/extensions/association_proxies_spec.rb
|
176
|
+
- spec/extensions/query_spec.rb
|
177
|
+
- spec/extensions/pretty_table_spec.rb
|
178
|
+
- spec/extensions/looser_typecasting_spec.rb
|
179
|
+
- spec/extensions/spec_helper.rb
|
180
|
+
- spec/extensions/many_through_many_spec.rb
|
181
|
+
- spec/extensions/instance_filters_spec.rb
|
182
|
+
- spec/extensions/serialization_spec.rb
|
183
|
+
- spec/extensions/schema_spec.rb
|
184
|
+
- spec/extensions/inflector_spec.rb
|
185
|
+
- spec/extensions/hook_class_methods_spec.rb
|
186
|
+
- spec/extensions/identity_map_spec.rb
|
187
|
+
- spec/integration/schema_test.rb
|
188
|
+
- spec/integration/database_test.rb
|
189
|
+
- spec/integration/dataset_test.rb
|
190
|
+
- spec/integration/transaction_test.rb
|
191
|
+
- spec/integration/eager_loader_test.rb
|
192
|
+
- spec/integration/type_test.rb
|
193
|
+
- spec/integration/associations_test.rb
|
194
|
+
- spec/integration/spec_helper.rb
|
195
|
+
- spec/integration/model_test.rb
|
196
|
+
- spec/integration/timezone_test.rb
|
197
|
+
- spec/integration/prepared_statement_test.rb
|
198
|
+
- spec/integration/plugin_test.rb
|
199
|
+
- lib/sequel_model.rb
|
200
|
+
- lib/sequel_core.rb
|
201
|
+
- lib/sequel.rb
|
202
|
+
- lib/sequel/model.rb
|
203
|
+
- lib/sequel/core.rb
|
204
|
+
- lib/sequel/core_sql.rb
|
205
|
+
- lib/sequel/dataset.rb
|
206
|
+
- lib/sequel/version.rb
|
207
|
+
- lib/sequel/exceptions.rb
|
208
|
+
- lib/sequel/connection_pool.rb
|
209
|
+
- lib/sequel/metaprogramming.rb
|
210
|
+
- lib/sequel/timezones.rb
|
211
|
+
- lib/sequel/sql.rb
|
212
|
+
- lib/sequel/database.rb
|
213
|
+
- lib/sequel/dataset/mutation.rb
|
214
|
+
- lib/sequel/dataset/misc.rb
|
215
|
+
- lib/sequel/dataset/actions.rb
|
216
|
+
- lib/sequel/dataset/graph.rb
|
217
|
+
- lib/sequel/dataset/features.rb
|
218
|
+
- lib/sequel/dataset/prepared_statements.rb
|
219
|
+
- lib/sequel/dataset/query.rb
|
220
|
+
- lib/sequel/dataset/sql.rb
|
221
|
+
- lib/sequel/model/associations.rb
|
222
|
+
- lib/sequel/model/errors.rb
|
223
|
+
- lib/sequel/model/plugins.rb
|
224
|
+
- lib/sequel/model/exceptions.rb
|
225
|
+
- lib/sequel/model/default_inflections.rb
|
226
|
+
- lib/sequel/model/inflections.rb
|
227
|
+
- lib/sequel/model/base.rb
|
228
|
+
- lib/sequel/connection_pool/single.rb
|
229
|
+
- lib/sequel/connection_pool/sharded_single.rb
|
230
|
+
- lib/sequel/connection_pool/sharded_threaded.rb
|
231
|
+
- lib/sequel/connection_pool/threaded.rb
|
232
|
+
- lib/sequel/plugins/timestamps.rb
|
233
|
+
- lib/sequel/plugins/caching.rb
|
234
|
+
- lib/sequel/plugins/composition.rb
|
235
|
+
- lib/sequel/plugins/class_table_inheritance.rb
|
236
|
+
- lib/sequel/plugins/nested_attributes.rb
|
237
|
+
- lib/sequel/plugins/association_dependencies.rb
|
238
|
+
- lib/sequel/plugins/lazy_attributes.rb
|
239
|
+
- lib/sequel/plugins/identity_map.rb
|
240
|
+
- lib/sequel/plugins/typecast_on_load.rb
|
241
|
+
- lib/sequel/plugins/tactical_eager_loading.rb
|
242
|
+
- lib/sequel/plugins/many_through_many.rb
|
243
|
+
- lib/sequel/plugins/hook_class_methods.rb
|
244
|
+
- lib/sequel/plugins/validation_class_methods.rb
|
245
|
+
- lib/sequel/plugins/serialization.rb
|
246
|
+
- lib/sequel/plugins/boolean_readers.rb
|
247
|
+
- lib/sequel/plugins/rcte_tree.rb
|
248
|
+
- lib/sequel/plugins/validation_helpers.rb
|
249
|
+
- lib/sequel/plugins/schema.rb
|
250
|
+
- lib/sequel/plugins/instance_hooks.rb
|
251
|
+
- lib/sequel/plugins/instance_filters.rb
|
252
|
+
- lib/sequel/plugins/force_encoding.rb
|
253
|
+
- lib/sequel/plugins/single_table_inheritance.rb
|
254
|
+
- lib/sequel/plugins/touch.rb
|
255
|
+
- lib/sequel/plugins/subclasses.rb
|
256
|
+
- lib/sequel/plugins/optimistic_locking.rb
|
257
|
+
- lib/sequel/plugins/active_model.rb
|
258
|
+
- lib/sequel/plugins/association_proxies.rb
|
259
|
+
- lib/sequel/adapters/dbi.rb
|
260
|
+
- lib/sequel/adapters/openbase.rb
|
261
|
+
- lib/sequel/adapters/postgres.rb
|
262
|
+
- lib/sequel/adapters/odbc.rb
|
263
|
+
- lib/sequel/adapters/firebird.rb
|
264
|
+
- lib/sequel/adapters/sqlite.rb
|
265
|
+
- lib/sequel/adapters/oracle.rb
|
266
|
+
- lib/sequel/adapters/do.rb
|
267
|
+
- lib/sequel/adapters/jdbc.rb
|
268
|
+
- lib/sequel/adapters/db2.rb
|
269
|
+
- lib/sequel/adapters/amalgalite.rb
|
270
|
+
- lib/sequel/adapters/informix.rb
|
271
|
+
- lib/sequel/adapters/ado.rb
|
272
|
+
- lib/sequel/adapters/mysql.rb
|
273
|
+
- lib/sequel/adapters/utils/stored_procedures.rb
|
274
|
+
- lib/sequel/adapters/jdbc/mssql.rb
|
275
|
+
- lib/sequel/adapters/jdbc/sqlite.rb
|
276
|
+
- lib/sequel/adapters/jdbc/oracle.rb
|
277
|
+
- lib/sequel/adapters/jdbc/as400.rb
|
278
|
+
- lib/sequel/adapters/jdbc/mysql.rb
|
279
|
+
- lib/sequel/adapters/jdbc/h2.rb
|
280
|
+
- lib/sequel/adapters/jdbc/postgresql.rb
|
281
|
+
- lib/sequel/adapters/ado/mssql.rb
|
282
|
+
- lib/sequel/adapters/shared/postgres.rb
|
283
|
+
- lib/sequel/adapters/shared/mssql.rb
|
284
|
+
- lib/sequel/adapters/shared/sqlite.rb
|
285
|
+
- lib/sequel/adapters/shared/oracle.rb
|
286
|
+
- lib/sequel/adapters/shared/progress.rb
|
287
|
+
- lib/sequel/adapters/shared/mysql.rb
|
288
|
+
- lib/sequel/adapters/odbc/mssql.rb
|
289
|
+
- lib/sequel/adapters/do/postgres.rb
|
290
|
+
- lib/sequel/adapters/do/sqlite.rb
|
291
|
+
- lib/sequel/adapters/do/mysql.rb
|
292
|
+
- lib/sequel/database/schema_generator.rb
|
293
|
+
- lib/sequel/database/schema_sql.rb
|
294
|
+
- lib/sequel/database/schema_methods.rb
|
295
|
+
- lib/sequel/extensions/inflector.rb
|
296
|
+
- lib/sequel/extensions/string_date_time.rb
|
297
|
+
- lib/sequel/extensions/thread_local_timezones.rb
|
298
|
+
- lib/sequel/extensions/pagination.rb
|
299
|
+
- lib/sequel/extensions/blank.rb
|
300
|
+
- lib/sequel/extensions/sql_expr.rb
|
301
|
+
- lib/sequel/extensions/pretty_table.rb
|
302
|
+
- lib/sequel/extensions/looser_typecasting.rb
|
303
|
+
- lib/sequel/extensions/query.rb
|
304
|
+
- lib/sequel/extensions/migration.rb
|
305
|
+
- lib/sequel/extensions/schema_dumper.rb
|
306
|
+
- lib/sequel/extensions/named_timezones.rb
|
307
|
+
has_rdoc: true
|
308
|
+
homepage: http://sequel.rubyforge.org
|
309
|
+
licenses: []
|
310
|
+
|
311
|
+
post_install_message:
|
312
|
+
rdoc_options:
|
313
|
+
- --quiet
|
314
|
+
- --line-numbers
|
315
|
+
- --inline-source
|
316
|
+
- --title
|
317
|
+
- "Sequel: The Database Toolkit for Ruby"
|
318
|
+
- --main
|
319
|
+
- README.rdoc
|
320
|
+
require_paths:
|
321
|
+
- lib
|
322
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
323
|
+
requirements:
|
324
|
+
- - ">="
|
325
|
+
- !ruby/object:Gem::Version
|
326
|
+
segments:
|
327
|
+
- 1
|
328
|
+
- 8
|
329
|
+
- 4
|
330
|
+
version: 1.8.4
|
331
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
332
|
+
requirements:
|
333
|
+
- - ">="
|
334
|
+
- !ruby/object:Gem::Version
|
335
|
+
segments:
|
336
|
+
- 0
|
337
|
+
version: "0"
|
338
|
+
requirements: []
|
339
|
+
|
340
|
+
rubyforge_project: sequel
|
341
|
+
rubygems_version: 1.3.6
|
342
|
+
signing_key:
|
343
|
+
specification_version: 3
|
344
|
+
summary: The Database Toolkit for Ruby
|
345
|
+
test_files: []
|
346
|
+
|