Bug #1007: DateTime treated as Date in DBI and ODBC
http://redmine.ruby-lang.org/issues/show/1007

Author: david bennett
Status: Open, Priority: Normal

A DateTime object used to update a datetime SQL column gets converted along the way into a Date object, and thus loses the time portion.
eg: conn.execute('insert into tbl (datetimecol) values (?)', DateTime.now)
This inserts the date but not the time.

Bug seems to exist in both timestamp.rb and odbc.rb in similar form, because DateTime inherits from Date.
Around line 69 in DBI::DBD::odbc.rb
Around line 27 in DBI::timestamp.rb

Simple but partial repro case:
# test-timestamp.rb
require 'date'
require 'DBI'
puts DateTime.now
puts DBI::Timestamp.new(DateTime.now) # <== wrong value


----------------------------------------
http://redmine.ruby-lang.org