sequel 5.110.0 → 5.111.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/lib/sequel/adapters/jdbc.rb +1 -1
- data/lib/sequel/adapters/shared/postgres.rb +54 -2
- data/lib/sequel/adapters/shared/sqlite.rb +26 -4
- data/lib/sequel/core.rb +5 -2
- data/lib/sequel/deprecated.rb +13 -0
- data/lib/sequel/extensions/pg_auto_parameterize.rb +5 -0
- data/lib/sequel/extensions/pg_extended_date_support.rb +3 -3
- data/lib/sequel/extensions/virtual_row_core_refinements.rb +21 -0
- data/lib/sequel/model/base.rb +31 -11
- data/lib/sequel/plugins/throw_failures.rb +5 -4
- data/lib/sequel/plugins/validation_contexts.rb +19 -4
- data/lib/sequel/timezones.rb +3 -3
- data/lib/sequel/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b1249ac10c8a72de802f1f7bfe0f976ffbd97e0e6c24e50c8c77d2f926abdb33
|
|
4
|
+
data.tar.gz: 326ea06e85173c49f9bf2313ea29716e2f9e8dd9b9fb75216dbe9b372b930dfc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7e3a88a89a58160a1a9a5698f0da9eb758e75b74547d40969e21e2198f74ee024e78a6c22765139aed1201285f8eb78c91794689b80d1ca6ac91269ce7f02e9b
|
|
7
|
+
data.tar.gz: a2fc17d99e9b90db2ea1cd697e6e6b4af244c879acf5e64c2689c9a03da312b83f010d2903c39b2e3d8307dd3abb5e5ad45d3c6ebfff7480cc5431149e061d55
|
data/lib/sequel/adapters/jdbc.rb
CHANGED
|
@@ -85,7 +85,7 @@ module Sequel
|
|
|
85
85
|
x = convertors[:RubyDate] = Object.new
|
|
86
86
|
def x.call(r, i)
|
|
87
87
|
if v = r.getDate(i)
|
|
88
|
-
Date.civil(v.getYear + 1900, v.getMonth + 1, v.getDate)
|
|
88
|
+
Date.civil(v.getYear + 1900, v.getMonth + 1, v.getDate, Date::GREGORIAN)
|
|
89
89
|
end
|
|
90
90
|
end
|
|
91
91
|
x = convertors[:RubyTimestamp] = Object.new
|
|
@@ -44,7 +44,7 @@ module Sequel
|
|
|
44
44
|
end
|
|
45
45
|
end
|
|
46
46
|
date = Object.new
|
|
47
|
-
def date.call(s) ::Date.new(*s.split('-').map(&:to_i)) end
|
|
47
|
+
def date.call(s) ::Date.new(*s.split('-').map(&:to_i), Date::GREGORIAN) end
|
|
48
48
|
TYPE_TRANSLATOR_DATE = date.freeze
|
|
49
49
|
bytea = Object.new
|
|
50
50
|
def bytea.call(str)
|
|
@@ -931,6 +931,19 @@ module Sequel
|
|
|
931
931
|
pg_class_relname(relkind, opts)
|
|
932
932
|
end
|
|
933
933
|
|
|
934
|
+
# Run the WAIT FOR LSN command with the given options. Returns either
|
|
935
|
+
# "success", "timeout", or "not in recovery". Arguments:
|
|
936
|
+
# +mode+ :: The type of LSN processing to wait for. Can be +nil+, +:standby_replay+,
|
|
937
|
+
# +:standby_write+, +:standby_flush+, or +primary_flush+
|
|
938
|
+
# +server+ :: The server on which to run the command.
|
|
939
|
+
# +timeout+ :: Timeout to wait for. +0+ means indefinitely.
|
|
940
|
+
# +no_throw+ :: Uses +NO_THROW+, which avoids throwing an error if there is a timeout
|
|
941
|
+
# or when run on the primary.
|
|
942
|
+
def wait_for_lsn(lsn, mode: nil, timeout: nil, no_throw: nil, server: nil)
|
|
943
|
+
wait_for_lsn_dataset(lsn, mode: mode, timeout: timeout, no_throw: no_throw, server: server).
|
|
944
|
+
single_value!
|
|
945
|
+
end
|
|
946
|
+
|
|
934
947
|
# Attempt to acquire an exclusive advisory lock with the given lock_id (which should be
|
|
935
948
|
# a 64-bit integer). If successful, yield to the block, then release the advisory lock
|
|
936
949
|
# when the block exits. If unsuccessful, raise a Sequel::AdvisoryLockError.
|
|
@@ -1962,7 +1975,7 @@ module Sequel
|
|
|
1962
1975
|
:multirange
|
|
1963
1976
|
end
|
|
1964
1977
|
|
|
1965
|
-
MIN_DATE = Date.new(-4713, 11, 24)
|
|
1978
|
+
MIN_DATE = Date.new(-4713, 11, 24, Date::GREGORIAN)
|
|
1966
1979
|
MAX_DATE = Date.new(5874897, 12, 31)
|
|
1967
1980
|
MIN_TIMESTAMP = Time.utc(-4713, 11, 24).freeze
|
|
1968
1981
|
MAX_TIMESTAMP = (Time.utc(294277) - Rational(1, 1000000)).freeze
|
|
@@ -2096,6 +2109,45 @@ module Sequel
|
|
|
2096
2109
|
:local if server_version >= 90400
|
|
2097
2110
|
# simplecov:enable
|
|
2098
2111
|
end
|
|
2112
|
+
|
|
2113
|
+
# Internals of wait_for_lsn
|
|
2114
|
+
def wait_for_lsn_dataset(lsn, mode: nil, timeout: nil, no_throw: nil, server: nil)
|
|
2115
|
+
sql = String.new
|
|
2116
|
+
sql << "WAIT FOR LSN ?"
|
|
2117
|
+
args = [lsn]
|
|
2118
|
+
|
|
2119
|
+
if mode || timeout || no_throw
|
|
2120
|
+
sql << " WITH ("
|
|
2121
|
+
sep = ""
|
|
2122
|
+
|
|
2123
|
+
case mode
|
|
2124
|
+
when nil
|
|
2125
|
+
# nothing
|
|
2126
|
+
when :standby_replay, :standby_write, :standby_flush, :primary_flush
|
|
2127
|
+
sql << sep << "MODE ?"
|
|
2128
|
+
sep = ", "
|
|
2129
|
+
args << mode.to_s
|
|
2130
|
+
else
|
|
2131
|
+
raise Error, "invalid wait_for_lsn mode argument: #{mode.inspect}"
|
|
2132
|
+
end
|
|
2133
|
+
|
|
2134
|
+
if timeout
|
|
2135
|
+
sql << sep << "TIMEOUT ?"
|
|
2136
|
+
sep = ", "
|
|
2137
|
+
args << timeout
|
|
2138
|
+
end
|
|
2139
|
+
|
|
2140
|
+
if no_throw
|
|
2141
|
+
sql << sep << "NO_THROW"
|
|
2142
|
+
end
|
|
2143
|
+
|
|
2144
|
+
sql << ")"
|
|
2145
|
+
end
|
|
2146
|
+
|
|
2147
|
+
ds = dataset
|
|
2148
|
+
ds = ds.server(server) if server
|
|
2149
|
+
ds.with_sql(Sequel::SQL::PlaceholderLiteralString.new(sql.freeze, args))
|
|
2150
|
+
end
|
|
2099
2151
|
end
|
|
2100
2152
|
|
|
2101
2153
|
module DatasetMethods
|
|
@@ -207,7 +207,17 @@ module Sequel
|
|
|
207
207
|
run "PRAGMA legacy_alter_table = 1" if sqlite_version >= 32600
|
|
208
208
|
end
|
|
209
209
|
transaction do
|
|
210
|
-
if ops.length > 1 && ops.
|
|
210
|
+
combine_constraints = if ops.length > 1 && !ops.any?{|op| op[:op] != :add_constraint && op[:op] != :set_column_null}
|
|
211
|
+
if sqlite_version >= 35300
|
|
212
|
+
!ops.all?{|op| (op[:op] == :add_constraint && op[:type] == :check) || op[:op] == :set_column_null}
|
|
213
|
+
else
|
|
214
|
+
true
|
|
215
|
+
end
|
|
216
|
+
else
|
|
217
|
+
false
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
if combine_constraints
|
|
211
221
|
null_ops, ops = ops.partition{|op| op[:op] == :set_column_null}
|
|
212
222
|
|
|
213
223
|
# Apply NULL/NOT NULL ops first, since those should be purely independent of the constraints.
|
|
@@ -261,7 +271,11 @@ module Sequel
|
|
|
261
271
|
when :set_column_default
|
|
262
272
|
duplicate_table(table){|columns| columns.each{|s| s[:default] = op[:default] if s[:name].to_s == op[:name].to_s}}
|
|
263
273
|
when :set_column_null
|
|
264
|
-
|
|
274
|
+
if sqlite_version >= 35300
|
|
275
|
+
super
|
|
276
|
+
else
|
|
277
|
+
duplicate_table(table){|columns| columns.each{|s| s[:null] = op[:null] if s[:name].to_s == op[:name].to_s}}
|
|
278
|
+
end
|
|
265
279
|
when :set_column_type
|
|
266
280
|
duplicate_table(table){|columns| columns.each{|s| s.merge!(op) if s[:name].to_s == op[:name].to_s}}
|
|
267
281
|
when :drop_constraint
|
|
@@ -282,10 +296,18 @@ module Sequel
|
|
|
282
296
|
when :unique
|
|
283
297
|
duplicate_table(table, :no_unique=>true)
|
|
284
298
|
else
|
|
285
|
-
|
|
299
|
+
if sqlite_version >= 35300
|
|
300
|
+
super
|
|
301
|
+
else
|
|
302
|
+
duplicate_table(table)
|
|
303
|
+
end
|
|
286
304
|
end
|
|
287
305
|
when :add_constraint
|
|
288
|
-
|
|
306
|
+
if op[:type] == :check && sqlite_version >= 35300
|
|
307
|
+
super
|
|
308
|
+
else
|
|
309
|
+
duplicate_table(table, :constraints=>[op])
|
|
310
|
+
end
|
|
289
311
|
when :add_constraints
|
|
290
312
|
duplicate_table(table, :constraints=>op[:ops])
|
|
291
313
|
else
|
data/lib/sequel/core.rb
CHANGED
|
@@ -352,8 +352,11 @@ module Sequel
|
|
|
352
352
|
# Converts the given +string+ into a +Date+ object.
|
|
353
353
|
#
|
|
354
354
|
# Sequel.string_to_date('2010-09-10') # Date.civil(2010, 09, 10)
|
|
355
|
+
#
|
|
356
|
+
# This assumes the proleptic gregorian calendar, since that is what
|
|
357
|
+
# is commonly used by databases.
|
|
355
358
|
def string_to_date(string)
|
|
356
|
-
Date.parse(string, Sequel.convert_two_digit_years)
|
|
359
|
+
Date.parse(string, Sequel.convert_two_digit_years, Date::GREGORIAN)
|
|
357
360
|
rescue => e
|
|
358
361
|
raise convert_exception_class(e, InvalidValue)
|
|
359
362
|
end
|
|
@@ -366,7 +369,7 @@ module Sequel
|
|
|
366
369
|
# This method is deprecated and will be removed in Sequel 6.1.
|
|
367
370
|
def string_to_datetime(string) # SEQUEL6.1: Remove
|
|
368
371
|
if datetime_class == DateTime
|
|
369
|
-
DateTime.parse(string, convert_two_digit_years)
|
|
372
|
+
DateTime.parse(string, convert_two_digit_years, Date::GREGORIAN)
|
|
370
373
|
else
|
|
371
374
|
datetime_class.parse(string)
|
|
372
375
|
end
|
data/lib/sequel/deprecated.rb
CHANGED
|
@@ -57,6 +57,19 @@ module Sequel
|
|
|
57
57
|
nil
|
|
58
58
|
end
|
|
59
59
|
|
|
60
|
+
# Handle positional argument to keyword argument conversion warnings in plugins.
|
|
61
|
+
def self.check_keywords(method, no_positional_opts, opts, kw)
|
|
62
|
+
unless no_positional_opts
|
|
63
|
+
deprecate("A positional options hash is now deprecated for #{method}. Support for this will be removed in Sequel 6. Switch to passing keywords arguments. Keys given in positional options hash: #{opts.keys.join(", ")}.")
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
unless kw.empty?
|
|
67
|
+
deprecate("Unrecognized keywords given to #{method}: #{kw.keys.join(", ")}. Backwards compatibility for this will be removed in Sequel 6.")
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
nil
|
|
71
|
+
end
|
|
72
|
+
|
|
60
73
|
# If using ruby 2.3+, use Module#deprecate_constant to deprecate the constant,
|
|
61
74
|
# otherwise do nothing as the ruby implementation does not support constant deprecation.
|
|
62
75
|
def self.deprecate_constant(mod, constant)
|
|
@@ -233,6 +233,11 @@ module Sequel
|
|
|
233
233
|
super
|
|
234
234
|
end
|
|
235
235
|
|
|
236
|
+
# Disable auto_parameterization during WAIT FOR LSN.
|
|
237
|
+
def wait_for_lsn_dataset(lsn, mode: nil, timeout: nil, no_throw: nil, server: nil)
|
|
238
|
+
_no_auto_parameterize(super)
|
|
239
|
+
end
|
|
240
|
+
|
|
236
241
|
# Disable automatic parameterization for the given table if supported.
|
|
237
242
|
def _no_auto_parameterize(table)
|
|
238
243
|
if table.is_a?(DatasetMethods)
|
|
@@ -111,12 +111,12 @@ module Sequel
|
|
|
111
111
|
end
|
|
112
112
|
if m[2]
|
|
113
113
|
dt = if Sequel.datetime_class == DateTime
|
|
114
|
-
DateTime.parse(value)
|
|
114
|
+
DateTime.parse(value, true, Date::GREGORIAN)
|
|
115
115
|
elsif TIME_CAN_PARSE_BC
|
|
116
116
|
Time.parse(value)
|
|
117
117
|
# simplecov:disable
|
|
118
118
|
else
|
|
119
|
-
DateTime.parse(value).to_time
|
|
119
|
+
DateTime.parse(value, true, Date::GREGORIAN).to_time
|
|
120
120
|
# simplecov:enable
|
|
121
121
|
end
|
|
122
122
|
|
|
@@ -236,7 +236,7 @@ module Sequel
|
|
|
236
236
|
# Work around JRuby bug #4822 in Time#to_datetime for times before date of calendar reform
|
|
237
237
|
def literal_time(time)
|
|
238
238
|
if time < TIME_YEAR_1
|
|
239
|
-
literal_datetime(DateTime.parse(super))
|
|
239
|
+
literal_datetime(DateTime.parse(super, true, Date::GREGORIAN))
|
|
240
240
|
else
|
|
241
241
|
super
|
|
242
242
|
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen-string-literal: true
|
|
2
|
+
#
|
|
3
|
+
# The virtual_row_core_refinements extension applies the core
|
|
4
|
+
# refinements when evaluating virtual row blocks:
|
|
5
|
+
#
|
|
6
|
+
# Sequel.extension :virtual_row_core_refinements
|
|
7
|
+
#
|
|
8
|
+
# This requires Proc#refined, so it is only available in Ruby 4.1.
|
|
9
|
+
|
|
10
|
+
raise "the virtual_row_core_refinements extension requires Ruby 4.1+" unless RUBY_VERSION >= "4.1" # simplecov:disable
|
|
11
|
+
|
|
12
|
+
require_relative 'core_refinements'
|
|
13
|
+
|
|
14
|
+
#
|
|
15
|
+
module Sequel::VirtualRowCoreRefinements
|
|
16
|
+
def virtual_row(&block)
|
|
17
|
+
super(&block.refined(Sequel::CoreRefinements))
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
Sequel.extend(self)
|
|
21
|
+
end
|
data/lib/sequel/model/base.rb
CHANGED
|
@@ -1340,7 +1340,7 @@ END
|
|
|
1340
1340
|
# # => #<Artist {:id=>1, ...}>
|
|
1341
1341
|
def destroy(opts = OPTS)
|
|
1342
1342
|
raise Sequel::Error, "can't destroy frozen object" if frozen?
|
|
1343
|
-
checked_save_failure(opts){checked_transaction(opts){_destroy(opts)}}
|
|
1343
|
+
checked_save_failure(raise_on_failure: opts[:raise_on_failure]){checked_transaction(opts){_destroy(opts)}}
|
|
1344
1344
|
end
|
|
1345
1345
|
|
|
1346
1346
|
# Iterates through all of the current values using each.
|
|
@@ -1629,11 +1629,9 @@ END
|
|
|
1629
1629
|
def save(opts=OPTS)
|
|
1630
1630
|
raise Sequel::Error, "can't save frozen object" if frozen?
|
|
1631
1631
|
set_server(opts[:server]) if opts[:server]
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
end
|
|
1636
|
-
checked_save_failure(opts){checked_transaction(opts){_save(opts)}}
|
|
1632
|
+
raise_on_failure = opts[:raise_on_failure]
|
|
1633
|
+
return unless validate!(validate: opts[:validate], raise_on_failure: raise_on_failure)
|
|
1634
|
+
checked_save_failure(raise_on_failure: raise_on_failure){checked_transaction(opts){_save(opts)}}
|
|
1637
1635
|
end
|
|
1638
1636
|
|
|
1639
1637
|
# Saves only changed columns if the object has been modified.
|
|
@@ -1772,6 +1770,21 @@ END
|
|
|
1772
1770
|
def validate
|
|
1773
1771
|
end
|
|
1774
1772
|
|
|
1773
|
+
# Performs the same validation that #save performs internally, running validation hooks.
|
|
1774
|
+
# Returns true if the object is valid. On failure, raises by default, but can return false
|
|
1775
|
+
# if +raise_on_failure+ is true. Arguments:
|
|
1776
|
+
# +validate+ :: Whether or not perform validation (if false, only runs the validation hooks)
|
|
1777
|
+
# +raise_on_failure+ :: Whether to raise if validation or a validation hook fails (defaults
|
|
1778
|
+
# to +raise_on_save_failure+ setting)
|
|
1779
|
+
def validate!(validate: nil, raise_on_failure: nil)
|
|
1780
|
+
if _save_valid?(validate: validate)
|
|
1781
|
+
true
|
|
1782
|
+
else
|
|
1783
|
+
raise(validation_failed_error) if raise_on_failure?(raise_on_failure: raise_on_failure)
|
|
1784
|
+
false
|
|
1785
|
+
end
|
|
1786
|
+
end
|
|
1787
|
+
|
|
1775
1788
|
# Validates the object and returns true if no errors are reported.
|
|
1776
1789
|
#
|
|
1777
1790
|
# artist.set(name: 'Valid').valid? # => true
|
|
@@ -2021,7 +2034,7 @@ END
|
|
|
2021
2034
|
return true
|
|
2022
2035
|
end
|
|
2023
2036
|
|
|
2024
|
-
checked_save_failure(opts){_valid?(opts)}
|
|
2037
|
+
checked_save_failure(raise_on_failure: opts[:raise_on_failure]){_valid?(opts)}
|
|
2025
2038
|
end
|
|
2026
2039
|
|
|
2027
2040
|
# Call _update with the given columns, if any are present.
|
|
@@ -2079,8 +2092,9 @@ END
|
|
|
2079
2092
|
|
|
2080
2093
|
# If not raising on failure, check for HookFailed
|
|
2081
2094
|
# being raised by yielding and swallow it.
|
|
2082
|
-
def checked_save_failure(opts)
|
|
2083
|
-
|
|
2095
|
+
def checked_save_failure(opts=(no_positional_opts = true; OPTS), raise_on_failure: opts[:raise_on_failure], **kw)
|
|
2096
|
+
Sequel::Deprecation.check_keywords(__callee__, no_positional_opts, opts, kw)
|
|
2097
|
+
if raise_on_failure?(raise_on_failure: raise_on_failure)
|
|
2084
2098
|
yield
|
|
2085
2099
|
else
|
|
2086
2100
|
begin
|
|
@@ -2152,8 +2166,14 @@ END
|
|
|
2152
2166
|
# :raise_on_failure option is present in the hash, use that, otherwise,
|
|
2153
2167
|
# fallback to the object's raise_on_save_failure (if set), or
|
|
2154
2168
|
# class's default (if not).
|
|
2155
|
-
def raise_on_failure?(opts)
|
|
2156
|
-
|
|
2169
|
+
def raise_on_failure?(opts=(no_positional_opts = true; OPTS), raise_on_failure: opts[:raise_on_failure], **kw)
|
|
2170
|
+
Sequel::Deprecation.check_keywords(__callee__, no_positional_opts, opts, kw)
|
|
2171
|
+
case raise_on_failure
|
|
2172
|
+
when true, false
|
|
2173
|
+
raise_on_failure
|
|
2174
|
+
else
|
|
2175
|
+
raise_on_save_failure
|
|
2176
|
+
end
|
|
2157
2177
|
end
|
|
2158
2178
|
|
|
2159
2179
|
# Raise an error appropriate to the hook type. May be swallowed by
|
|
@@ -56,11 +56,12 @@ module Sequel
|
|
|
56
56
|
end
|
|
57
57
|
|
|
58
58
|
# Catch any thrown HookFailed exceptions if not raising on failure.
|
|
59
|
-
def checked_save_failure(opts)
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
def checked_save_failure(opts=(no_positional_opts = true; OPTS), raise_on_failure: opts[:raise_on_failure], **kw)
|
|
60
|
+
Sequel::Deprecation.check_keywords(__callee__, no_positional_opts, opts, kw)
|
|
61
|
+
if raise_on_failure?(raise_on_failure: raise_on_failure)
|
|
62
|
+
super(raise_on_failure: raise_on_failure)
|
|
62
63
|
else
|
|
63
|
-
catch_hook_failures{super}
|
|
64
|
+
catch_hook_failures{super(raise_on_failure: raise_on_failure)}
|
|
64
65
|
end
|
|
65
66
|
end
|
|
66
67
|
|
|
@@ -4,7 +4,7 @@ module Sequel
|
|
|
4
4
|
module Plugins
|
|
5
5
|
# The validation_contexts plugin adds support for a validation_context method inside a validate
|
|
6
6
|
# method. You pass in the validation context to use via the :validation_context option to
|
|
7
|
-
# Sequel::Model#save
|
|
7
|
+
# Sequel::Model#save, #validate!, and #valid?:
|
|
8
8
|
#
|
|
9
9
|
# class Album < Sequel::Model
|
|
10
10
|
# plugin :validation_contexts
|
|
@@ -38,14 +38,29 @@ module Sequel
|
|
|
38
38
|
# Set via the :validation_context option passed to save/valid?.
|
|
39
39
|
attr_reader :validation_context
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
def save(opts=OPTS)
|
|
42
|
+
validation_context = @validation_context
|
|
43
|
+
@validation_context = opts[:validation_context] if opts[:validation_context]
|
|
44
|
+
super
|
|
45
|
+
ensure
|
|
46
|
+
@validation_context = validation_context if @validation_context
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def validate!(validation_context: nil, validate: nil, raise_on_failure: nil)
|
|
50
|
+
valid_context = @validation_context
|
|
51
|
+
@validation_context = validation_context unless validation_context.nil?
|
|
52
|
+
super(validate: validate, raise_on_failure: raise_on_failure)
|
|
53
|
+
ensure
|
|
54
|
+
@validation_context = valid_context if @validation_context
|
|
55
|
+
end
|
|
42
56
|
|
|
43
57
|
# Set validation context before running validations
|
|
44
|
-
def
|
|
58
|
+
def valid?(opts=OPTS)
|
|
59
|
+
validation_context = @validation_context
|
|
45
60
|
@validation_context = opts[:validation_context] if opts[:validation_context]
|
|
46
61
|
super
|
|
47
62
|
ensure
|
|
48
|
-
@validation_context =
|
|
63
|
+
@validation_context = validation_context if @validation_context
|
|
49
64
|
end
|
|
50
65
|
end
|
|
51
66
|
end
|
data/lib/sequel/timezones.rb
CHANGED
|
@@ -85,7 +85,7 @@ module Sequel
|
|
|
85
85
|
if v.is_a?(Date) && !v.is_a?(DateTime)
|
|
86
86
|
# Dates handled specially as they are assumed to already be in the application_timezone
|
|
87
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)
|
|
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, v.start)
|
|
89
89
|
else
|
|
90
90
|
Time.public_send(application_timezone == :utc ? :utc : :local, v.year, v.month, v.day)
|
|
91
91
|
end
|
|
@@ -178,9 +178,9 @@ module Sequel
|
|
|
178
178
|
if datetime_class == DateTime
|
|
179
179
|
s += Rational(ns, 1000000000) if ns
|
|
180
180
|
if off
|
|
181
|
-
DateTime.civil(y, mo, d, h, mi, s, off)
|
|
181
|
+
DateTime.civil(y, mo, d, h, mi, s, off, Date::GREGORIAN)
|
|
182
182
|
else
|
|
183
|
-
convert_input_datetime_no_offset(DateTime.civil(y, mo, d, h, mi, s), input_timezone)
|
|
183
|
+
convert_input_datetime_no_offset(DateTime.civil(y, mo, d, h, mi, s, 0, Date::GREGORIAN), input_timezone)
|
|
184
184
|
end
|
|
185
185
|
elsif off
|
|
186
186
|
s += Rational(ns, 1000000000) if ns
|
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 = 111
|
|
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.111.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jeremy Evans
|
|
@@ -304,6 +304,7 @@ files:
|
|
|
304
304
|
- lib/sequel/extensions/thread_local_timezones.rb
|
|
305
305
|
- lib/sequel/extensions/to_dot.rb
|
|
306
306
|
- lib/sequel/extensions/transaction_connection_validator.rb
|
|
307
|
+
- lib/sequel/extensions/virtual_row_core_refinements.rb
|
|
307
308
|
- lib/sequel/extensions/virtual_row_method_block.rb
|
|
308
309
|
- lib/sequel/model.rb
|
|
309
310
|
- lib/sequel/model/associations.rb
|