File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed
lib/active_record/connection_adapters/sqlite3
test/cases/adapters/sqlite3 Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -50,6 +50,19 @@ def quote_table_name(name)
50
50
end
51
51
end
52
52
53
+ def quote ( value ) # :nodoc:
54
+ case value
55
+ when Numeric
56
+ if value . finite?
57
+ super
58
+ else
59
+ "'#{ value } '"
60
+ end
61
+ else
62
+ super
63
+ end
64
+ end
65
+
53
66
def quote_string ( s )
54
67
::SQLite3 ::Database . quote ( s )
55
68
end
Original file line number Diff line number Diff line change @@ -95,4 +95,16 @@ def test_quoted_time_dst_local
95
95
end
96
96
end
97
97
end
98
+
99
+ def test_quote_numeric_infinity
100
+ assert_equal "'Infinity'" , @conn . quote ( Float ::INFINITY )
101
+ assert_equal "'-Infinity'" , @conn . quote ( -Float ::INFINITY )
102
+ assert_equal "'Infinity'" , @conn . quote ( BigDecimal ( Float ::INFINITY ) )
103
+ assert_equal "'-Infinity'" , @conn . quote ( BigDecimal ( -Float ::INFINITY ) )
104
+ end
105
+
106
+ def test_quote_float_nan
107
+ assert_equal "'NaN'" , @conn . quote ( Float ::NAN )
108
+ assert_equal "'NaN'" , @conn . quote ( BigDecimal ( Float ::NAN ) )
109
+ end
98
110
end
You can’t perform that action at this time.
0 commit comments