sequel 5.111.0 → 5.111.1
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/shared/oracle.rb +5 -0
- data/lib/sequel/adapters/shared/postgres.rb +5 -0
- data/lib/sequel/database/misc.rb +12 -1
- data/lib/sequel/dataset/features.rb +7 -0
- data/lib/sequel/dataset/sql.rb +9 -1
- data/lib/sequel/extensions/pg_range.rb +1 -3
- data/lib/sequel/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: aa663be1adaffaf8d34bdac717bd263b4f7ef5610b658371508540c959d84fb1
|
|
4
|
+
data.tar.gz: ca77ee5e8f322ce9d0d0c9a8036dcdc0f80818407ffcbb4c092ed3012088a157
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: edaaf3aac80e8724a786e394b07d2d7d9a3991bc931bdeb1a9fa40a2f6c4004e880cc641c01f06f9cac9666a14e7f29db5b14fe55f589108915c2245b3ddbcb0
|
|
7
|
+
data.tar.gz: 5856aaa2acec7e40ac76326d54fcb4e4452a34b577e10c4437db6a5a257ecc9e4d6cba25a81b9ae5c175ecdd39dc53219c2e6c45bea5215b705d629bba900fdf
|
|
@@ -730,6 +730,11 @@ module Sequel
|
|
|
730
730
|
end
|
|
731
731
|
end
|
|
732
732
|
|
|
733
|
+
# Oracle supports numeric literals such as 10e2 with full precision.
|
|
734
|
+
def supports_exponent_numeric_literals?
|
|
735
|
+
true
|
|
736
|
+
end
|
|
737
|
+
|
|
733
738
|
# Oracle supports quoted function names.
|
|
734
739
|
def supports_quoted_function_names?
|
|
735
740
|
true
|
|
@@ -3143,6 +3143,11 @@ module Sequel
|
|
|
3143
3143
|
db.server_version(@opts[:server])
|
|
3144
3144
|
end
|
|
3145
3145
|
|
|
3146
|
+
# PostgreSQL supports numeric literals such as 10e2 with full precision.
|
|
3147
|
+
def supports_exponent_numeric_literals?
|
|
3148
|
+
true
|
|
3149
|
+
end
|
|
3150
|
+
|
|
3146
3151
|
# PostgreSQL 9.4+ supports the FILTER clause for aggregate functions.
|
|
3147
3152
|
def supports_filtered_aggregates?
|
|
3148
3153
|
server_version >= 90400
|
data/lib/sequel/database/misc.rb
CHANGED
|
@@ -595,7 +595,7 @@ module Sequel
|
|
|
595
595
|
|
|
596
596
|
# Typecast the value to a BigDecimal
|
|
597
597
|
def typecast_value_decimal(value)
|
|
598
|
-
case value
|
|
598
|
+
v = case value
|
|
599
599
|
when BigDecimal
|
|
600
600
|
value
|
|
601
601
|
when Numeric
|
|
@@ -605,6 +605,12 @@ module Sequel
|
|
|
605
605
|
else
|
|
606
606
|
raise InvalidValue, "invalid value for BigDecimal: #{value.inspect}"
|
|
607
607
|
end
|
|
608
|
+
|
|
609
|
+
if v.exponent.abs > 1000
|
|
610
|
+
raise InvalidValue, "attempt to typecast to BigDecimal with too large exponent, likely attack"
|
|
611
|
+
end
|
|
612
|
+
|
|
613
|
+
v
|
|
608
614
|
end
|
|
609
615
|
|
|
610
616
|
# Typecast the value to a Float
|
|
@@ -622,6 +628,11 @@ module Sequel
|
|
|
622
628
|
else
|
|
623
629
|
Integer(value)
|
|
624
630
|
end
|
|
631
|
+
when BigDecimal
|
|
632
|
+
if value.exponent.abs > 1000
|
|
633
|
+
raise InvalidValue, "attempt to typecast BigDecimal with too large exponent to Integer, likely attack"
|
|
634
|
+
end
|
|
635
|
+
Integer(value)
|
|
625
636
|
else
|
|
626
637
|
Integer(value)
|
|
627
638
|
end
|
|
@@ -259,6 +259,13 @@ module Sequel
|
|
|
259
259
|
supports_cte_in_subqueries?
|
|
260
260
|
end
|
|
261
261
|
|
|
262
|
+
# Whether numeric literals such as 10e2 are supported with full precision.
|
|
263
|
+
# Most SQL databases either do not support such literals or treat them as
|
|
264
|
+
# decimal/float with limited precision.
|
|
265
|
+
def supports_exponent_numeric_literals?
|
|
266
|
+
false
|
|
267
|
+
end
|
|
268
|
+
|
|
262
269
|
# Whether the dataset supports the FILTER clause for aggregate functions.
|
|
263
270
|
# If not, support is emulated using CASE.
|
|
264
271
|
def supports_filtered_aggregates?
|
data/lib/sequel/dataset/sql.rb
CHANGED
|
@@ -1382,7 +1382,15 @@ module Sequel
|
|
|
1382
1382
|
|
|
1383
1383
|
# SQL fragment for BigDecimal
|
|
1384
1384
|
def literal_big_decimal(v)
|
|
1385
|
-
|
|
1385
|
+
if supports_exponent_numeric_literals?
|
|
1386
|
+
d = v.to_s
|
|
1387
|
+
else
|
|
1388
|
+
if v.exponent.abs > 1000
|
|
1389
|
+
raise InvalidValue, "attempt to literalize BigDecimal with too many digits, likely attack"
|
|
1390
|
+
end
|
|
1391
|
+
d = v.to_s("F")
|
|
1392
|
+
end
|
|
1393
|
+
|
|
1386
1394
|
v.nan? || v.infinite? ? "'#{d}'" : d
|
|
1387
1395
|
end
|
|
1388
1396
|
|
data/lib/sequel/version.rb
CHANGED
|
@@ -10,7 +10,7 @@ module Sequel
|
|
|
10
10
|
|
|
11
11
|
# The tiny version of Sequel. Usually 0, only bumped for bugfix
|
|
12
12
|
# releases that fix regressions from previous versions.
|
|
13
|
-
TINY =
|
|
13
|
+
TINY = 1
|
|
14
14
|
|
|
15
15
|
# The version of Sequel you are using, as a string (e.g. "2.11.0")
|
|
16
16
|
VERSION = [MAJOR, MINOR, TINY].join('.').freeze
|