Bug in DBI::ODBC: DateTime treated as Date

Using DBI::ODBC and it works nicely thank you.

Inserting a value into a column of type SQL datetime.

If the value is ruby type DateTime, it gets truncated to a Date on
insert. The time portion is lost.

eg 2009-10-01T21:37:14 => 2009-10-01 00:00:00.

I think the bug may be in function register_conversion around line 69 in
odbc.rb. In the case statement, since DateTime is a subclass of Date,
the Date branch is taken instead of the DateTime branch.

The fix may be as simple as re-ordering the case branches.

Anyone familiar with the code willing to comment? I’m new to ruby, so
I’d appreciate it.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs