sequel 3.28.0 → 3.29.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +119 -3
- data/Rakefile +5 -3
- data/bin/sequel +1 -5
- data/doc/model_hooks.rdoc +9 -1
- data/doc/opening_databases.rdoc +49 -40
- data/doc/prepared_statements.rdoc +27 -6
- data/doc/release_notes/3.28.0.txt +2 -2
- data/doc/release_notes/3.29.0.txt +459 -0
- data/doc/sharding.rdoc +7 -1
- data/doc/testing.rdoc +18 -9
- data/doc/transactions.rdoc +41 -1
- data/lib/sequel/adapters/ado.rb +28 -17
- data/lib/sequel/adapters/ado/mssql.rb +18 -6
- data/lib/sequel/adapters/amalgalite.rb +11 -7
- data/lib/sequel/adapters/db2.rb +122 -70
- data/lib/sequel/adapters/dbi.rb +15 -15
- data/lib/sequel/adapters/do.rb +5 -36
- data/lib/sequel/adapters/do/mysql.rb +0 -5
- data/lib/sequel/adapters/do/postgres.rb +0 -5
- data/lib/sequel/adapters/do/sqlite.rb +0 -5
- data/lib/sequel/adapters/firebird.rb +3 -6
- data/lib/sequel/adapters/ibmdb.rb +24 -16
- data/lib/sequel/adapters/informix.rb +2 -4
- data/lib/sequel/adapters/jdbc.rb +47 -11
- data/lib/sequel/adapters/jdbc/as400.rb +5 -24
- data/lib/sequel/adapters/jdbc/db2.rb +0 -5
- data/lib/sequel/adapters/jdbc/derby.rb +217 -0
- data/lib/sequel/adapters/jdbc/firebird.rb +0 -5
- data/lib/sequel/adapters/jdbc/h2.rb +10 -12
- data/lib/sequel/adapters/jdbc/hsqldb.rb +166 -0
- data/lib/sequel/adapters/jdbc/informix.rb +0 -5
- data/lib/sequel/adapters/jdbc/jtds.rb +0 -5
- data/lib/sequel/adapters/jdbc/mysql.rb +0 -10
- data/lib/sequel/adapters/jdbc/oracle.rb +70 -3
- data/lib/sequel/adapters/jdbc/postgresql.rb +0 -11
- data/lib/sequel/adapters/jdbc/sqlite.rb +0 -5
- data/lib/sequel/adapters/jdbc/sqlserver.rb +0 -5
- data/lib/sequel/adapters/jdbc/transactions.rb +56 -7
- data/lib/sequel/adapters/mock.rb +315 -0
- data/lib/sequel/adapters/mysql.rb +64 -51
- data/lib/sequel/adapters/mysql2.rb +15 -9
- data/lib/sequel/adapters/odbc.rb +13 -6
- data/lib/sequel/adapters/odbc/db2.rb +0 -4
- data/lib/sequel/adapters/odbc/mssql.rb +0 -5
- data/lib/sequel/adapters/openbase.rb +2 -4
- data/lib/sequel/adapters/oracle.rb +333 -51
- data/lib/sequel/adapters/postgres.rb +80 -27
- data/lib/sequel/adapters/shared/access.rb +0 -6
- data/lib/sequel/adapters/shared/db2.rb +13 -15
- data/lib/sequel/adapters/shared/firebird.rb +6 -6
- data/lib/sequel/adapters/shared/mssql.rb +23 -18
- data/lib/sequel/adapters/shared/mysql.rb +6 -6
- data/lib/sequel/adapters/shared/mysql_prepared_statements.rb +6 -0
- data/lib/sequel/adapters/shared/oracle.rb +185 -30
- data/lib/sequel/adapters/shared/postgres.rb +35 -18
- data/lib/sequel/adapters/shared/progress.rb +0 -6
- data/lib/sequel/adapters/shared/sqlite.rb +116 -37
- data/lib/sequel/adapters/sqlite.rb +16 -8
- data/lib/sequel/adapters/swift.rb +5 -5
- data/lib/sequel/adapters/swift/mysql.rb +0 -5
- data/lib/sequel/adapters/swift/postgres.rb +0 -5
- data/lib/sequel/adapters/swift/sqlite.rb +6 -4
- data/lib/sequel/adapters/tinytds.rb +13 -10
- data/lib/sequel/adapters/utils/emulate_offset_with_row_number.rb +8 -0
- data/lib/sequel/core.rb +40 -0
- data/lib/sequel/database/connecting.rb +1 -2
- data/lib/sequel/database/dataset.rb +3 -3
- data/lib/sequel/database/dataset_defaults.rb +58 -0
- data/lib/sequel/database/misc.rb +62 -2
- data/lib/sequel/database/query.rb +113 -49
- data/lib/sequel/database/schema_methods.rb +7 -2
- data/lib/sequel/dataset/actions.rb +37 -19
- data/lib/sequel/dataset/features.rb +24 -0
- data/lib/sequel/dataset/graph.rb +7 -6
- data/lib/sequel/dataset/misc.rb +11 -3
- data/lib/sequel/dataset/mutation.rb +2 -3
- data/lib/sequel/dataset/prepared_statements.rb +6 -4
- data/lib/sequel/dataset/query.rb +46 -15
- data/lib/sequel/dataset/sql.rb +28 -4
- data/lib/sequel/extensions/named_timezones.rb +5 -0
- data/lib/sequel/extensions/thread_local_timezones.rb +1 -1
- data/lib/sequel/model.rb +2 -1
- data/lib/sequel/model/associations.rb +115 -33
- data/lib/sequel/model/base.rb +91 -31
- data/lib/sequel/plugins/class_table_inheritance.rb +4 -4
- data/lib/sequel/plugins/dataset_associations.rb +100 -0
- data/lib/sequel/plugins/force_encoding.rb +6 -6
- data/lib/sequel/plugins/identity_map.rb +1 -1
- data/lib/sequel/plugins/many_through_many.rb +6 -10
- data/lib/sequel/plugins/prepared_statements.rb +12 -1
- data/lib/sequel/plugins/prepared_statements_associations.rb +1 -1
- data/lib/sequel/plugins/rcte_tree.rb +29 -15
- data/lib/sequel/plugins/serialization.rb +6 -1
- data/lib/sequel/plugins/sharding.rb +0 -5
- data/lib/sequel/plugins/single_table_inheritance.rb +1 -1
- data/lib/sequel/plugins/typecast_on_load.rb +9 -12
- data/lib/sequel/plugins/update_primary_key.rb +1 -1
- data/lib/sequel/timezones.rb +42 -42
- data/lib/sequel/version.rb +1 -1
- data/spec/adapters/mssql_spec.rb +29 -29
- data/spec/adapters/mysql_spec.rb +86 -104
- data/spec/adapters/oracle_spec.rb +48 -76
- data/spec/adapters/postgres_spec.rb +98 -33
- data/spec/adapters/spec_helper.rb +0 -5
- data/spec/adapters/sqlite_spec.rb +24 -21
- data/spec/core/connection_pool_spec.rb +9 -15
- data/spec/core/core_sql_spec.rb +20 -31
- data/spec/core/database_spec.rb +491 -227
- data/spec/core/dataset_spec.rb +638 -1051
- data/spec/core/expression_filters_spec.rb +0 -1
- data/spec/core/mock_adapter_spec.rb +378 -0
- data/spec/core/object_graph_spec.rb +48 -114
- data/spec/core/schema_generator_spec.rb +3 -3
- data/spec/core/schema_spec.rb +51 -114
- data/spec/core/spec_helper.rb +3 -90
- data/spec/extensions/class_table_inheritance_spec.rb +1 -1
- data/spec/extensions/dataset_associations_spec.rb +199 -0
- data/spec/extensions/instance_hooks_spec.rb +71 -0
- data/spec/extensions/named_timezones_spec.rb +22 -2
- data/spec/extensions/nested_attributes_spec.rb +3 -0
- data/spec/extensions/schema_spec.rb +1 -1
- data/spec/extensions/serialization_modification_detection_spec.rb +1 -0
- data/spec/extensions/serialization_spec.rb +5 -8
- data/spec/extensions/spec_helper.rb +4 -0
- data/spec/extensions/thread_local_timezones_spec.rb +22 -2
- data/spec/extensions/typecast_on_load_spec.rb +1 -6
- data/spec/integration/associations_test.rb +123 -12
- data/spec/integration/dataset_test.rb +140 -47
- data/spec/integration/eager_loader_test.rb +19 -21
- data/spec/integration/model_test.rb +80 -1
- data/spec/integration/plugin_test.rb +179 -128
- data/spec/integration/prepared_statement_test.rb +92 -91
- data/spec/integration/schema_test.rb +42 -23
- data/spec/integration/spec_helper.rb +25 -31
- data/spec/integration/timezone_test.rb +38 -12
- data/spec/integration/transaction_test.rb +161 -34
- data/spec/integration/type_test.rb +3 -3
- data/spec/model/association_reflection_spec.rb +83 -7
- data/spec/model/associations_spec.rb +393 -676
- data/spec/model/base_spec.rb +186 -116
- data/spec/model/dataset_methods_spec.rb +7 -27
- data/spec/model/eager_loading_spec.rb +343 -867
- data/spec/model/hooks_spec.rb +160 -79
- data/spec/model/model_spec.rb +118 -165
- data/spec/model/plugins_spec.rb +7 -13
- data/spec/model/record_spec.rb +138 -207
- data/spec/model/spec_helper.rb +10 -73
- metadata +14 -8
data/spec/model/spec_helper.rb
CHANGED
@@ -13,79 +13,15 @@ if ENV['SEQUEL_COLUMNS_INTROSPECTION']
|
|
13
13
|
Sequel::Dataset.introspect_all_columns
|
14
14
|
end
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
end
|
20
|
-
|
21
|
-
def update(*args)
|
22
|
-
@db.execute update_sql(*args)
|
23
|
-
1
|
24
|
-
end
|
25
|
-
|
26
|
-
def delete(*args)
|
27
|
-
@db.execute delete_sql(*args)
|
28
|
-
1
|
29
|
-
end
|
30
|
-
|
31
|
-
def fetch_rows(sql)
|
32
|
-
return if sql =~ /information_schema/
|
33
|
-
@db.execute(sql)
|
34
|
-
yield({:id => 1, :x => 1})
|
35
|
-
end
|
36
|
-
|
37
|
-
def quoted_identifier(c)
|
38
|
-
"\"#{c}\""
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
class MockDatabase < Sequel::Database
|
43
|
-
@@quote_identifiers = false
|
44
|
-
self.identifier_input_method = nil
|
45
|
-
self.identifier_output_method = nil
|
46
|
-
attr_reader :sqls
|
47
|
-
|
48
|
-
def execute(sql, opts={})
|
49
|
-
@sqls ||= []
|
50
|
-
@sqls << sql
|
51
|
-
end
|
52
|
-
|
53
|
-
def reset
|
54
|
-
@sqls = []
|
55
|
-
end
|
56
|
-
|
57
|
-
def schema(table_name, opts)
|
58
|
-
if table_name
|
59
|
-
[[:id, {:primary_key=>true}]]
|
60
|
-
else
|
61
|
-
{table_name=>[[:id, {:primary_key=>true}]]}
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
def transaction(opts={})
|
66
|
-
return yield if @transactions.include?(Thread.current)
|
67
|
-
execute('BEGIN')
|
68
|
-
begin
|
69
|
-
@transactions << Thread.current
|
70
|
-
yield
|
71
|
-
rescue Exception => e
|
72
|
-
execute('ROLLBACK')
|
73
|
-
transaction_error(e)
|
74
|
-
ensure
|
75
|
-
unless e
|
76
|
-
execute('COMMIT')
|
77
|
-
end
|
78
|
-
@transactions.delete(Thread.current)
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
def dataset(opts=nil); MockDataset.new(self, opts); end
|
83
|
-
end
|
16
|
+
Sequel.quote_identifiers = false
|
17
|
+
Sequel.identifier_input_method = nil
|
18
|
+
Sequel.identifier_output_method = nil
|
84
19
|
|
85
20
|
class << Sequel::Model
|
21
|
+
attr_writer :db_schema
|
86
22
|
alias orig_columns columns
|
87
23
|
def columns(*cols)
|
88
|
-
return if cols.empty?
|
24
|
+
return super if cols.empty?
|
89
25
|
define_method(:columns){cols}
|
90
26
|
@dataset.instance_variable_set(:@columns, cols) if @dataset
|
91
27
|
def_column_accessor(*cols)
|
@@ -93,10 +29,11 @@ class << Sequel::Model
|
|
93
29
|
@db_schema = {}
|
94
30
|
cols.each{|c| @db_schema[c] = {}}
|
95
31
|
end
|
96
|
-
def simple_table
|
97
|
-
nil
|
98
|
-
end
|
99
32
|
end
|
100
33
|
|
101
34
|
Sequel::Model.use_transactions = false
|
102
|
-
|
35
|
+
|
36
|
+
db = Sequel.mock(:fetch=>{:id => 1, :x => 1}, :numrows=>1, :autoid=>proc{|sql| 10})
|
37
|
+
def db.schema(*) [[:id, {:primary_key=>true}]] end
|
38
|
+
def db.reset() sqls end
|
39
|
+
Sequel::Model.db = MODEL_DB = db
|
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:
|
5
|
-
prerelease:
|
4
|
+
hash: 115
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 3
|
8
|
-
-
|
8
|
+
- 29
|
9
9
|
- 0
|
10
|
-
version: 3.
|
10
|
+
version: 3.29.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jeremy Evans
|
@@ -15,8 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
19
|
-
default_executable:
|
18
|
+
date: 2011-11-01 00:00:00 Z
|
20
19
|
dependencies: []
|
21
20
|
|
22
21
|
description: The Database Toolkit for Ruby
|
@@ -96,6 +95,7 @@ extra_rdoc_files:
|
|
96
95
|
- doc/release_notes/3.26.0.txt
|
97
96
|
- doc/release_notes/3.27.0.txt
|
98
97
|
- doc/release_notes/3.28.0.txt
|
98
|
+
- doc/release_notes/3.29.0.txt
|
99
99
|
files:
|
100
100
|
- MIT-LICENSE
|
101
101
|
- CHANGELOG
|
@@ -161,6 +161,7 @@ files:
|
|
161
161
|
- doc/release_notes/3.26.0.txt
|
162
162
|
- doc/release_notes/3.27.0.txt
|
163
163
|
- doc/release_notes/3.28.0.txt
|
164
|
+
- doc/release_notes/3.29.0.txt
|
164
165
|
- doc/sharding.rdoc
|
165
166
|
- doc/sql.rdoc
|
166
167
|
- doc/validations.rdoc
|
@@ -188,6 +189,7 @@ files:
|
|
188
189
|
- spec/core/schema_spec.rb
|
189
190
|
- spec/core/spec_helper.rb
|
190
191
|
- spec/core/version_spec.rb
|
192
|
+
- spec/core/mock_adapter_spec.rb
|
191
193
|
- spec/extensions/active_model_spec.rb
|
192
194
|
- spec/extensions/association_dependencies_spec.rb
|
193
195
|
- spec/extensions/association_proxies_spec.rb
|
@@ -245,6 +247,7 @@ files:
|
|
245
247
|
- spec/extensions/prepared_statements_safe_spec.rb
|
246
248
|
- spec/extensions/prepared_statements_with_pk_spec.rb
|
247
249
|
- spec/extensions/prepared_statements_associations_spec.rb
|
250
|
+
- spec/extensions/dataset_associations_spec.rb
|
248
251
|
- spec/extensions/columns_introspection_spec.rb
|
249
252
|
- spec/integration/associations_test.rb
|
250
253
|
- spec/integration/database_test.rb
|
@@ -340,6 +343,8 @@ files:
|
|
340
343
|
- lib/sequel/adapters/jdbc/db2.rb
|
341
344
|
- lib/sequel/adapters/jdbc/transactions.rb
|
342
345
|
- lib/sequel/adapters/jdbc/firebird.rb
|
346
|
+
- lib/sequel/adapters/jdbc/hsqldb.rb
|
347
|
+
- lib/sequel/adapters/jdbc/derby.rb
|
343
348
|
- lib/sequel/adapters/mysql.rb
|
344
349
|
- lib/sequel/adapters/odbc.rb
|
345
350
|
- lib/sequel/adapters/odbc/mssql.rb
|
@@ -368,6 +373,7 @@ files:
|
|
368
373
|
- lib/sequel/adapters/swift/sqlite.rb
|
369
374
|
- lib/sequel/adapters/tinytds.rb
|
370
375
|
- lib/sequel/adapters/ibmdb.rb
|
376
|
+
- lib/sequel/adapters/mock.rb
|
371
377
|
- lib/sequel/connection_pool.rb
|
372
378
|
- lib/sequel/connection_pool/sharded_single.rb
|
373
379
|
- lib/sequel/connection_pool/sharded_threaded.rb
|
@@ -460,13 +466,13 @@ files:
|
|
460
466
|
- lib/sequel/plugins/prepared_statements_safe.rb
|
461
467
|
- lib/sequel/plugins/prepared_statements_with_pk.rb
|
462
468
|
- lib/sequel/plugins/prepared_statements_associations.rb
|
469
|
+
- lib/sequel/plugins/dataset_associations.rb
|
463
470
|
- lib/sequel/sql.rb
|
464
471
|
- lib/sequel/timezones.rb
|
465
472
|
- lib/sequel/version.rb
|
466
473
|
- lib/sequel/ast_transformer.rb
|
467
474
|
- lib/sequel_core.rb
|
468
475
|
- lib/sequel_model.rb
|
469
|
-
has_rdoc: true
|
470
476
|
homepage: http://sequel.rubyforge.org
|
471
477
|
licenses: []
|
472
478
|
|
@@ -504,7 +510,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
504
510
|
requirements: []
|
505
511
|
|
506
512
|
rubyforge_project: sequel
|
507
|
-
rubygems_version: 1.
|
513
|
+
rubygems_version: 1.8.10
|
508
514
|
signing_key:
|
509
515
|
specification_version: 3
|
510
516
|
summary: The Database Toolkit for Ruby
|