Bug in DBI::ODBC: DateTime treated as Date

D

David Bennett

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top