Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should keep quoting behaivor of a time column value in sqlite3 adapter #24549

Merged
merged 1 commit into from
Apr 15, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ def quote_column_name(name)
@quoted_column_names[name] ||= %Q("#{super.gsub('"', '""')}")
end

def quoted_time(value)
quoted_date(value)
end

private

def _quote(value)
Expand Down
11 changes: 8 additions & 3 deletions activerecord/test/cases/adapters/sqlite3/quoting_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ module ConnectionAdapters
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
Expand Down Expand Up @@ -89,6 +87,13 @@ def test_quoting_binary_strings

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
Expand Down