sequel 4.13.0 → 4.14.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 +24 -0
- data/doc/active_record.rdoc +4 -4
- data/doc/advanced_associations.rdoc +2 -2
- data/doc/association_basics.rdoc +11 -11
- data/doc/cheat_sheet.rdoc +7 -7
- data/doc/core_extensions.rdoc +1 -1
- data/doc/dataset_filtering.rdoc +1 -1
- data/doc/extensions.rdoc +1 -1
- data/doc/migration.rdoc +3 -3
- data/doc/model_hooks.rdoc +1 -1
- data/doc/opening_databases.rdoc +4 -0
- data/doc/postgresql.rdoc +2 -2
- data/doc/prepared_statements.rdoc +1 -1
- data/doc/querying.rdoc +31 -31
- data/doc/release_notes/4.13.0.txt +1 -1
- data/doc/release_notes/4.14.0.txt +68 -0
- data/doc/schema_modification.rdoc +1 -1
- data/doc/sharding.rdoc +2 -2
- data/doc/sql.rdoc +1 -1
- data/doc/virtual_rows.rdoc +2 -2
- data/lib/sequel/adapters/jdbc/jtds.rb +4 -0
- data/lib/sequel/adapters/mysql.rb +18 -18
- data/lib/sequel/adapters/mysql2.rb +7 -7
- data/lib/sequel/adapters/shared/mysql.rb +15 -5
- data/lib/sequel/adapters/shared/postgres.rb +71 -58
- data/lib/sequel/adapters/shared/sqlite.rb +2 -2
- data/lib/sequel/ast_transformer.rb +1 -1
- data/lib/sequel/connection_pool/sharded_single.rb +8 -8
- data/lib/sequel/connection_pool/sharded_threaded.rb +8 -8
- data/lib/sequel/database/connecting.rb +1 -1
- data/lib/sequel/database/schema_generator.rb +12 -0
- data/lib/sequel/database/schema_methods.rb +8 -7
- data/lib/sequel/database/transactions.rb +1 -2
- data/lib/sequel/dataset/actions.rb +4 -4
- data/lib/sequel/dataset/graph.rb +4 -0
- data/lib/sequel/dataset/query.rb +18 -18
- data/lib/sequel/dataset/sql.rb +3 -3
- data/lib/sequel/extensions/_pretty_table.rb +1 -0
- data/lib/sequel/extensions/arbitrary_servers.rb +3 -2
- data/lib/sequel/extensions/columns_introspection.rb +1 -0
- data/lib/sequel/extensions/connection_validator.rb +1 -0
- data/lib/sequel/extensions/constraint_validations.rb +1 -0
- data/lib/sequel/extensions/current_datetime_timestamp.rb +1 -0
- data/lib/sequel/extensions/dataset_source_alias.rb +1 -0
- data/lib/sequel/extensions/date_arithmetic.rb +1 -0
- data/lib/sequel/extensions/empty_array_ignore_nulls.rb +1 -0
- data/lib/sequel/extensions/error_sql.rb +1 -0
- data/lib/sequel/extensions/eval_inspect.rb +1 -0
- data/lib/sequel/extensions/filter_having.rb +1 -0
- data/lib/sequel/extensions/from_block.rb +1 -0
- data/lib/sequel/extensions/graph_each.rb +1 -0
- data/lib/sequel/extensions/hash_aliases.rb +1 -0
- data/lib/sequel/extensions/looser_typecasting.rb +1 -0
- data/lib/sequel/extensions/meta_def.rb +1 -0
- data/lib/sequel/extensions/migration.rb +1 -0
- data/lib/sequel/extensions/mssql_emulate_lateral_with_apply.rb +1 -0
- data/lib/sequel/extensions/named_timezones.rb +1 -0
- data/lib/sequel/extensions/null_dataset.rb +1 -0
- data/lib/sequel/extensions/pagination.rb +1 -0
- data/lib/sequel/extensions/pg_array.rb +2 -2
- data/lib/sequel/extensions/pg_array_ops.rb +1 -0
- data/lib/sequel/extensions/pg_enum.rb +1 -0
- data/lib/sequel/extensions/pg_hstore_ops.rb +1 -0
- data/lib/sequel/extensions/pg_json_ops.rb +1 -0
- data/lib/sequel/extensions/pg_loose_count.rb +1 -0
- data/lib/sequel/extensions/pg_range_ops.rb +1 -0
- data/lib/sequel/extensions/pg_row_ops.rb +1 -0
- data/lib/sequel/extensions/pg_static_cache_updater.rb +1 -0
- data/lib/sequel/extensions/pretty_table.rb +1 -0
- data/lib/sequel/extensions/query.rb +1 -0
- data/lib/sequel/extensions/query_literals.rb +1 -0
- data/lib/sequel/extensions/schema_caching.rb +1 -0
- data/lib/sequel/extensions/schema_dumper.rb +1 -1
- data/lib/sequel/extensions/select_remove.rb +1 -0
- data/lib/sequel/extensions/sequel_3_dataset_methods.rb +1 -0
- data/lib/sequel/extensions/server_block.rb +1 -0
- data/lib/sequel/extensions/set_overrides.rb +1 -0
- data/lib/sequel/extensions/split_array_nil.rb +1 -0
- data/lib/sequel/extensions/thread_local_timezones.rb +1 -0
- data/lib/sequel/extensions/to_dot.rb +1 -0
- data/lib/sequel/model/associations.rb +5 -5
- data/lib/sequel/model/base.rb +3 -3
- data/lib/sequel/plugins/association_proxies.rb +1 -1
- data/lib/sequel/plugins/caching.rb +8 -3
- data/lib/sequel/plugins/class_table_inheritance.rb +20 -11
- data/lib/sequel/plugins/composition.rb +18 -18
- data/lib/sequel/plugins/json_serializer.rb +3 -3
- data/lib/sequel/plugins/lazy_attributes.rb +23 -9
- data/lib/sequel/plugins/many_through_many.rb +21 -21
- data/lib/sequel/plugins/nested_attributes.rb +7 -3
- data/lib/sequel/plugins/pg_row.rb +1 -1
- data/lib/sequel/plugins/rcte_tree.rb +13 -13
- data/lib/sequel/plugins/sharding.rb +6 -6
- data/lib/sequel/plugins/timestamps.rb +4 -4
- data/lib/sequel/plugins/touch.rb +7 -7
- data/lib/sequel/plugins/tree.rb +1 -1
- data/lib/sequel/plugins/validation_class_methods.rb +36 -36
- data/lib/sequel/plugins/validation_helpers.rb +3 -4
- data/lib/sequel/plugins/xml_serializer.rb +29 -29
- data/lib/sequel/sql.rb +22 -11
- data/lib/sequel/version.rb +1 -1
- data/spec/adapters/postgres_spec.rb +10 -0
- data/spec/core/database_spec.rb +3 -4
- data/spec/core/dataset_spec.rb +16 -1
- data/spec/core/expression_filters_spec.rb +12 -0
- data/spec/core/object_graph_spec.rb +5 -0
- data/spec/core/placeholder_literalizer_spec.rb +8 -0
- data/spec/extensions/caching_spec.rb +18 -0
- data/spec/extensions/class_table_inheritance_spec.rb +34 -0
- data/spec/extensions/many_through_many_spec.rb +4 -0
- data/spec/extensions/nested_attributes_spec.rb +59 -4
- data/spec/extensions/pg_array_associations_spec.rb +5 -0
- data/spec/extensions/single_table_inheritance_spec.rb +23 -1
- data/spec/integration/plugin_test.rb +17 -0
- data/spec/model/eager_loading_spec.rb +8 -0
- metadata +4 -2
|
@@ -399,6 +399,11 @@ describe Sequel::Model, "pg_array_associations" do
|
|
|
399
399
|
@c2.association_join(:artists).sql.should == "SELECT * FROM tags INNER JOIN artists ON (artists.tag_ids @> ARRAY[tags.id])"
|
|
400
400
|
end
|
|
401
401
|
|
|
402
|
+
it "should support custom selects when using association_join" do
|
|
403
|
+
@c1.select{a(b)}.association_join(:tags).sql.should == "SELECT a(b) FROM artists INNER JOIN tags ON (artists.tag_ids @> ARRAY[tags.id])"
|
|
404
|
+
@c2.select{a(b)}.association_join(:artists).sql.should == "SELECT a(b) FROM tags INNER JOIN artists ON (artists.tag_ids @> ARRAY[tags.id])"
|
|
405
|
+
end
|
|
406
|
+
|
|
402
407
|
it "should eagerly graph associations" do
|
|
403
408
|
@c2.dataset._fetch = {:id=>2, :artists_id=>1, :tag_ids=>Sequel.pg_array([1,2,3])}
|
|
404
409
|
@c1.dataset._fetch = {:id=>1, :tags_id=>2, :tag_ids=>Sequel.pg_array([1,2,3])}
|
|
@@ -120,6 +120,29 @@ describe Sequel::Model, "single table inheritance plugin" do
|
|
|
120
120
|
StiTestSub1A.dataset.sql.should == "SELECT * FROM sti_tests WHERE (sti_tests.kind IN ('StiTestSub1A', 'StiTestSub1B'))"
|
|
121
121
|
StiTestSub1B.dataset.sql.should == "SELECT * FROM sti_tests WHERE (sti_tests.kind IN ('StiTestSub1B'))"
|
|
122
122
|
end
|
|
123
|
+
|
|
124
|
+
it "should work correctly with the :caching plugin" do
|
|
125
|
+
cache_class = Class.new(Hash) do
|
|
126
|
+
attr_accessor :ttl
|
|
127
|
+
def set(k, v, ttl); self[k] = v; @ttl = ttl; end
|
|
128
|
+
def get(k); self[k]; end
|
|
129
|
+
end
|
|
130
|
+
cache = cache_class.new
|
|
131
|
+
|
|
132
|
+
StiTest.plugin :caching, cache
|
|
133
|
+
def StiTest.cache_key_prefix; "stitest" end
|
|
134
|
+
c2 = Class.new StiTest
|
|
135
|
+
c2.cache_key(:id).should == StiTest.cache_key(:id)
|
|
136
|
+
|
|
137
|
+
obj2 = c2.new
|
|
138
|
+
obj2.values[:x] = 2
|
|
139
|
+
obj2.save
|
|
140
|
+
c2[obj2.id]
|
|
141
|
+
c2.cache_get_pk(obj2.id).values.should == StiTest.cache_get_pk(obj2.id).values
|
|
142
|
+
obj2.save
|
|
143
|
+
c2.cache_get_pk(obj2.id).should == nil
|
|
144
|
+
StiTest.cache_get_pk(obj2.id).should == nil
|
|
145
|
+
end
|
|
123
146
|
|
|
124
147
|
describe "with custom options" do
|
|
125
148
|
before do
|
|
@@ -249,6 +272,5 @@ describe Sequel::Model, "single table inheritance plugin" do
|
|
|
249
272
|
StiTest3.create.kind.should == 'stitest3'
|
|
250
273
|
StiTest4.create.kind.should == 'stitest4'
|
|
251
274
|
end
|
|
252
|
-
|
|
253
275
|
end
|
|
254
276
|
end
|
|
@@ -63,9 +63,26 @@ describe "Class Table Inheritance Plugin" do
|
|
|
63
63
|
end
|
|
64
64
|
|
|
65
65
|
specify "should lazily load columns in subclass tables" do
|
|
66
|
+
Employee[@i2][:manager_id].should == nil
|
|
67
|
+
Employee[@i2].manager_id.should == @i4
|
|
68
|
+
Employee[@i3][:num_staff].should == nil
|
|
69
|
+
Employee[@i3].num_staff.should == 7
|
|
70
|
+
Employee[@i4][:num_staff].should == nil
|
|
71
|
+
Employee[@i4].num_staff.should == 5
|
|
72
|
+
Employee[@i4][:num_managers].should == nil
|
|
73
|
+
Employee[@i4].num_managers.should == 6
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
specify "should eagerly load columns in subclass tables when retrieving multiple objects" do
|
|
66
77
|
a = Employee.order(:id).all
|
|
67
78
|
a[1][:manager_id].should == nil
|
|
68
79
|
a[1].manager_id.should == @i4
|
|
80
|
+
a[2][:num_staff].should == nil
|
|
81
|
+
a[2].num_staff.should == 7
|
|
82
|
+
a[3][:num_staff].should == 5 # eagerly loaded by previous call
|
|
83
|
+
a[3].num_staff.should == 5
|
|
84
|
+
a[3][:num_managers].should == nil
|
|
85
|
+
a[3].num_managers.should == 6
|
|
69
86
|
end
|
|
70
87
|
|
|
71
88
|
specify "should include schema for columns for tables for ancestor classes" do
|
|
@@ -1166,6 +1166,14 @@ describe Sequel::Model, "#eager_graph" do
|
|
|
1166
1166
|
GraphAlbum.association_join(:genre).sql.should == 'SELECT * FROM albums INNER JOIN ag ON (ag.album_id = albums.id) INNER JOIN genres AS genre ON (genre.id = ag.genre_id)'
|
|
1167
1167
|
end
|
|
1168
1168
|
|
|
1169
|
+
it "should handle custom selects when using association_join" do
|
|
1170
|
+
GraphAlbum.select{a(b)}.association_join(:band).sql.should == 'SELECT a(b) FROM albums INNER JOIN bands AS band ON (band.id = albums.band_id)'
|
|
1171
|
+
GraphAlbum.select{a(b)}.association_join(:track).sql.should == 'SELECT a(b) FROM albums INNER JOIN tracks AS track ON (track.album_id = albums.id)'
|
|
1172
|
+
GraphAlbum.select{a(b)}.association_join(:tracks).sql.should == 'SELECT a(b) FROM albums INNER JOIN tracks ON (tracks.album_id = albums.id)'
|
|
1173
|
+
GraphAlbum.select{a(b)}.association_join(:genres).sql.should == 'SELECT a(b) FROM albums INNER JOIN ag ON (ag.album_id = albums.id) INNER JOIN genres ON (genres.id = ag.genre_id)'
|
|
1174
|
+
GraphAlbum.select{a(b)}.association_join(:genre).sql.should == 'SELECT a(b) FROM albums INNER JOIN ag ON (ag.album_id = albums.id) INNER JOIN genres AS genre ON (genre.id = ag.genre_id)'
|
|
1175
|
+
end
|
|
1176
|
+
|
|
1169
1177
|
it "should set up correct join types when using association_*_join" do
|
|
1170
1178
|
GraphAlbum.association_inner_join(:band).sql.should == 'SELECT * FROM albums INNER JOIN bands AS band ON (band.id = albums.band_id)'
|
|
1171
1179
|
GraphAlbum.association_left_join(:track).sql.should == 'SELECT * FROM albums LEFT JOIN tracks AS track ON (track.album_id = albums.id)'
|
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.14.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: 2014-
|
|
11
|
+
date: 2014-09-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: The Database Toolkit for Ruby
|
|
14
14
|
email: code@jeremyevans.net
|
|
@@ -130,6 +130,7 @@ extra_rdoc_files:
|
|
|
130
130
|
- doc/release_notes/4.11.0.txt
|
|
131
131
|
- doc/release_notes/4.12.0.txt
|
|
132
132
|
- doc/release_notes/4.13.0.txt
|
|
133
|
+
- doc/release_notes/4.14.0.txt
|
|
133
134
|
files:
|
|
134
135
|
- CHANGELOG
|
|
135
136
|
- MIT-LICENSE
|
|
@@ -230,6 +231,7 @@ files:
|
|
|
230
231
|
- doc/release_notes/4.11.0.txt
|
|
231
232
|
- doc/release_notes/4.12.0.txt
|
|
232
233
|
- doc/release_notes/4.13.0.txt
|
|
234
|
+
- doc/release_notes/4.14.0.txt
|
|
233
235
|
- doc/release_notes/4.2.0.txt
|
|
234
236
|
- doc/release_notes/4.3.0.txt
|
|
235
237
|
- doc/release_notes/4.4.0.txt
|