mirror of
https://github.com/github/rails.git
synced 2026-01-30 16:58:15 -05:00
SQLServer: work around bug where some unambiguous date formats are not correctly identified if the session language is set to german. Closes #5894.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4816 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
*SVN*
|
||||
|
||||
* SQLServer: work around bug where some unambiguous date formats are not correctly identified if the session language is set to german. #5894 [Tom Ward, kruth@bfpi]
|
||||
|
||||
* SQLServer: fix eager association test. #5901 [Tom Ward]
|
||||
|
||||
* Clashing type columns due to a sloppy join shouldn't wreck single-table inheritance. #5838 [Kevin Clark]
|
||||
|
||||
@@ -356,7 +356,8 @@ module ActiveRecord
|
||||
case value
|
||||
when TrueClass then '1'
|
||||
when FalseClass then '0'
|
||||
when Time, DateTime then "'#{value.strftime("%Y-%m-%d %H:%M:%S")}'"
|
||||
when Time, DateTime then "'#{value.strftime("%Y%m%d %H:%M:%S")}'"
|
||||
when Date then "'#{value.strftime("%Y%m%d")}'"
|
||||
else super
|
||||
end
|
||||
end
|
||||
|
||||
@@ -5,11 +5,25 @@ require 'fixtures/task'
|
||||
|
||||
class SqlServerAdapterTest < Test::Unit::TestCase
|
||||
fixtures :posts, :tasks
|
||||
|
||||
|
||||
def setup
|
||||
@connection = ActiveRecord::Base.connection
|
||||
end
|
||||
|
||||
|
||||
def teardown
|
||||
@connection.execute("SET LANGUAGE us_english")
|
||||
end
|
||||
|
||||
# SQL Server 2000 has a bug where some unambiguous date formats are not
|
||||
# correctly identified if the session language is set to german
|
||||
def test_date_insertion_when_language_is_german
|
||||
@connection.execute("SET LANGUAGE deutsch")
|
||||
|
||||
assert_nothing_raised do
|
||||
Task.create(:starting => Time.utc(2000, 1, 31, 5, 42, 0), :ending => Date.new(2006, 12, 31))
|
||||
end
|
||||
end
|
||||
|
||||
def test_execute_without_block_closes_statement
|
||||
assert_all_statements_used_are_closed do
|
||||
@connection.execute("SELECT 1")
|
||||
|
||||
Reference in New Issue
Block a user