提交 a2de667b 编写于 作者: J Jeremy Daer

Merge pull request #24549 from kamipo/fix_quoted_time

Should keep quoting behaivor of a time column value in sqlite3 adapter
...@@ -14,6 +14,10 @@ def quote_column_name(name) ...@@ -14,6 +14,10 @@ def quote_column_name(name)
@quoted_column_names[name] ||= %Q("#{super.gsub('"', '""')}") @quoted_column_names[name] ||= %Q("#{super.gsub('"', '""')}")
end end
def quoted_time(value)
quoted_date(value)
end
private private
def _quote(value) def _quote(value)
......
...@@ -8,9 +8,7 @@ module ConnectionAdapters ...@@ -8,9 +8,7 @@ module ConnectionAdapters
class SQLite3Adapter class SQLite3Adapter
class QuotingTest < ActiveRecord::SQLite3TestCase class QuotingTest < ActiveRecord::SQLite3TestCase
def setup def setup
@conn = Base.sqlite3_connection :database => ':memory:', @conn = ActiveRecord::Base.connection
:adapter => 'sqlite3',
:timeout => 100
end end
def test_type_cast_binary_encoding_without_logger def test_type_cast_binary_encoding_without_logger
...@@ -89,6 +87,13 @@ def test_quoting_binary_strings ...@@ -89,6 +87,13 @@ def test_quoting_binary_strings
assert_equal "'hello'", @conn.quote(type.serialize(value)) assert_equal "'hello'", @conn.quote(type.serialize(value))
end end
def test_quoted_time_returns_date_qualified_time
value = ::Time.utc(2000, 1, 1, 12, 30, 0, 999999)
type = Type::Time.new
assert_equal "'2000-01-01 12:30:00.999999'", @conn.quote(type.serialize(value))
end
end end
end end
end end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册