Permalink
Browse files

Oracle: overflow Time to DateTime. Closes #7718.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6348 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 1e9e198 commit 7b9824f6e2b4df7e8b6abf8720270ae755712895 @jeremy jeremy committed Mar 6, 2007
View
@@ -1,5 +1,7 @@
*SVN*
+* Oracle: overflow Time to DateTime. #7718 [Michael Schoen]
+
* PostgreSQL: don't use async_exec and async_query with postgres-pr. #7727 [flowdelic]
* Fix has_many :through << with custom foreign keys. #6466, #7153 [naffis, Rich Collins]
@@ -507,8 +507,11 @@ def select(sql, name = nil)
when OCI8::LOB
name == 'Writable Large Object' ? row[i]: row[i].read
when OraDate
- (row[i].hour == 0 and row[i].minute == 0 and row[i].second == 0) ?
- row[i].to_date : row[i].to_time
+ if emulate_dates && (row[i].hour == 0 && row[i].minute == 0 && row[i].second == 0)
+ row[i].to_date
+ else
+ row[i].to_time rescue row[i].to_datetime
+ end
else row[i]
end unless col == 'raw_rnum_'
end
@@ -55,8 +55,8 @@ def current_adapter?(*types)
end
def uses_mocha(test_name)
+ require 'rubygems'
require 'mocha'
- require 'stubba'
yield
rescue LoadError
$stderr.puts "Skipping #{test_name} tests. `gem install mocha` and try again."
@@ -1515,7 +1515,7 @@ def test_habtm_adding_before_save_with_join_attributes
assert_equal 2, ken.projects(true).size
kenReloaded = Developer.find_by_name 'Ken'
- kenReloaded.projects.each {|prj| assert_date_from_db(now, prj.joined_on)}
+ kenReloaded.projects.each {|prj| assert_date_from_db(now, prj.joined_on.to_date)}
end
def test_habtm_saving_multiple_relationships
@@ -1653,7 +1653,7 @@ def test_removing_associations_on_destroy
end
def test_additional_columns_from_join_table
- assert_date_from_db Date.new(2004, 10, 10), Developer.find(1).projects.first.joined_on
+ assert_date_from_db Date.new(2004, 10, 10), Developer.find(1).projects.first.joined_on.to_date
end
def test_destroy_all
@@ -369,8 +369,9 @@ def test_preserving_date_objects
# SQL Server doesn't have a separate column type just for dates, so all are returned as time
return true if current_adapter?(:SQLServerAdapter)
- if current_adapter?(:SybaseAdapter)
+ if current_adapter?(:SybaseAdapter, :OracleAdapter)
# Sybase ctlib does not (yet?) support the date type; use datetime instead.
+ # Oracle treats all dates/times as Time.
assert_kind_of(
Time, Topic.find(1).last_read,
"The last_read attribute should be of the Time class"

0 comments on commit 7b9824f

Please sign in to comment.