mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #24549 from kamipo/fix_quoted_time
Should keep quoting behaivor of a time column value in sqlite3 adapter
This commit is contained in:
commit
a2de667b2e
2 changed files with 12 additions and 3 deletions
|
@ -14,6 +14,10 @@ module ActiveRecord
|
|||
@quoted_column_names[name] ||= %Q("#{super.gsub('"', '""')}")
|
||||
end
|
||||
|
||||
def quoted_time(value)
|
||||
quoted_date(value)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def _quote(value)
|
||||
|
|
|
@ -8,9 +8,7 @@ module ActiveRecord
|
|||
class SQLite3Adapter
|
||||
class QuotingTest < ActiveRecord::SQLite3TestCase
|
||||
def setup
|
||||
@conn = Base.sqlite3_connection :database => ':memory:',
|
||||
:adapter => 'sqlite3',
|
||||
:timeout => 100
|
||||
@conn = ActiveRecord::Base.connection
|
||||
end
|
||||
|
||||
def test_type_cast_binary_encoding_without_logger
|
||||
|
@ -89,6 +87,13 @@ module ActiveRecord
|
|||
|
||||
assert_equal "'hello'", @conn.quote(type.serialize(value))
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue