#1260 unconfirmed
Xavier Shay

Inferring DATE types doesn't work for oracle

Reported by Xavier Shay | May 4th, 2010 @ 10:46 PM

There was an optimization in do_oracle that created Time objects instead of DateTime for speed reasons. This is either:

1) Broken when executing raw SQL, or
2) An invalid optimization, since the DATE type can contain values outside the range of a Time object

I'm not familiar enough with the code or Oracle to know 'correct' behaviour. The following commit fixed the issue for my use case though:

To replicate:

> repository.adapter.select("SELECT my_date_column FROM my_table")
DataObjects::DataError: Couldn't parse time from class DateTime object (code: , sql state: , query: , uri: )
    from /Library/Ruby/Gems/1.8/gems/dm-core-0.10.2/lib/dm-core/adapters/data_objects_adapter.rb:285:in `next!'
    from /Library/Ruby/Gems/1.8/gems/dm-core-0.10.2/lib/dm-core/adapters/data_objects_adapter.rb:285:in `select_fields'
    from /Library/Ruby/Gems/1.8/gems/dm-core-0.10.2/lib/dm-core/adapters/data_objects_adapter.rb:37:in `select'
    from /Library/Ruby/Gems/1.8/gems/dm-core-0.10.2/lib/dm-core/adapters/data_objects_adapter.rb:269:in `with_connection'
    from /Library/Ruby/Gems/1.8/gems/dm-core-0.10.2/lib/dm-core/adapters/data_objects_adapter.rb:31:in `select'

Apologies, I don't have a development Oracle environment to provide a solid test case.

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »