Looks like there've been some improvements around type conversions for 
Oracle DATE columns when using JDBC.  Yesterday I happened to run into the 
issue mentioned in this stackoverflow 
post<http://stackoverflow.com/questions/6138542/how-do-i-convert-a-jdbcoracle-date-into-a-datetime-for-ruby>(while
 using 3.28).  
After switching to the master branch, I found that it now preserved the time 
component when using a Time or DateTime to set the value of a Model 
attribute backed by a DATE column (instead of setting it to midnight).  
However, 
although the time now makes it into the database I don't seem to be able to 
access it again from Sequel.    That attribute of the model object returns a 
Date.  For example:

m = ModelSubclass.create do |x|
  x.date_field = DateTime.now
  puts x.date_field  #class is Time
end
 
puts m.date_field  #class is Date

Based on the comment from the stackoverflow post, I tried handling 
Java::JavaSQL::Date in the convert_type method for the Dataset in the 
jdbc/oracle adapter.  It seems that may have already lost the time component 
by that point though, as when I use db.to_application_timestamp on it I end 
up getting back a Time with the correct date but a time of midnight.  I 
looked through the recent commits to see what the changes were to find out 
if I needed to configure or do differently when creating model objects but I 
didn't see anything that stood out.  (Is this 
change<https://github.com/jeremyevans/sequel/commit/0c94ba685de376b503f3f83f31e31aa7c16d3603>probably
 the one that now allows the date and time to make it to the 
database?)  Are there any other changes I could try to the type conversion 
method?

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sequel-talk/-/E8snUw-bdcIJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en.

Reply via email to