Milliseconds are stripped?

13 views
Skip to first unread message

revgum

unread,
Feb 3, 2010, 1:53:15 PM2/3/10
to Rails SQLServer Adapter
I've read another thread in this group regarding the millisecond
support using _before_type_cast on the column name but I don't seem to
be getting the same result:

ActiveRecord connection used:

=> #<ActiveRecord::ConnectionAdapters::SQLServerAdapter version:
2.2.21, year: 2008, connection_options:
["DBI:ADO:Provider=SQLOLEDB;Data Source=.......


>> ClientConfig.first.client_config_update_dttm_before_type_cast
=> "2010/01/20 23:14:48"
>> ClientConfig.first.client_config_update_dttm_before_type_cast.class
=> String
>> ClientConfig.first.client_config_update_dttm
=> Wed, 20 Jan 2010 23:14:48 UTC +00:00
>> ClientConfig.first.client_config_update_dttm.class
=> ActiveSupport::TimeWithZone

Can anyone lend a hand getting at the milliseconds that are stored in
the database?

Ken Collins

unread,
Feb 3, 2010, 9:06:42 PM2/3/10
to rails-sqlse...@googlegroups.com

The adapter is written to use DBI/DBD-ODBC for the back end. There is a file in core_ext named dbi.rb that does all the work to support both ruby objects going in and converting objects to ruby coming out of the DB with the correct milliseconds stored in the DB. This was one of the more detailed part of the adapter when I was doing my work on it. The adapter_test_sqlserver.rb file even has tests in the context "For chronic data types" that covers all this.

The problem is that none of this work has been done assuming an ADO connection. In fact, unless I've forgotten, no one has even run the tests under that either. If you want to pick that up and put in the code that does what dbi.rb is doing, I'd love to integrate a patch.

- Ken

> --
> You received this message because you are subscribed to the Google Groups "Rails SQLServer Adapter" group.
> To post to this group, send email to rails-sqlse...@googlegroups.com.
> To unsubscribe from this group, send email to rails-sqlserver-a...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/rails-sqlserver-adapter?hl=en.
>

Reply all
Reply to author
Forward
0 new messages