sequel 5.45.0 → 5.77.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +434 -0
- data/MIT-LICENSE +1 -1
- data/README.rdoc +59 -27
- data/bin/sequel +11 -3
- data/doc/advanced_associations.rdoc +16 -14
- data/doc/association_basics.rdoc +119 -24
- data/doc/cheat_sheet.rdoc +11 -3
- data/doc/mass_assignment.rdoc +1 -1
- data/doc/migration.rdoc +27 -6
- data/doc/model_hooks.rdoc +1 -1
- data/doc/object_model.rdoc +8 -8
- data/doc/opening_databases.rdoc +28 -12
- data/doc/postgresql.rdoc +16 -8
- data/doc/querying.rdoc +5 -3
- data/doc/release_notes/5.46.0.txt +87 -0
- data/doc/release_notes/5.47.0.txt +59 -0
- data/doc/release_notes/5.48.0.txt +14 -0
- data/doc/release_notes/5.49.0.txt +59 -0
- data/doc/release_notes/5.50.0.txt +78 -0
- data/doc/release_notes/5.51.0.txt +47 -0
- data/doc/release_notes/5.52.0.txt +87 -0
- data/doc/release_notes/5.53.0.txt +23 -0
- data/doc/release_notes/5.54.0.txt +27 -0
- data/doc/release_notes/5.55.0.txt +21 -0
- data/doc/release_notes/5.56.0.txt +51 -0
- data/doc/release_notes/5.57.0.txt +23 -0
- data/doc/release_notes/5.58.0.txt +31 -0
- data/doc/release_notes/5.59.0.txt +73 -0
- data/doc/release_notes/5.60.0.txt +22 -0
- data/doc/release_notes/5.61.0.txt +43 -0
- data/doc/release_notes/5.62.0.txt +132 -0
- data/doc/release_notes/5.63.0.txt +33 -0
- data/doc/release_notes/5.64.0.txt +50 -0
- data/doc/release_notes/5.65.0.txt +21 -0
- data/doc/release_notes/5.66.0.txt +24 -0
- data/doc/release_notes/5.67.0.txt +32 -0
- data/doc/release_notes/5.68.0.txt +61 -0
- data/doc/release_notes/5.69.0.txt +26 -0
- data/doc/release_notes/5.70.0.txt +35 -0
- data/doc/release_notes/5.71.0.txt +21 -0
- data/doc/release_notes/5.72.0.txt +33 -0
- data/doc/release_notes/5.73.0.txt +66 -0
- data/doc/release_notes/5.74.0.txt +45 -0
- data/doc/release_notes/5.75.0.txt +35 -0
- data/doc/release_notes/5.76.0.txt +86 -0
- data/doc/release_notes/5.77.0.txt +63 -0
- data/doc/schema_modification.rdoc +1 -1
- data/doc/security.rdoc +9 -9
- data/doc/sharding.rdoc +3 -1
- data/doc/sql.rdoc +27 -15
- data/doc/testing.rdoc +23 -13
- data/doc/transactions.rdoc +6 -6
- data/doc/virtual_rows.rdoc +1 -1
- data/lib/sequel/adapters/ado/access.rb +1 -1
- data/lib/sequel/adapters/ado.rb +1 -1
- data/lib/sequel/adapters/amalgalite.rb +3 -5
- data/lib/sequel/adapters/ibmdb.rb +3 -3
- data/lib/sequel/adapters/jdbc/derby.rb +8 -0
- data/lib/sequel/adapters/jdbc/h2.rb +63 -10
- data/lib/sequel/adapters/jdbc/hsqldb.rb +8 -0
- data/lib/sequel/adapters/jdbc/postgresql.rb +7 -4
- data/lib/sequel/adapters/jdbc/sqlanywhere.rb +15 -0
- data/lib/sequel/adapters/jdbc/sqlserver.rb +4 -0
- data/lib/sequel/adapters/jdbc.rb +24 -22
- data/lib/sequel/adapters/mysql.rb +92 -67
- data/lib/sequel/adapters/mysql2.rb +56 -51
- data/lib/sequel/adapters/odbc/mssql.rb +1 -1
- data/lib/sequel/adapters/odbc.rb +1 -1
- data/lib/sequel/adapters/oracle.rb +4 -3
- data/lib/sequel/adapters/postgres.rb +89 -45
- data/lib/sequel/adapters/shared/access.rb +11 -1
- data/lib/sequel/adapters/shared/db2.rb +42 -0
- data/lib/sequel/adapters/shared/mssql.rb +91 -10
- data/lib/sequel/adapters/shared/mysql.rb +78 -3
- data/lib/sequel/adapters/shared/oracle.rb +86 -7
- data/lib/sequel/adapters/shared/postgres.rb +576 -171
- data/lib/sequel/adapters/shared/sqlanywhere.rb +21 -5
- data/lib/sequel/adapters/shared/sqlite.rb +92 -8
- data/lib/sequel/adapters/sqlanywhere.rb +1 -1
- data/lib/sequel/adapters/sqlite.rb +99 -18
- data/lib/sequel/adapters/tinytds.rb +1 -1
- data/lib/sequel/adapters/trilogy.rb +117 -0
- data/lib/sequel/adapters/utils/columns_limit_1.rb +22 -0
- data/lib/sequel/adapters/utils/mysql_mysql2.rb +1 -1
- data/lib/sequel/ast_transformer.rb +6 -0
- data/lib/sequel/connection_pool/sharded_single.rb +5 -7
- data/lib/sequel/connection_pool/sharded_threaded.rb +16 -11
- data/lib/sequel/connection_pool/sharded_timed_queue.rb +374 -0
- data/lib/sequel/connection_pool/single.rb +6 -8
- data/lib/sequel/connection_pool/threaded.rb +14 -8
- data/lib/sequel/connection_pool/timed_queue.rb +270 -0
- data/lib/sequel/connection_pool.rb +57 -31
- data/lib/sequel/core.rb +17 -18
- data/lib/sequel/database/connecting.rb +27 -3
- data/lib/sequel/database/dataset.rb +16 -6
- data/lib/sequel/database/misc.rb +70 -14
- data/lib/sequel/database/query.rb +73 -2
- data/lib/sequel/database/schema_generator.rb +11 -6
- data/lib/sequel/database/schema_methods.rb +23 -4
- data/lib/sequel/database/transactions.rb +6 -0
- data/lib/sequel/dataset/actions.rb +111 -15
- data/lib/sequel/dataset/deprecated_singleton_class_methods.rb +42 -0
- data/lib/sequel/dataset/features.rb +20 -1
- data/lib/sequel/dataset/misc.rb +12 -2
- data/lib/sequel/dataset/placeholder_literalizer.rb +20 -9
- data/lib/sequel/dataset/query.rb +170 -41
- data/lib/sequel/dataset/sql.rb +190 -71
- data/lib/sequel/dataset.rb +4 -0
- data/lib/sequel/extensions/_model_pg_row.rb +0 -12
- data/lib/sequel/extensions/_pretty_table.rb +1 -1
- data/lib/sequel/extensions/any_not_empty.rb +2 -2
- data/lib/sequel/extensions/async_thread_pool.rb +14 -13
- data/lib/sequel/extensions/auto_cast_date_and_time.rb +94 -0
- data/lib/sequel/extensions/auto_literal_strings.rb +1 -1
- data/lib/sequel/extensions/connection_expiration.rb +15 -9
- data/lib/sequel/extensions/connection_validator.rb +16 -11
- data/lib/sequel/extensions/constraint_validations.rb +1 -1
- data/lib/sequel/extensions/core_refinements.rb +36 -11
- data/lib/sequel/extensions/date_arithmetic.rb +36 -8
- data/lib/sequel/extensions/date_parse_input_handler.rb +67 -0
- data/lib/sequel/extensions/datetime_parse_to_time.rb +5 -1
- data/lib/sequel/extensions/duplicate_columns_handler.rb +11 -10
- data/lib/sequel/extensions/index_caching.rb +5 -1
- data/lib/sequel/extensions/inflector.rb +1 -1
- data/lib/sequel/extensions/is_distinct_from.rb +141 -0
- data/lib/sequel/extensions/looser_typecasting.rb +3 -0
- data/lib/sequel/extensions/migration.rb +57 -15
- data/lib/sequel/extensions/named_timezones.rb +22 -6
- data/lib/sequel/extensions/pagination.rb +1 -1
- data/lib/sequel/extensions/pg_array.rb +33 -4
- data/lib/sequel/extensions/pg_array_ops.rb +2 -2
- data/lib/sequel/extensions/pg_auto_parameterize.rb +509 -0
- data/lib/sequel/extensions/pg_auto_parameterize_in_array.rb +110 -0
- data/lib/sequel/extensions/pg_enum.rb +1 -2
- data/lib/sequel/extensions/pg_extended_date_support.rb +39 -28
- data/lib/sequel/extensions/pg_extended_integer_support.rb +116 -0
- data/lib/sequel/extensions/pg_hstore.rb +6 -1
- data/lib/sequel/extensions/pg_hstore_ops.rb +53 -3
- data/lib/sequel/extensions/pg_inet.rb +10 -11
- data/lib/sequel/extensions/pg_inet_ops.rb +1 -1
- data/lib/sequel/extensions/pg_interval.rb +11 -11
- data/lib/sequel/extensions/pg_json.rb +13 -15
- data/lib/sequel/extensions/pg_json_ops.rb +125 -2
- data/lib/sequel/extensions/pg_multirange.rb +367 -0
- data/lib/sequel/extensions/pg_range.rb +13 -26
- data/lib/sequel/extensions/pg_range_ops.rb +37 -9
- data/lib/sequel/extensions/pg_row.rb +20 -19
- data/lib/sequel/extensions/pg_row_ops.rb +1 -1
- data/lib/sequel/extensions/pg_timestamptz.rb +27 -3
- data/lib/sequel/extensions/round_timestamps.rb +1 -1
- data/lib/sequel/extensions/s.rb +2 -1
- data/lib/sequel/extensions/schema_caching.rb +1 -1
- data/lib/sequel/extensions/schema_dumper.rb +45 -11
- data/lib/sequel/extensions/server_block.rb +10 -13
- data/lib/sequel/extensions/set_literalizer.rb +58 -0
- data/lib/sequel/extensions/sql_comments.rb +110 -3
- data/lib/sequel/extensions/sql_log_normalizer.rb +108 -0
- data/lib/sequel/extensions/sqlite_json_ops.rb +255 -0
- data/lib/sequel/extensions/string_agg.rb +1 -1
- data/lib/sequel/extensions/string_date_time.rb +19 -23
- data/lib/sequel/extensions/symbol_aref.rb +2 -0
- data/lib/sequel/extensions/transaction_connection_validator.rb +78 -0
- data/lib/sequel/model/associations.rb +286 -92
- data/lib/sequel/model/base.rb +53 -33
- data/lib/sequel/model/dataset_module.rb +3 -0
- data/lib/sequel/model/errors.rb +10 -1
- data/lib/sequel/model/exceptions.rb +15 -3
- data/lib/sequel/model/inflections.rb +1 -1
- data/lib/sequel/plugins/auto_restrict_eager_graph.rb +62 -0
- data/lib/sequel/plugins/auto_validations.rb +74 -16
- data/lib/sequel/plugins/class_table_inheritance.rb +2 -2
- data/lib/sequel/plugins/column_encryption.rb +29 -8
- data/lib/sequel/plugins/composition.rb +3 -2
- data/lib/sequel/plugins/concurrent_eager_loading.rb +4 -4
- data/lib/sequel/plugins/constraint_validations.rb +8 -5
- data/lib/sequel/plugins/defaults_setter.rb +16 -0
- data/lib/sequel/plugins/dirty.rb +1 -1
- data/lib/sequel/plugins/enum.rb +124 -0
- data/lib/sequel/plugins/finder.rb +4 -2
- data/lib/sequel/plugins/insert_conflict.rb +4 -0
- data/lib/sequel/plugins/instance_specific_default.rb +1 -1
- data/lib/sequel/plugins/json_serializer.rb +2 -2
- data/lib/sequel/plugins/lazy_attributes.rb +3 -0
- data/lib/sequel/plugins/list.rb +8 -3
- data/lib/sequel/plugins/many_through_many.rb +109 -10
- data/lib/sequel/plugins/mssql_optimistic_locking.rb +8 -38
- data/lib/sequel/plugins/nested_attributes.rb +4 -4
- data/lib/sequel/plugins/optimistic_locking.rb +9 -42
- data/lib/sequel/plugins/optimistic_locking_base.rb +55 -0
- data/lib/sequel/plugins/paged_operations.rb +181 -0
- data/lib/sequel/plugins/pg_array_associations.rb +46 -34
- data/lib/sequel/plugins/pg_auto_constraint_validations.rb +9 -3
- data/lib/sequel/plugins/pg_xmin_optimistic_locking.rb +109 -0
- data/lib/sequel/plugins/prepared_statements.rb +12 -2
- data/lib/sequel/plugins/prepared_statements_safe.rb +2 -1
- data/lib/sequel/plugins/primary_key_lookup_check_values.rb +154 -0
- data/lib/sequel/plugins/rcte_tree.rb +7 -4
- data/lib/sequel/plugins/require_valid_schema.rb +67 -0
- data/lib/sequel/plugins/serialization.rb +1 -0
- data/lib/sequel/plugins/serialization_modification_detection.rb +1 -0
- data/lib/sequel/plugins/single_table_inheritance.rb +8 -0
- data/lib/sequel/plugins/sql_comments.rb +189 -0
- data/lib/sequel/plugins/static_cache.rb +39 -1
- data/lib/sequel/plugins/static_cache_cache.rb +5 -1
- data/lib/sequel/plugins/subclasses.rb +28 -11
- data/lib/sequel/plugins/tactical_eager_loading.rb +23 -10
- data/lib/sequel/plugins/timestamps.rb +1 -1
- data/lib/sequel/plugins/unused_associations.rb +521 -0
- data/lib/sequel/plugins/update_or_create.rb +1 -1
- data/lib/sequel/plugins/validate_associated.rb +22 -12
- data/lib/sequel/plugins/validation_helpers.rb +41 -11
- data/lib/sequel/plugins/validation_helpers_generic_type_messages.rb +73 -0
- data/lib/sequel/plugins/xml_serializer.rb +1 -1
- data/lib/sequel/sql.rb +1 -1
- data/lib/sequel/timezones.rb +12 -14
- data/lib/sequel/version.rb +1 -1
- metadata +109 -19
@@ -66,18 +66,19 @@ module Sequel
|
|
66
66
|
# integer: "is not a number"
|
67
67
|
#
|
68
68
|
# Note that if you want to support internationalization of Errors#full_messages,
|
69
|
-
#
|
69
|
+
# it is easiest to override Errors#full_message (note singular form and not plural form).
|
70
|
+
# Here's an example:
|
70
71
|
#
|
71
72
|
# class Sequel::Model::Errors
|
72
|
-
#
|
73
|
-
#
|
74
|
-
#
|
75
|
-
# att.is_a?(Array) ? Array(att).map!{|v| I18n.t("attributes.#{v}")} : att = I18n.t("attributes.#{att}")
|
76
|
-
# errors.each {|e| m << (e.is_a?(LiteralString) ? e : "#{Array(att).join(I18n.t('errors.joiner'))} #{e}")}
|
77
|
-
# m
|
78
|
-
# end
|
73
|
+
# private
|
74
|
+
# def full_message(attribute, error_msg)
|
75
|
+
# "#{Array(attribute).join(I18n.t('errors.joiner'))} #{error_msg}"
|
79
76
|
# end
|
80
77
|
# end
|
78
|
+
#
|
79
|
+
# It is recommended that users of this plugin that use validates_schema_types also use
|
80
|
+
# the validation_helpers_generic_type_messages plugin for more useful type validation
|
81
|
+
# failure messages.
|
81
82
|
module ValidationHelpers
|
82
83
|
DEFAULT_OPTIONS = {
|
83
84
|
:exact_length=>{:message=>lambda{|exact| "is not #{exact} characters"}},
|
@@ -86,8 +87,11 @@ module Sequel
|
|
86
87
|
:integer=>{:message=>lambda{"is not a number"}},
|
87
88
|
:length_range=>{:message=>lambda{|range| "is too short or too long"}},
|
88
89
|
:max_length=>{:message=>lambda{|max| "is longer than #{max} characters"}, :nil_message=>lambda{"is not present"}},
|
90
|
+
:max_value=>{:message=>lambda{|max| "is greater than maximum allowed value"}},
|
89
91
|
:min_length=>{:message=>lambda{|min| "is shorter than #{min} characters"}},
|
92
|
+
:min_value=>{:message=>lambda{|min| "is less than minimum allowed value"}},
|
90
93
|
:not_null=>{:message=>lambda{"is not present"}},
|
94
|
+
:no_null_byte=>{:message=>lambda{"contains a null byte"}},
|
91
95
|
:numeric=>{:message=>lambda{"is not a number"}},
|
92
96
|
:operator=>{:message=>lambda{|operator, rhs| "is not #{operator} #{rhs}"}},
|
93
97
|
:type=>{:message=>lambda{|klass| klass.is_a?(Array) ? "is not a valid #{klass.join(" or ").downcase}" : "is not a valid #{klass.to_s.downcase}"}},
|
@@ -143,15 +147,38 @@ module Sequel
|
|
143
147
|
end
|
144
148
|
end
|
145
149
|
|
150
|
+
# Check that the attribute values are not greater that the given maximum value.
|
151
|
+
# Does not perform validation if attribute value is nil.
|
152
|
+
# You should only call this if you have checked the attribute value has the expected type.
|
153
|
+
def validates_max_value(max, atts, opts=OPTS)
|
154
|
+
validatable_attributes_for_type(:max_value, atts, opts) do |a,v,m|
|
155
|
+
validation_error_message(m, max) if !v.nil? && v > max
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
146
159
|
# Check that the attribute values are not shorter than the given min length.
|
147
160
|
def validates_min_length(min, atts, opts=OPTS)
|
148
161
|
validatable_attributes_for_type(:min_length, atts, opts){|a,v,m| validation_error_message(m, min) if v.nil? || v.length < min}
|
149
162
|
end
|
150
163
|
|
164
|
+
# Check that the attribute values are not less that the given minimum value.
|
165
|
+
# Does not perform validation if attribute value is nil.
|
166
|
+
# You should only call this if you have checked the attribute value has the expected type.
|
167
|
+
def validates_min_value(min, atts, opts=OPTS)
|
168
|
+
validatable_attributes_for_type(:min_value, atts, opts) do |a,v,m|
|
169
|
+
validation_error_message(m, min) if !v.nil? && v < min
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
151
173
|
# Check attribute value(s) are not NULL/nil.
|
152
174
|
def validates_not_null(atts, opts=OPTS)
|
153
175
|
validatable_attributes_for_type(:not_null, atts, opts){|a,v,m| validation_error_message(m) if v.nil?}
|
154
176
|
end
|
177
|
+
|
178
|
+
# Check attribute value(s) does not contain a null ("\0", ASCII NUL) byte.
|
179
|
+
def validates_no_null_byte(atts, opts=OPTS)
|
180
|
+
validatable_attributes_for_type(:no_null_byte, atts, opts){|a,v,m| validation_error_message(m) if String === v && v.include?("\0")}
|
181
|
+
end
|
155
182
|
|
156
183
|
# Check attribute value(s) string representation is a valid float.
|
157
184
|
def validates_numeric(atts, opts=OPTS)
|
@@ -188,7 +215,7 @@ module Sequel
|
|
188
215
|
klass = klass.to_s.constantize if klass.is_a?(String) || klass.is_a?(Symbol)
|
189
216
|
validatable_attributes_for_type(:type, atts, opts) do |a,v,m|
|
190
217
|
if klass.is_a?(Array) ? !klass.any?{|kls| v.is_a?(kls)} : !v.is_a?(klass)
|
191
|
-
|
218
|
+
validates_type_error_message(m, klass)
|
192
219
|
end
|
193
220
|
end
|
194
221
|
end
|
@@ -263,12 +290,12 @@ module Sequel
|
|
263
290
|
next if vals.any?(&:nil?)
|
264
291
|
ds.where(arr.zip(vals))
|
265
292
|
end
|
266
|
-
ds = yield(ds) if
|
293
|
+
ds = yield(ds) if defined?(yield)
|
267
294
|
unless new?
|
268
295
|
h = ds.joined_dataset? ? qualified_pk_hash : pk_hash
|
269
296
|
ds = ds.exclude(h)
|
270
297
|
end
|
271
|
-
errors.add(a, message) unless ds.
|
298
|
+
errors.add(a, message) unless ds.empty?
|
272
299
|
end
|
273
300
|
end
|
274
301
|
|
@@ -315,6 +342,9 @@ module Sequel
|
|
315
342
|
def validation_error_message(message, *args)
|
316
343
|
message.is_a?(Proc) ? message.call(*args) : message
|
317
344
|
end
|
345
|
+
|
346
|
+
# The validation error message for type validations, for the given class.
|
347
|
+
alias validates_type_error_message validation_error_message
|
318
348
|
end
|
319
349
|
end
|
320
350
|
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
# frozen-string-literal: true
|
2
|
+
|
3
|
+
require_relative 'validation_helpers'
|
4
|
+
|
5
|
+
module Sequel
|
6
|
+
module Plugins
|
7
|
+
# The validation_helpers_generic_type_messages plugin overrides the default
|
8
|
+
# type validation failure messages in the validation_helpers plugin to be
|
9
|
+
# more generic and understandable by the average user, instead of always
|
10
|
+
# be based on the names of the allowed classes for the type. For example:
|
11
|
+
#
|
12
|
+
# # :blob type
|
13
|
+
# # validation_helpers default: "value is not a valid sequel::sql::blob"
|
14
|
+
# # with this plugin: "value is not a blob"
|
15
|
+
#
|
16
|
+
# # :boolean type
|
17
|
+
# # validation_helpers default: "value is not a valid trueclass or falseclass"
|
18
|
+
# # with this plugin: "value is not true or false"
|
19
|
+
#
|
20
|
+
# # :datetime type
|
21
|
+
# # validation_helpers default: "value is not a valid time or datetime"
|
22
|
+
# # with this plugin: "value is not a valid timestamp"
|
23
|
+
#
|
24
|
+
# # custom/database-specific types
|
25
|
+
# # validation_helpers default: "value is not a valid sequel::class_name"
|
26
|
+
# # with this plugin: "value is not the expected type"
|
27
|
+
#
|
28
|
+
# It is expected that this plugin will become the default behavior of
|
29
|
+
# validation_helpers in Sequel 6.
|
30
|
+
#
|
31
|
+
# To enable this the use of generic type messages for all models, load this
|
32
|
+
# plugin into Sequel::Model.
|
33
|
+
#
|
34
|
+
# Sequel::Model.plugin :validation_helpers_generic_type_messages
|
35
|
+
module ValidationHelpersGenericTypeMessages
|
36
|
+
OVERRIDE_PROC = ValidationHelpers::DEFAULT_OPTIONS[:type][:message]
|
37
|
+
private_constant :OVERRIDE_PROC
|
38
|
+
|
39
|
+
TYPE_ERROR_STRINGS = {
|
40
|
+
String => 'is not a string'.freeze,
|
41
|
+
Integer => 'is not an integer'.freeze,
|
42
|
+
Date => 'is not a valid date'.freeze,
|
43
|
+
[Time, DateTime].freeze => 'is not a valid timestamp'.freeze,
|
44
|
+
Sequel::SQLTime => 'is not a valid time'.freeze,
|
45
|
+
[TrueClass, FalseClass].freeze => 'is not true or false'.freeze,
|
46
|
+
Float => 'is not a number'.freeze,
|
47
|
+
BigDecimal => 'is not a number'.freeze,
|
48
|
+
Sequel::SQL::Blob => 'is not a blob'.freeze,
|
49
|
+
}
|
50
|
+
TYPE_ERROR_STRINGS.default = "is not the expected type".freeze
|
51
|
+
TYPE_ERROR_STRINGS.freeze
|
52
|
+
private_constant :TYPE_ERROR_STRINGS
|
53
|
+
|
54
|
+
def self.apply(mod)
|
55
|
+
mod.plugin :validation_helpers
|
56
|
+
end
|
57
|
+
|
58
|
+
module InstanceMethods
|
59
|
+
private
|
60
|
+
|
61
|
+
# Use a generic error message for type validations.
|
62
|
+
def validates_type_error_message(m, klass)
|
63
|
+
# SEQUEL6: Make this the default behavior in validation_helpers
|
64
|
+
if OVERRIDE_PROC.equal?(m)
|
65
|
+
TYPE_ERROR_STRINGS[klass]
|
66
|
+
else
|
67
|
+
super
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
data/lib/sequel/sql.rb
CHANGED
data/lib/sequel/timezones.rb
CHANGED
@@ -82,22 +82,20 @@ module Sequel
|
|
82
82
|
# +application_timezone+ using +convert_input_timestamp+ and
|
83
83
|
# +convert_output_timestamp+.
|
84
84
|
def convert_timestamp(v, input_timezone)
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
DateTime.civil(v.year, v.month, v.day, 0, 0, 0, application_timezone == :local ? Rational(Time.local(v.year, v.month, v.day).utc_offset, 86400) : 0)
|
90
|
-
else
|
91
|
-
Time.public_send(application_timezone == :utc ? :utc : :local, v.year, v.month, v.day)
|
92
|
-
end
|
85
|
+
if v.is_a?(Date) && !v.is_a?(DateTime)
|
86
|
+
# Dates handled specially as they are assumed to already be in the application_timezone
|
87
|
+
if datetime_class == DateTime
|
88
|
+
DateTime.civil(v.year, v.month, v.day, 0, 0, 0, application_timezone == :local ? Rational(Time.local(v.year, v.month, v.day).utc_offset, 86400) : 0)
|
93
89
|
else
|
94
|
-
|
90
|
+
Time.public_send(application_timezone == :utc ? :utc : :local, v.year, v.month, v.day)
|
95
91
|
end
|
96
|
-
|
97
|
-
|
98
|
-
rescue => e
|
99
|
-
raise convert_exception_class(e, InvalidValue)
|
92
|
+
else
|
93
|
+
convert_output_timestamp(convert_input_timestamp(v, input_timezone), application_timezone)
|
100
94
|
end
|
95
|
+
rescue InvalidValue
|
96
|
+
raise
|
97
|
+
rescue => e
|
98
|
+
raise convert_exception_class(e, InvalidValue)
|
101
99
|
end
|
102
100
|
|
103
101
|
# Convert the given object into an object of <tt>Sequel.datetime_class</tt> in the
|
@@ -158,7 +156,7 @@ module Sequel
|
|
158
156
|
case v
|
159
157
|
when String
|
160
158
|
v2 = Sequel.string_to_datetime(v)
|
161
|
-
if !input_timezone ||
|
159
|
+
if !input_timezone || _date_parse(v).has_key?(:offset)
|
162
160
|
v2
|
163
161
|
else
|
164
162
|
# Correct for potentially wrong offset if string doesn't include offset
|
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 = 77
|
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,45 +1,45 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sequel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.77.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Evans
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-02-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: bigdecimal
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
20
|
-
type: :
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name: minitest
|
28
|
+
name: minitest
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 5.7.0
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 5.7.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name: minitest-
|
42
|
+
name: minitest-hooks
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
@@ -53,7 +53,7 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name: minitest-
|
56
|
+
name: minitest-global_expectations
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
@@ -189,9 +189,41 @@ extra_rdoc_files:
|
|
189
189
|
- doc/release_notes/5.43.0.txt
|
190
190
|
- doc/release_notes/5.44.0.txt
|
191
191
|
- doc/release_notes/5.45.0.txt
|
192
|
+
- doc/release_notes/5.46.0.txt
|
193
|
+
- doc/release_notes/5.47.0.txt
|
194
|
+
- doc/release_notes/5.48.0.txt
|
195
|
+
- doc/release_notes/5.49.0.txt
|
192
196
|
- doc/release_notes/5.5.0.txt
|
197
|
+
- doc/release_notes/5.50.0.txt
|
198
|
+
- doc/release_notes/5.51.0.txt
|
199
|
+
- doc/release_notes/5.52.0.txt
|
200
|
+
- doc/release_notes/5.53.0.txt
|
201
|
+
- doc/release_notes/5.54.0.txt
|
202
|
+
- doc/release_notes/5.55.0.txt
|
203
|
+
- doc/release_notes/5.56.0.txt
|
204
|
+
- doc/release_notes/5.57.0.txt
|
205
|
+
- doc/release_notes/5.58.0.txt
|
206
|
+
- doc/release_notes/5.59.0.txt
|
193
207
|
- doc/release_notes/5.6.0.txt
|
208
|
+
- doc/release_notes/5.60.0.txt
|
209
|
+
- doc/release_notes/5.61.0.txt
|
210
|
+
- doc/release_notes/5.62.0.txt
|
211
|
+
- doc/release_notes/5.63.0.txt
|
212
|
+
- doc/release_notes/5.64.0.txt
|
213
|
+
- doc/release_notes/5.65.0.txt
|
214
|
+
- doc/release_notes/5.66.0.txt
|
215
|
+
- doc/release_notes/5.67.0.txt
|
216
|
+
- doc/release_notes/5.68.0.txt
|
217
|
+
- doc/release_notes/5.69.0.txt
|
194
218
|
- doc/release_notes/5.7.0.txt
|
219
|
+
- doc/release_notes/5.70.0.txt
|
220
|
+
- doc/release_notes/5.71.0.txt
|
221
|
+
- doc/release_notes/5.72.0.txt
|
222
|
+
- doc/release_notes/5.73.0.txt
|
223
|
+
- doc/release_notes/5.74.0.txt
|
224
|
+
- doc/release_notes/5.75.0.txt
|
225
|
+
- doc/release_notes/5.76.0.txt
|
226
|
+
- doc/release_notes/5.77.0.txt
|
195
227
|
- doc/release_notes/5.8.0.txt
|
196
228
|
- doc/release_notes/5.9.0.txt
|
197
229
|
files:
|
@@ -262,9 +294,41 @@ files:
|
|
262
294
|
- doc/release_notes/5.43.0.txt
|
263
295
|
- doc/release_notes/5.44.0.txt
|
264
296
|
- doc/release_notes/5.45.0.txt
|
297
|
+
- doc/release_notes/5.46.0.txt
|
298
|
+
- doc/release_notes/5.47.0.txt
|
299
|
+
- doc/release_notes/5.48.0.txt
|
300
|
+
- doc/release_notes/5.49.0.txt
|
265
301
|
- doc/release_notes/5.5.0.txt
|
302
|
+
- doc/release_notes/5.50.0.txt
|
303
|
+
- doc/release_notes/5.51.0.txt
|
304
|
+
- doc/release_notes/5.52.0.txt
|
305
|
+
- doc/release_notes/5.53.0.txt
|
306
|
+
- doc/release_notes/5.54.0.txt
|
307
|
+
- doc/release_notes/5.55.0.txt
|
308
|
+
- doc/release_notes/5.56.0.txt
|
309
|
+
- doc/release_notes/5.57.0.txt
|
310
|
+
- doc/release_notes/5.58.0.txt
|
311
|
+
- doc/release_notes/5.59.0.txt
|
266
312
|
- doc/release_notes/5.6.0.txt
|
313
|
+
- doc/release_notes/5.60.0.txt
|
314
|
+
- doc/release_notes/5.61.0.txt
|
315
|
+
- doc/release_notes/5.62.0.txt
|
316
|
+
- doc/release_notes/5.63.0.txt
|
317
|
+
- doc/release_notes/5.64.0.txt
|
318
|
+
- doc/release_notes/5.65.0.txt
|
319
|
+
- doc/release_notes/5.66.0.txt
|
320
|
+
- doc/release_notes/5.67.0.txt
|
321
|
+
- doc/release_notes/5.68.0.txt
|
322
|
+
- doc/release_notes/5.69.0.txt
|
267
323
|
- doc/release_notes/5.7.0.txt
|
324
|
+
- doc/release_notes/5.70.0.txt
|
325
|
+
- doc/release_notes/5.71.0.txt
|
326
|
+
- doc/release_notes/5.72.0.txt
|
327
|
+
- doc/release_notes/5.73.0.txt
|
328
|
+
- doc/release_notes/5.74.0.txt
|
329
|
+
- doc/release_notes/5.75.0.txt
|
330
|
+
- doc/release_notes/5.76.0.txt
|
331
|
+
- doc/release_notes/5.77.0.txt
|
268
332
|
- doc/release_notes/5.8.0.txt
|
269
333
|
- doc/release_notes/5.9.0.txt
|
270
334
|
- doc/schema_modification.rdoc
|
@@ -317,6 +381,8 @@ files:
|
|
317
381
|
- lib/sequel/adapters/sqlanywhere.rb
|
318
382
|
- lib/sequel/adapters/sqlite.rb
|
319
383
|
- lib/sequel/adapters/tinytds.rb
|
384
|
+
- lib/sequel/adapters/trilogy.rb
|
385
|
+
- lib/sequel/adapters/utils/columns_limit_1.rb
|
320
386
|
- lib/sequel/adapters/utils/emulate_offset_with_reverse_and_count.rb
|
321
387
|
- lib/sequel/adapters/utils/emulate_offset_with_row_number.rb
|
322
388
|
- lib/sequel/adapters/utils/mysql_mysql2.rb
|
@@ -329,8 +395,10 @@ files:
|
|
329
395
|
- lib/sequel/connection_pool.rb
|
330
396
|
- lib/sequel/connection_pool/sharded_single.rb
|
331
397
|
- lib/sequel/connection_pool/sharded_threaded.rb
|
398
|
+
- lib/sequel/connection_pool/sharded_timed_queue.rb
|
332
399
|
- lib/sequel/connection_pool/single.rb
|
333
400
|
- lib/sequel/connection_pool/threaded.rb
|
401
|
+
- lib/sequel/connection_pool/timed_queue.rb
|
334
402
|
- lib/sequel/core.rb
|
335
403
|
- lib/sequel/database.rb
|
336
404
|
- lib/sequel/database/connecting.rb
|
@@ -346,6 +414,7 @@ files:
|
|
346
414
|
- lib/sequel/dataset.rb
|
347
415
|
- lib/sequel/dataset/actions.rb
|
348
416
|
- lib/sequel/dataset/dataset_module.rb
|
417
|
+
- lib/sequel/dataset/deprecated_singleton_class_methods.rb
|
349
418
|
- lib/sequel/dataset/features.rb
|
350
419
|
- lib/sequel/dataset/graph.rb
|
351
420
|
- lib/sequel/dataset/misc.rb
|
@@ -361,6 +430,7 @@ files:
|
|
361
430
|
- lib/sequel/extensions/any_not_empty.rb
|
362
431
|
- lib/sequel/extensions/arbitrary_servers.rb
|
363
432
|
- lib/sequel/extensions/async_thread_pool.rb
|
433
|
+
- lib/sequel/extensions/auto_cast_date_and_time.rb
|
364
434
|
- lib/sequel/extensions/auto_literal_strings.rb
|
365
435
|
- lib/sequel/extensions/blank.rb
|
366
436
|
- lib/sequel/extensions/caller_logging.rb
|
@@ -374,6 +444,7 @@ files:
|
|
374
444
|
- lib/sequel/extensions/current_datetime_timestamp.rb
|
375
445
|
- lib/sequel/extensions/dataset_source_alias.rb
|
376
446
|
- lib/sequel/extensions/date_arithmetic.rb
|
447
|
+
- lib/sequel/extensions/date_parse_input_handler.rb
|
377
448
|
- lib/sequel/extensions/datetime_parse_to_time.rb
|
378
449
|
- lib/sequel/extensions/duplicate_columns_handler.rb
|
379
450
|
- lib/sequel/extensions/empty_array_consider_nulls.rb
|
@@ -390,6 +461,7 @@ files:
|
|
390
461
|
- lib/sequel/extensions/index_caching.rb
|
391
462
|
- lib/sequel/extensions/inflector.rb
|
392
463
|
- lib/sequel/extensions/integer64.rb
|
464
|
+
- lib/sequel/extensions/is_distinct_from.rb
|
393
465
|
- lib/sequel/extensions/looser_typecasting.rb
|
394
466
|
- lib/sequel/extensions/migration.rb
|
395
467
|
- lib/sequel/extensions/mssql_emulate_lateral_with_apply.rb
|
@@ -399,8 +471,11 @@ files:
|
|
399
471
|
- lib/sequel/extensions/pagination.rb
|
400
472
|
- lib/sequel/extensions/pg_array.rb
|
401
473
|
- lib/sequel/extensions/pg_array_ops.rb
|
474
|
+
- lib/sequel/extensions/pg_auto_parameterize.rb
|
475
|
+
- lib/sequel/extensions/pg_auto_parameterize_in_array.rb
|
402
476
|
- lib/sequel/extensions/pg_enum.rb
|
403
477
|
- lib/sequel/extensions/pg_extended_date_support.rb
|
478
|
+
- lib/sequel/extensions/pg_extended_integer_support.rb
|
404
479
|
- lib/sequel/extensions/pg_hstore.rb
|
405
480
|
- lib/sequel/extensions/pg_hstore_ops.rb
|
406
481
|
- lib/sequel/extensions/pg_inet.rb
|
@@ -409,6 +484,7 @@ files:
|
|
409
484
|
- lib/sequel/extensions/pg_json.rb
|
410
485
|
- lib/sequel/extensions/pg_json_ops.rb
|
411
486
|
- lib/sequel/extensions/pg_loose_count.rb
|
487
|
+
- lib/sequel/extensions/pg_multirange.rb
|
412
488
|
- lib/sequel/extensions/pg_range.rb
|
413
489
|
- lib/sequel/extensions/pg_range_ops.rb
|
414
490
|
- lib/sequel/extensions/pg_row.rb
|
@@ -426,9 +502,12 @@ files:
|
|
426
502
|
- lib/sequel/extensions/sequel_4_dataset_methods.rb
|
427
503
|
- lib/sequel/extensions/server_block.rb
|
428
504
|
- lib/sequel/extensions/server_logging.rb
|
505
|
+
- lib/sequel/extensions/set_literalizer.rb
|
429
506
|
- lib/sequel/extensions/split_array_nil.rb
|
430
507
|
- lib/sequel/extensions/sql_comments.rb
|
431
508
|
- lib/sequel/extensions/sql_expr.rb
|
509
|
+
- lib/sequel/extensions/sql_log_normalizer.rb
|
510
|
+
- lib/sequel/extensions/sqlite_json_ops.rb
|
432
511
|
- lib/sequel/extensions/string_agg.rb
|
433
512
|
- lib/sequel/extensions/string_date_time.rb
|
434
513
|
- lib/sequel/extensions/symbol_aref.rb
|
@@ -438,6 +517,7 @@ files:
|
|
438
517
|
- lib/sequel/extensions/synchronize_sql.rb
|
439
518
|
- lib/sequel/extensions/thread_local_timezones.rb
|
440
519
|
- lib/sequel/extensions/to_dot.rb
|
520
|
+
- lib/sequel/extensions/transaction_connection_validator.rb
|
441
521
|
- lib/sequel/extensions/virtual_row_method_block.rb
|
442
522
|
- lib/sequel/model.rb
|
443
523
|
- lib/sequel/model/associations.rb
|
@@ -457,6 +537,7 @@ files:
|
|
457
537
|
- lib/sequel/plugins/association_pks.rb
|
458
538
|
- lib/sequel/plugins/association_proxies.rb
|
459
539
|
- lib/sequel/plugins/async_thread_pool.rb
|
540
|
+
- lib/sequel/plugins/auto_restrict_eager_graph.rb
|
460
541
|
- lib/sequel/plugins/auto_validations.rb
|
461
542
|
- lib/sequel/plugins/auto_validations_constraint_validations_presence_message.rb
|
462
543
|
- lib/sequel/plugins/before_after_save.rb
|
@@ -481,6 +562,7 @@ files:
|
|
481
562
|
- lib/sequel/plugins/eager_each.rb
|
482
563
|
- lib/sequel/plugins/eager_graph_eager.rb
|
483
564
|
- lib/sequel/plugins/empty_failure_backtraces.rb
|
565
|
+
- lib/sequel/plugins/enum.rb
|
484
566
|
- lib/sequel/plugins/error_splitter.rb
|
485
567
|
- lib/sequel/plugins/finder.rb
|
486
568
|
- lib/sequel/plugins/forbid_lazy_load.rb
|
@@ -501,12 +583,17 @@ files:
|
|
501
583
|
- lib/sequel/plugins/mssql_optimistic_locking.rb
|
502
584
|
- lib/sequel/plugins/nested_attributes.rb
|
503
585
|
- lib/sequel/plugins/optimistic_locking.rb
|
586
|
+
- lib/sequel/plugins/optimistic_locking_base.rb
|
587
|
+
- lib/sequel/plugins/paged_operations.rb
|
504
588
|
- lib/sequel/plugins/pg_array_associations.rb
|
505
589
|
- lib/sequel/plugins/pg_auto_constraint_validations.rb
|
506
590
|
- lib/sequel/plugins/pg_row.rb
|
591
|
+
- lib/sequel/plugins/pg_xmin_optimistic_locking.rb
|
507
592
|
- lib/sequel/plugins/prepared_statements.rb
|
508
593
|
- lib/sequel/plugins/prepared_statements_safe.rb
|
594
|
+
- lib/sequel/plugins/primary_key_lookup_check_values.rb
|
509
595
|
- lib/sequel/plugins/rcte_tree.rb
|
596
|
+
- lib/sequel/plugins/require_valid_schema.rb
|
510
597
|
- lib/sequel/plugins/serialization.rb
|
511
598
|
- lib/sequel/plugins/serialization_modification_detection.rb
|
512
599
|
- lib/sequel/plugins/sharding.rb
|
@@ -515,6 +602,7 @@ files:
|
|
515
602
|
- lib/sequel/plugins/skip_create_refresh.rb
|
516
603
|
- lib/sequel/plugins/skip_saving_columns.rb
|
517
604
|
- lib/sequel/plugins/split_values.rb
|
605
|
+
- lib/sequel/plugins/sql_comments.rb
|
518
606
|
- lib/sequel/plugins/static_cache.rb
|
519
607
|
- lib/sequel/plugins/static_cache_cache.rb
|
520
608
|
- lib/sequel/plugins/string_stripper.rb
|
@@ -528,6 +616,7 @@ files:
|
|
528
616
|
- lib/sequel/plugins/tree.rb
|
529
617
|
- lib/sequel/plugins/typecast_on_load.rb
|
530
618
|
- lib/sequel/plugins/unlimited_update.rb
|
619
|
+
- lib/sequel/plugins/unused_associations.rb
|
531
620
|
- lib/sequel/plugins/update_or_create.rb
|
532
621
|
- lib/sequel/plugins/update_primary_key.rb
|
533
622
|
- lib/sequel/plugins/update_refresh.rb
|
@@ -536,21 +625,22 @@ files:
|
|
536
625
|
- lib/sequel/plugins/validation_class_methods.rb
|
537
626
|
- lib/sequel/plugins/validation_contexts.rb
|
538
627
|
- lib/sequel/plugins/validation_helpers.rb
|
628
|
+
- lib/sequel/plugins/validation_helpers_generic_type_messages.rb
|
539
629
|
- lib/sequel/plugins/whitelist_security.rb
|
540
630
|
- lib/sequel/plugins/xml_serializer.rb
|
541
631
|
- lib/sequel/sql.rb
|
542
632
|
- lib/sequel/timezones.rb
|
543
633
|
- lib/sequel/version.rb
|
544
|
-
homepage:
|
634
|
+
homepage: https://sequel.jeremyevans.net
|
545
635
|
licenses:
|
546
636
|
- MIT
|
547
637
|
metadata:
|
548
638
|
bug_tracker_uri: https://github.com/jeremyevans/sequel/issues
|
549
|
-
changelog_uri:
|
550
|
-
documentation_uri:
|
551
|
-
mailing_list_uri: https://
|
639
|
+
changelog_uri: https://sequel.jeremyevans.net/rdoc/files/CHANGELOG.html
|
640
|
+
documentation_uri: https://sequel.jeremyevans.net/documentation.html
|
641
|
+
mailing_list_uri: https://github.com/jeremyevans/sequel/discussions
|
552
642
|
source_code_uri: https://github.com/jeremyevans/sequel
|
553
|
-
post_install_message:
|
643
|
+
post_install_message:
|
554
644
|
rdoc_options:
|
555
645
|
- "--quiet"
|
556
646
|
- "--line-numbers"
|
@@ -572,8 +662,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
572
662
|
- !ruby/object:Gem::Version
|
573
663
|
version: '0'
|
574
664
|
requirements: []
|
575
|
-
rubygems_version: 3.
|
576
|
-
signing_key:
|
665
|
+
rubygems_version: 3.5.3
|
666
|
+
signing_key:
|
577
667
|
specification_version: 4
|
578
668
|
summary: The Database Toolkit for Ruby
|
579
669
|
test_files: []
|