sequel 5.106.0 → 5.108.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/bin/sequel +5 -5
- data/lib/sequel/adapters/ado.rb +1 -1
- data/lib/sequel/adapters/ibmdb.rb +2 -2
- data/lib/sequel/adapters/jdbc/hsqldb.rb +1 -1
- data/lib/sequel/adapters/jdbc/mysql.rb +1 -1
- data/lib/sequel/adapters/jdbc.rb +2 -2
- data/lib/sequel/adapters/mock.rb +1 -1
- data/lib/sequel/adapters/mysql.rb +7 -2
- data/lib/sequel/adapters/mysql2.rb +5 -4
- data/lib/sequel/adapters/postgres.rb +37 -37
- data/lib/sequel/adapters/shared/db2.rb +2 -2
- data/lib/sequel/adapters/shared/mssql.rb +4 -4
- data/lib/sequel/adapters/shared/mysql.rb +2 -2
- data/lib/sequel/adapters/shared/postgres.rb +997 -38
- data/lib/sequel/adapters/shared/sqlite.rb +8 -7
- data/lib/sequel/adapters/utils/emulate_offset_with_reverse_and_count.rb +1 -1
- data/lib/sequel/adapters/utils/mysql_mysql2.rb +11 -1
- data/lib/sequel/connection_pool/sharded_single.rb +1 -1
- data/lib/sequel/connection_pool/sharded_threaded.rb +7 -5
- data/lib/sequel/connection_pool/sharded_timed_queue.rb +3 -3
- data/lib/sequel/connection_pool/threaded.rb +9 -7
- data/lib/sequel/connection_pool/timed_queue.rb +2 -2
- data/lib/sequel/connection_pool.rb +3 -3
- data/lib/sequel/core.rb +30 -22
- data/lib/sequel/database/connecting.rb +1 -1
- data/lib/sequel/database/features.rb +1 -1
- data/lib/sequel/database/misc.rb +7 -7
- data/lib/sequel/database/query.rb +2 -2
- data/lib/sequel/database/schema_generator.rb +7 -5
- data/lib/sequel/database/schema_methods.rb +2 -2
- data/lib/sequel/database/transactions.rb +4 -4
- data/lib/sequel/dataset/actions.rb +1 -1
- data/lib/sequel/dataset/features.rb +4 -4
- data/lib/sequel/dataset/graph.rb +1 -1
- data/lib/sequel/dataset/misc.rb +3 -3
- data/lib/sequel/dataset/prepared_statements.rb +2 -2
- data/lib/sequel/dataset/query.rb +8 -8
- data/lib/sequel/dataset/sql.rb +18 -10
- data/lib/sequel/dataset.rb +2 -2
- data/lib/sequel/deprecated.rb +2 -2
- data/lib/sequel/exceptions.rb +2 -2
- data/lib/sequel/extensions/_pretty_table.rb +1 -1
- data/lib/sequel/extensions/async_thread_pool.rb +3 -3
- data/lib/sequel/extensions/auto_cast_date_and_time.rb +2 -2
- data/lib/sequel/extensions/blank.rb +2 -2
- data/lib/sequel/extensions/constraint_validations.rb +1 -1
- data/lib/sequel/extensions/core_refinements.rb +8 -8
- data/lib/sequel/extensions/date_arithmetic.rb +1 -1
- data/lib/sequel/extensions/datetime_parse_to_time.rb +2 -2
- data/lib/sequel/extensions/duplicate_columns_handler.rb +2 -2
- data/lib/sequel/extensions/graph_each.rb +1 -1
- data/lib/sequel/extensions/index_caching.rb +1 -1
- data/lib/sequel/extensions/inflector.rb +5 -5
- data/lib/sequel/extensions/is_distinct_from.rb +2 -2
- data/lib/sequel/extensions/lit_require_frozen.rb +3 -3
- data/lib/sequel/extensions/migration.rb +21 -7
- data/lib/sequel/extensions/named_timezones.rb +8 -8
- data/lib/sequel/extensions/pg_array.rb +9 -8
- data/lib/sequel/extensions/pg_array_ops.rb +69 -14
- data/lib/sequel/extensions/pg_auto_parameterize.rb +2 -2
- data/lib/sequel/extensions/pg_auto_parameterize_in_array.rb +3 -3
- data/lib/sequel/extensions/pg_enum.rb +2 -2
- data/lib/sequel/extensions/pg_extended_date_support.rb +5 -5
- data/lib/sequel/extensions/pg_extended_integer_support.rb +1 -1
- data/lib/sequel/extensions/pg_hstore.rb +2 -2
- data/lib/sequel/extensions/pg_hstore_ops.rb +5 -5
- data/lib/sequel/extensions/pg_inet.rb +2 -2
- data/lib/sequel/extensions/pg_inet_ops.rb +2 -2
- data/lib/sequel/extensions/pg_interval.rb +6 -6
- data/lib/sequel/extensions/pg_json.rb +4 -4
- data/lib/sequel/extensions/pg_json_ops.rb +11 -11
- data/lib/sequel/extensions/pg_range.rb +6 -6
- data/lib/sequel/extensions/pg_range_ops.rb +7 -7
- data/lib/sequel/extensions/pg_row.rb +4 -4
- data/lib/sequel/extensions/pg_row_ops.rb +6 -6
- data/lib/sequel/extensions/provenance.rb +2 -2
- data/lib/sequel/extensions/query.rb +2 -2
- data/lib/sequel/extensions/s.rb +2 -2
- data/lib/sequel/extensions/schema_dumper.rb +4 -4
- data/lib/sequel/extensions/sequel_4_dataset_methods.rb +2 -0
- data/lib/sequel/extensions/sql_comments.rb +1 -1
- data/lib/sequel/extensions/sql_log_normalizer.rb +1 -1
- data/lib/sequel/extensions/sqlite_json_ops.rb +2 -2
- data/lib/sequel/extensions/string_agg.rb +5 -5
- data/lib/sequel/extensions/symbol_aref.rb +3 -3
- data/lib/sequel/extensions/symbol_aref_refinement.rb +3 -3
- data/lib/sequel/extensions/symbol_as_refinement.rb +2 -2
- data/lib/sequel/extensions/transaction_connection_validator.rb +1 -1
- data/lib/sequel/model/associations.rb +17 -17
- data/lib/sequel/model/base.rb +19 -11
- data/lib/sequel/model/inflections.rb +1 -1
- data/lib/sequel/model/plugins.rb +2 -2
- data/lib/sequel/model.rb +2 -2
- data/lib/sequel/plugins/association_pks.rb +1 -1
- data/lib/sequel/plugins/association_proxies.rb +4 -4
- data/lib/sequel/plugins/auto_restrict_eager_graph.rb +2 -0
- data/lib/sequel/plugins/caching.rb +1 -1
- data/lib/sequel/plugins/class_table_inheritance.rb +1 -1
- data/lib/sequel/plugins/column_encryption.rb +10 -10
- data/lib/sequel/plugins/concurrent_eager_loading.rb +2 -2
- data/lib/sequel/plugins/csv_serializer.rb +2 -2
- data/lib/sequel/plugins/deprecated_associations.rb +2 -2
- data/lib/sequel/plugins/eager_each.rb +1 -1
- data/lib/sequel/plugins/finder.rb +1 -1
- data/lib/sequel/plugins/forbid_lazy_load.rb +3 -3
- data/lib/sequel/plugins/insert_conflict.rb +1 -1
- data/lib/sequel/plugins/insert_returning_select.rb +1 -1
- data/lib/sequel/plugins/json_serializer.rb +4 -4
- data/lib/sequel/plugins/lazy_attributes.rb +1 -1
- data/lib/sequel/plugins/many_through_many.rb +1 -1
- data/lib/sequel/plugins/pg_array_associations.rb +4 -4
- data/lib/sequel/plugins/pg_auto_constraint_validations.rb +3 -3
- data/lib/sequel/plugins/pg_eager_any_typed_array.rb +2 -2
- data/lib/sequel/plugins/prepared_statements.rb +2 -2
- data/lib/sequel/plugins/serialization.rb +1 -1
- data/lib/sequel/plugins/sharding.rb +1 -1
- data/lib/sequel/plugins/single_table_inheritance.rb +1 -1
- data/lib/sequel/plugins/skip_saving_columns.rb +2 -2
- data/lib/sequel/plugins/split_values.rb +1 -1
- data/lib/sequel/plugins/sql_comments.rb +8 -8
- data/lib/sequel/plugins/subclasses.rb +6 -6
- data/lib/sequel/plugins/subset_conditions.rb +2 -2
- data/lib/sequel/plugins/tactical_eager_loading.rb +1 -1
- data/lib/sequel/plugins/throw_failures.rb +2 -2
- data/lib/sequel/plugins/unused_associations.rb +5 -5
- data/lib/sequel/plugins/validation_helpers.rb +1 -1
- data/lib/sequel/plugins/xml_serializer.rb +2 -0
- data/lib/sequel/sql.rb +11 -11
- data/lib/sequel/version.rb +1 -1
- metadata +2 -2
|
@@ -237,7 +237,7 @@ module Sequel
|
|
|
237
237
|
end
|
|
238
238
|
end
|
|
239
239
|
|
|
240
|
-
# Clear any finders when
|
|
240
|
+
# Clear any finders when resetting the instance dataset
|
|
241
241
|
def reset_instance_dataset
|
|
242
242
|
Sequel.synchronize{@finders.clear} if @finders && !@finders.frozen?
|
|
243
243
|
super
|
|
@@ -9,7 +9,7 @@ module Sequel
|
|
|
9
9
|
# The main reason for doing this is it makes it easier to detect
|
|
10
10
|
# N+1 query issues. Note that Sequel also offers a
|
|
11
11
|
# tactical_eager_loading plugin which will automatically eagerly
|
|
12
|
-
# load associations for all objects
|
|
12
|
+
# load associations for all objects retrieved in the same query
|
|
13
13
|
# if any object would attempt to lazily load an association. That
|
|
14
14
|
# approach may be simpler if you are trying to prevent N+1 issues,
|
|
15
15
|
# though it does retain more objects in memory.
|
|
@@ -125,9 +125,9 @@ module Sequel
|
|
|
125
125
|
# an association, allow lazy loading that association, since the
|
|
126
126
|
# lazy association load will use a hash table lookup and not a query.
|
|
127
127
|
def allow_lazy_load_for_static_cache_associations
|
|
128
|
-
# :
|
|
128
|
+
# simplecov:disable
|
|
129
129
|
if defined?(::Sequel::Plugins::StaticCache::ClassMethods)
|
|
130
|
-
# :
|
|
130
|
+
# simplecov:enable
|
|
131
131
|
@association_reflections.each_value do |ref|
|
|
132
132
|
if ref.associated_class.is_a?(::Sequel::Plugins::StaticCache::ClassMethods)
|
|
133
133
|
ref[:forbid_lazy_load] = false
|
|
@@ -19,7 +19,7 @@ module Sequel
|
|
|
19
19
|
#
|
|
20
20
|
# This example will try to insert the album, but if there is an existing
|
|
21
21
|
# album with the name 'Foo', this will update the copies_sold attribute
|
|
22
|
-
# for that album. See the PostgreSQL and SQLite adapter
|
|
22
|
+
# for that album. See the PostgreSQL and SQLite adapter documentation for
|
|
23
23
|
# the options you can pass to the insert_conflict method.
|
|
24
24
|
#
|
|
25
25
|
# You should not attempt to use this plugin to ignore conflicts when
|
|
@@ -32,7 +32,7 @@ module Sequel
|
|
|
32
32
|
|
|
33
33
|
private
|
|
34
34
|
|
|
35
|
-
# When
|
|
35
|
+
# When resetting the instance dataset, also reset the instance_insert_dataset.
|
|
36
36
|
def reset_instance_dataset
|
|
37
37
|
ret = super
|
|
38
38
|
return unless ds = @instance_dataset
|
|
@@ -128,7 +128,7 @@ module Sequel
|
|
|
128
128
|
end
|
|
129
129
|
|
|
130
130
|
# SEQUEL6: Remove
|
|
131
|
-
# :
|
|
131
|
+
# simplecov:disable
|
|
132
132
|
class Literal
|
|
133
133
|
def initialize(json)
|
|
134
134
|
@json = json
|
|
@@ -138,7 +138,7 @@ module Sequel
|
|
|
138
138
|
@json
|
|
139
139
|
end
|
|
140
140
|
end
|
|
141
|
-
# :
|
|
141
|
+
# simplecov:enable
|
|
142
142
|
Sequel::Deprecation.deprecate_constant(self, :Literal)
|
|
143
143
|
|
|
144
144
|
# Convert the given object to a JSON data structure using the given arguments.
|
|
@@ -151,11 +151,11 @@ module Sequel
|
|
|
151
151
|
else
|
|
152
152
|
begin
|
|
153
153
|
Sequel.parse_json(Sequel.object_to_json(obj, *args, &block))
|
|
154
|
-
# :
|
|
154
|
+
# simplecov:disable
|
|
155
155
|
rescue Sequel.json_parser_error_class
|
|
156
156
|
# Support for old Ruby code that only supports parsing JSON object/array
|
|
157
157
|
Sequel.parse_json(Sequel.object_to_json([obj], *args, &block))[0]
|
|
158
|
-
# :
|
|
158
|
+
# simplecov:enable
|
|
159
159
|
end
|
|
160
160
|
end
|
|
161
161
|
end
|
|
@@ -5,7 +5,7 @@ module Sequel
|
|
|
5
5
|
# The lazy_attributes plugin allows users to easily set that some attributes
|
|
6
6
|
# should not be loaded by default when loading model objects. If the attribute
|
|
7
7
|
# is needed after the instance has been retrieved, a database query is made to
|
|
8
|
-
#
|
|
8
|
+
# retrieve the value of the attribute.
|
|
9
9
|
#
|
|
10
10
|
# This plugin depends on the tactical_eager_loading plugin, and allows you to
|
|
11
11
|
# eagerly load lazy attributes for all objects retrieved with the current object.
|
|
@@ -243,7 +243,7 @@ module Sequel
|
|
|
243
243
|
# :conditions :: Extra conditions to add to the JOIN ON clause. Must be a hash or array of two pairs.
|
|
244
244
|
# :join_type :: The join type to use for the join, defaults to :left_outer.
|
|
245
245
|
# :only_conditions :: Conditions to use for the join instead of the ones specified by the keys.
|
|
246
|
-
# opts :: The options for the
|
|
246
|
+
# opts :: The options for the association. Takes the same options as many_to_many.
|
|
247
247
|
def many_through_many(name, through, opts=OPTS, &block)
|
|
248
248
|
associate(:many_through_many, name, opts.merge(through.is_a?(Hash) ? through : {:through=>through}), &block)
|
|
249
249
|
end
|
|
@@ -534,9 +534,9 @@ module Sequel
|
|
|
534
534
|
def many_to_pg_array_association_filter_expression(op, ref, obj)
|
|
535
535
|
pk = ref.qualify(model.table_name, ref.primary_key)
|
|
536
536
|
key = ref[:key]
|
|
537
|
-
# :
|
|
537
|
+
# simplecov:disable
|
|
538
538
|
expr = case obj
|
|
539
|
-
# :
|
|
539
|
+
# simplecov:enable
|
|
540
540
|
when Sequel::Model
|
|
541
541
|
if (assoc_pks = obj.get_column_value(key)) && !assoc_pks.empty?
|
|
542
542
|
Sequel[pk=>assoc_pks.to_a]
|
|
@@ -556,9 +556,9 @@ module Sequel
|
|
|
556
556
|
# Support filtering by pg_array_to_many associations using a subquery.
|
|
557
557
|
def pg_array_to_many_association_filter_expression(op, ref, obj)
|
|
558
558
|
key = ref.qualify(model.table_name, ref[:key_column])
|
|
559
|
-
# :
|
|
559
|
+
# simplecov:disable
|
|
560
560
|
expr = case obj
|
|
561
|
-
# :
|
|
561
|
+
# simplecov:enable
|
|
562
562
|
when Sequel::Model
|
|
563
563
|
if pkv = obj.get_column_value(ref.primary_key_method)
|
|
564
564
|
Sequel.pg_array_op(key).contains(Sequel.pg_array([pkv], ref.array_type))
|
|
@@ -261,9 +261,9 @@ module Sequel
|
|
|
261
261
|
messages = model.pg_auto_constraint_validations_messages
|
|
262
262
|
|
|
263
263
|
unless override
|
|
264
|
-
# :
|
|
264
|
+
# simplecov:disable
|
|
265
265
|
case e
|
|
266
|
-
# :
|
|
266
|
+
# simplecov:enable
|
|
267
267
|
when Sequel::NotNullConstraintViolation
|
|
268
268
|
if column = info[:column]
|
|
269
269
|
add_pg_constraint_validation_error([m.call(column)], messages[:not_null])
|
|
@@ -297,7 +297,7 @@ module Sequel
|
|
|
297
297
|
end
|
|
298
298
|
end
|
|
299
299
|
rescue
|
|
300
|
-
# If there is an error trying to
|
|
300
|
+
# If there is an error trying to convert the constraint violation
|
|
301
301
|
# into a validation failure, it's best to just raise the constraint
|
|
302
302
|
# violation. This can make debugging the above block of code more
|
|
303
303
|
# difficult.
|
|
@@ -45,7 +45,7 @@ module Sequel
|
|
|
45
45
|
key = key.column
|
|
46
46
|
end
|
|
47
47
|
|
|
48
|
-
# :
|
|
48
|
+
# simplecov:disable
|
|
49
49
|
# many_to_pg_array association type does not need changes, as it
|
|
50
50
|
# already converts the values to a typed postgres array, it does
|
|
51
51
|
# not call the code that uses :eager_loading_predicate_transform.
|
|
@@ -54,7 +54,7 @@ module Sequel
|
|
|
54
54
|
# unless it is one of these types, but external association types
|
|
55
55
|
# could potentially reach it.
|
|
56
56
|
sch = case ref[:type]
|
|
57
|
-
# :
|
|
57
|
+
# simplecov:enable
|
|
58
58
|
when :many_to_one, :one_to_one, :one_to_many, :pg_array_to_many
|
|
59
59
|
ref.associated_class.db_schema
|
|
60
60
|
when :many_to_many, :one_through_one
|
|
@@ -181,11 +181,11 @@ module Sequel
|
|
|
181
181
|
# Disabling usage of prepared statements for insert_select on SQLite seems to be the
|
|
182
182
|
# simplest way to workaround the problem.
|
|
183
183
|
db.database_type != :sqlite
|
|
184
|
-
# :
|
|
184
|
+
# simplecov:disable
|
|
185
185
|
when :delete, :refresh
|
|
186
186
|
Sequel::Deprecation.deprecate("The :delete and :refresh prepared statement types", "There should be no need to check if these types are supported")
|
|
187
187
|
false
|
|
188
|
-
# :
|
|
188
|
+
# simplecov:enable
|
|
189
189
|
else
|
|
190
190
|
raise Error, "unsupported type used: #{type.inspect}"
|
|
191
191
|
end
|
|
@@ -154,7 +154,7 @@ module Sequel
|
|
|
154
154
|
|
|
155
155
|
private
|
|
156
156
|
|
|
157
|
-
# Add serializated attribute
|
|
157
|
+
# Add serializated attribute accessor methods to the serialization_module
|
|
158
158
|
def define_serialized_attribute_accessor(serializer, deserializer, *columns)
|
|
159
159
|
m = self
|
|
160
160
|
include(@serialization_module ||= Sequel.set_temp_name(Module.new){"#{name}::@serialization_module"}) unless @serialization_module
|
|
@@ -6,7 +6,7 @@ module Sequel
|
|
|
6
6
|
# in the following ways:
|
|
7
7
|
#
|
|
8
8
|
# * It automatically saves model instances back to the
|
|
9
|
-
# shard they were
|
|
9
|
+
# shard they were retrieved from.
|
|
10
10
|
# * It makes model associations use the same shard as the model object.
|
|
11
11
|
# * It adds a slightly nicer API for creating model instances on
|
|
12
12
|
# specific shards.
|
|
@@ -194,7 +194,7 @@ module Sequel
|
|
|
194
194
|
end
|
|
195
195
|
|
|
196
196
|
# Copy the necessary attributes to the subclasses, and filter the
|
|
197
|
-
# subclass's dataset based on the
|
|
197
|
+
# subclass's dataset based on the sti_key_map entry for the class.
|
|
198
198
|
def inherited(subclass)
|
|
199
199
|
super
|
|
200
200
|
key = Array(sti_key_map[subclass]).dup
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
module Sequel
|
|
4
4
|
module Plugins
|
|
5
|
-
# The
|
|
5
|
+
# The skip_saving_columns plugin allows skipping specific columns when
|
|
6
6
|
# saving. By default, it skips columns that the database schema
|
|
7
7
|
# indicates are generated columns:
|
|
8
8
|
#
|
|
@@ -90,7 +90,7 @@ module Sequel
|
|
|
90
90
|
|
|
91
91
|
# Skip the columns the model has marked to skip when updating
|
|
92
92
|
# only changed columns.
|
|
93
|
-
def
|
|
93
|
+
def _save_update_changed_columns_hash
|
|
94
94
|
_save_removed_skipped_columns(super)
|
|
95
95
|
end
|
|
96
96
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
module Sequel
|
|
4
4
|
module Plugins
|
|
5
|
-
# The split_values plugin splits the values hash
|
|
5
|
+
# The split_values plugin splits the values hash retrieved from the
|
|
6
6
|
# database, and moves keys from the values hash that are not columns
|
|
7
7
|
# in the model's dataset to a separate hash. This makes it so the
|
|
8
8
|
# values hash only stores columns from the model's dataset.
|
|
@@ -63,9 +63,9 @@ module Sequel
|
|
|
63
63
|
super(*a, &block)
|
|
64
64
|
end
|
|
65
65
|
end
|
|
66
|
-
# :
|
|
66
|
+
# simplecov:disable
|
|
67
67
|
mod.send(:ruby2_keywords, meth) if mod.respond_to?(:ruby2_keywords, true)
|
|
68
|
-
# :
|
|
68
|
+
# simplecov:enable
|
|
69
69
|
end
|
|
70
70
|
|
|
71
71
|
def self.apply(model)
|
|
@@ -101,9 +101,9 @@ module Sequel
|
|
|
101
101
|
super(*a, &block)
|
|
102
102
|
end
|
|
103
103
|
end
|
|
104
|
-
# :
|
|
104
|
+
# simplecov:disable
|
|
105
105
|
ruby2_keywords(meth) if respond_to?(:ruby2_keywords, true)
|
|
106
|
-
# :
|
|
106
|
+
# simplecov:enable
|
|
107
107
|
end
|
|
108
108
|
|
|
109
109
|
private
|
|
@@ -133,9 +133,9 @@ module Sequel
|
|
|
133
133
|
super(*a, &block)
|
|
134
134
|
end
|
|
135
135
|
end
|
|
136
|
-
# :
|
|
136
|
+
# simplecov:disable
|
|
137
137
|
ruby2_keywords(meth) if respond_to?(:ruby2_keywords, true)
|
|
138
|
-
# :
|
|
138
|
+
# simplecov:enable
|
|
139
139
|
end
|
|
140
140
|
|
|
141
141
|
private
|
|
@@ -163,9 +163,9 @@ module Sequel
|
|
|
163
163
|
super(*a, &block)
|
|
164
164
|
end
|
|
165
165
|
end
|
|
166
|
-
# :
|
|
166
|
+
# simplecov:disable
|
|
167
167
|
ruby2_keywords(meth) if respond_to?(:ruby2_keywords, true)
|
|
168
|
-
# :
|
|
168
|
+
# simplecov:enable
|
|
169
169
|
end
|
|
170
170
|
|
|
171
171
|
private
|
|
@@ -40,9 +40,9 @@ module Sequel
|
|
|
40
40
|
|
|
41
41
|
# Initialize the subclasses instance variable for the model.
|
|
42
42
|
def self.apply(model, &block)
|
|
43
|
-
# :
|
|
43
|
+
# simplecov:disable
|
|
44
44
|
model.instance_variable_set(:@subclasses, []) if NEED_SUBCLASSES
|
|
45
|
-
# :
|
|
45
|
+
# simplecov:enable
|
|
46
46
|
model.instance_variable_set(:@on_subclass, block)
|
|
47
47
|
end
|
|
48
48
|
|
|
@@ -51,13 +51,13 @@ module Sequel
|
|
|
51
51
|
# class created.
|
|
52
52
|
attr_reader :on_subclass
|
|
53
53
|
|
|
54
|
-
# :
|
|
54
|
+
# simplecov:disable
|
|
55
55
|
if NEED_SUBCLASSES
|
|
56
56
|
# All subclasses for the current model. Does not
|
|
57
57
|
# include the model itself.
|
|
58
58
|
attr_reader :subclasses
|
|
59
59
|
end
|
|
60
|
-
# :
|
|
60
|
+
# simplecov:enable
|
|
61
61
|
|
|
62
62
|
# All descendent classes of this model.
|
|
63
63
|
def descendants
|
|
@@ -85,9 +85,9 @@ module Sequel
|
|
|
85
85
|
# in the subclass.
|
|
86
86
|
def inherited(subclass)
|
|
87
87
|
super
|
|
88
|
-
# :
|
|
88
|
+
# simplecov:disable
|
|
89
89
|
Sequel.synchronize{subclasses << subclass} if NEED_SUBCLASSES
|
|
90
|
-
# :
|
|
90
|
+
# simplecov:enable
|
|
91
91
|
on_subclass.call(subclass) if on_subclass
|
|
92
92
|
end
|
|
93
93
|
end
|
|
@@ -114,13 +114,13 @@ module Sequel
|
|
|
114
114
|
end
|
|
115
115
|
else
|
|
116
116
|
# Cannot bind module method to arbitrary objects in Ruby 1.9.
|
|
117
|
-
# :
|
|
117
|
+
# simplecov:disable
|
|
118
118
|
def _where_any_all(meth, name, args)
|
|
119
119
|
ds = model.dataset.clone
|
|
120
120
|
ds.extend(self)
|
|
121
121
|
where(name, Sequel.send(meth, *args.map{|a| ds.send(:"#{a}_conditions")}))
|
|
122
122
|
end
|
|
123
|
-
# :
|
|
123
|
+
# simplecov:enable
|
|
124
124
|
end
|
|
125
125
|
end
|
|
126
126
|
end
|
|
@@ -162,7 +162,7 @@ module Sequel
|
|
|
162
162
|
end
|
|
163
163
|
|
|
164
164
|
# Filter the objects used when tactical eager loading.
|
|
165
|
-
# By default, this removes frozen objects and objects that
|
|
165
|
+
# By default, this removes frozen objects and objects that already have the association loaded,
|
|
166
166
|
# as well as objects where the reflection for the association is not the same as the receiver's
|
|
167
167
|
# reflection for the association.
|
|
168
168
|
def _filter_tactical_eager_load_objects(opts)
|
|
@@ -86,7 +86,7 @@ module Sequel
|
|
|
86
86
|
# UncaughtThrowError was added in Ruby 2.2. Older Ruby versions
|
|
87
87
|
# used ArgumentError with "uncaught throw" at the start of the message
|
|
88
88
|
|
|
89
|
-
# :
|
|
89
|
+
# simplecov:disable
|
|
90
90
|
def hook_failed_error(msg)
|
|
91
91
|
e = super
|
|
92
92
|
throw HookFailed, e
|
|
@@ -102,7 +102,7 @@ module Sequel
|
|
|
102
102
|
raise e2 unless e2.message.start_with?('uncaught throw')
|
|
103
103
|
e
|
|
104
104
|
end
|
|
105
|
-
# :
|
|
105
|
+
# simplecov:enable
|
|
106
106
|
end
|
|
107
107
|
end
|
|
108
108
|
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen-string-literal: true
|
|
2
2
|
|
|
3
|
-
# :
|
|
3
|
+
# simplecov:disable
|
|
4
4
|
|
|
5
5
|
# This entire file is excluded from coverage testing. This is because it
|
|
6
6
|
# requires coverage testing to work, and if you've already loaded Sequel
|
|
@@ -67,7 +67,7 @@ module Sequel
|
|
|
67
67
|
#
|
|
68
68
|
# You can use the output of the +unused_associations+ method to determine
|
|
69
69
|
# which associations are not used at all in your application, and can
|
|
70
|
-
# be
|
|
70
|
+
# be eliminated.
|
|
71
71
|
#
|
|
72
72
|
# You can also take that unused association data and pass it to the
|
|
73
73
|
# +unused_association_options+ method, which will return an array of
|
|
@@ -131,7 +131,7 @@ module Sequel
|
|
|
131
131
|
# = Automatic Usage of Unused Association Data
|
|
132
132
|
#
|
|
133
133
|
# Since it can be a pain to manually update all of your code
|
|
134
|
-
# to remove unused
|
|
134
|
+
# to remove unused associations or add options to prevent the
|
|
135
135
|
# definition of unused associations, the unused_associations
|
|
136
136
|
# plugin comes with support to take previously saved unused
|
|
137
137
|
# association data, and use it to not create unused associations,
|
|
@@ -265,7 +265,7 @@ module Sequel
|
|
|
265
265
|
module ClassMethods
|
|
266
266
|
# Only the data is copied to subclasses, to allow the :modify_associations
|
|
267
267
|
# plugin option to affect them. The :file and :coverage_file are not copied
|
|
268
|
-
# to subclasses, as users are expected
|
|
268
|
+
# to subclasses, as users are expected to call methods such as
|
|
269
269
|
# unused_associations only on the class that is loading the plugin.
|
|
270
270
|
Plugins.inherited_instance_variables(self, :@unused_associations_data=>nil)
|
|
271
271
|
|
|
@@ -526,4 +526,4 @@ module Sequel
|
|
|
526
526
|
end
|
|
527
527
|
end
|
|
528
528
|
end
|
|
529
|
-
# :
|
|
529
|
+
# simplecov:enable
|
|
@@ -39,7 +39,7 @@ module Sequel
|
|
|
39
39
|
# :skip_invalid :: Do not try to validate columns that are already invalid.
|
|
40
40
|
#
|
|
41
41
|
# The default validation options for all models can be modified by
|
|
42
|
-
#
|
|
42
|
+
# overriding the Model#default_validation_helpers_options private method.
|
|
43
43
|
# By changing the default options, you can setup internationalization of the
|
|
44
44
|
# error messages. For example, you would modify the default options:
|
|
45
45
|
#
|
data/lib/sequel/sql.rb
CHANGED
|
@@ -371,7 +371,7 @@ module Sequel
|
|
|
371
371
|
SQL::CaseExpression.new(*args)
|
|
372
372
|
end
|
|
373
373
|
|
|
374
|
-
# Cast the
|
|
374
|
+
# Cast the receiver to the given SQL type. You can specify a ruby class as a type,
|
|
375
375
|
# and it is handled similarly to using a database independent type in the schema methods.
|
|
376
376
|
#
|
|
377
377
|
# Sequel.cast(:a, :integer) # CAST(a AS integer)
|
|
@@ -380,7 +380,7 @@ module Sequel
|
|
|
380
380
|
SQL::Cast.new(arg, sql_type)
|
|
381
381
|
end
|
|
382
382
|
|
|
383
|
-
# Cast the
|
|
383
|
+
# Cast the receiver to the given SQL type (or the database's default Integer type if none given),
|
|
384
384
|
# and return the result as a +NumericExpression+, so you can use the bitwise operators
|
|
385
385
|
# on the result.
|
|
386
386
|
#
|
|
@@ -390,7 +390,7 @@ module Sequel
|
|
|
390
390
|
cast(arg, sql_type || Integer).sql_number
|
|
391
391
|
end
|
|
392
392
|
|
|
393
|
-
# Cast the
|
|
393
|
+
# Cast the receiver to the given SQL type (or the database's default String type if none given),
|
|
394
394
|
# and return the result as a +StringExpression+, so you can use +
|
|
395
395
|
# directly on the result for SQL string concatenation.
|
|
396
396
|
#
|
|
@@ -687,7 +687,7 @@ module Sequel
|
|
|
687
687
|
|
|
688
688
|
# Holds methods that are used to cast objects to different SQL types.
|
|
689
689
|
module CastMethods
|
|
690
|
-
# Cast the
|
|
690
|
+
# Cast the receiver to the given SQL type. You can specify a ruby class as a type,
|
|
691
691
|
# and it is handled similarly to using a database independent type in the schema methods.
|
|
692
692
|
#
|
|
693
693
|
# Sequel.function(:func).cast(:integer) # CAST(func() AS integer)
|
|
@@ -696,7 +696,7 @@ module Sequel
|
|
|
696
696
|
Cast.new(self, sql_type)
|
|
697
697
|
end
|
|
698
698
|
|
|
699
|
-
# Cast the
|
|
699
|
+
# Cast the receiver to the given SQL type (or the database's default Integer type if none given),
|
|
700
700
|
# and return the result as a +NumericExpression+, so you can use the bitwise operators
|
|
701
701
|
# on the result.
|
|
702
702
|
#
|
|
@@ -706,7 +706,7 @@ module Sequel
|
|
|
706
706
|
Cast.new(self, sql_type || Integer).sql_number
|
|
707
707
|
end
|
|
708
708
|
|
|
709
|
-
# Cast the
|
|
709
|
+
# Cast the receiver to the given SQL type (or the database's default String type if none given),
|
|
710
710
|
# and return the result as a +StringExpression+, so you can use +
|
|
711
711
|
# directly on the result for SQL string concatenation.
|
|
712
712
|
#
|
|
@@ -1620,13 +1620,13 @@ module Sequel
|
|
|
1620
1620
|
# of strings, where each arg in args goes between the string elements.
|
|
1621
1621
|
attr_reader :str
|
|
1622
1622
|
|
|
1623
|
-
# The arguments that will be
|
|
1623
|
+
# The arguments that will be substituted into the placeholders.
|
|
1624
1624
|
# Either an array of unnamed placeholders (which will be substituted in
|
|
1625
1625
|
# order for ? characters), or a hash of named placeholders (which will be
|
|
1626
1626
|
# substituted for :key phrases).
|
|
1627
1627
|
attr_reader :args
|
|
1628
1628
|
|
|
1629
|
-
# Whether to surround the expression with
|
|
1629
|
+
# Whether to surround the expression with parentheses
|
|
1630
1630
|
attr_reader :parens
|
|
1631
1631
|
|
|
1632
1632
|
# Create an object with the given string, placeholder arguments, and parens flag.
|
|
@@ -1637,7 +1637,7 @@ module Sequel
|
|
|
1637
1637
|
freeze
|
|
1638
1638
|
end
|
|
1639
1639
|
|
|
1640
|
-
# Return a copy of the that will be surrounded by
|
|
1640
|
+
# Return a copy of the that will be surrounded by parentheses.
|
|
1641
1641
|
def with_parens
|
|
1642
1642
|
@parens ? self : self.class.new(@str, @args, true)
|
|
1643
1643
|
end
|
|
@@ -1749,11 +1749,11 @@ module Sequel
|
|
|
1749
1749
|
include StringConcatenationMethods
|
|
1750
1750
|
include InequalityMethods
|
|
1751
1751
|
|
|
1752
|
-
# Map of [regexp,
|
|
1752
|
+
# Map of [regexp, case_insensitive] to +ComplexExpression+ operator symbol
|
|
1753
1753
|
LIKE_MAP = {[true, true]=>:'~*', [true, false]=>:~, [false, true]=>:ILIKE, [false, false]=>:LIKE}.freeze
|
|
1754
1754
|
LIKE_MAP.each_key(&:freeze)
|
|
1755
1755
|
|
|
1756
|
-
# Creates a SQL pattern match
|
|
1756
|
+
# Creates a SQL pattern match expression. left (l) is the SQL string we
|
|
1757
1757
|
# are matching against, and ces are the patterns we are matching.
|
|
1758
1758
|
# The match succeeds if any of the patterns match (SQL OR).
|
|
1759
1759
|
#
|
data/lib/sequel/version.rb
CHANGED
|
@@ -6,7 +6,7 @@ module Sequel
|
|
|
6
6
|
|
|
7
7
|
# The minor version of Sequel. Bumped for every non-patch level
|
|
8
8
|
# release, generally around once a month.
|
|
9
|
-
MINOR =
|
|
9
|
+
MINOR = 108
|
|
10
10
|
|
|
11
11
|
# The tiny version of Sequel. Usually 0, only bumped for bugfix
|
|
12
12
|
# releases that fix regressions from previous versions.
|
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: 5.
|
|
4
|
+
version: 5.108.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jeremy Evans
|
|
@@ -455,7 +455,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
455
455
|
- !ruby/object:Gem::Version
|
|
456
456
|
version: '0'
|
|
457
457
|
requirements: []
|
|
458
|
-
rubygems_version: 4.0.
|
|
458
|
+
rubygems_version: 4.0.16
|
|
459
459
|
specification_version: 4
|
|
460
460
|
summary: The Database Toolkit for Ruby
|
|
461
461
|
test_files: []
|