Hi Jeremy,
I'm not sure whether this is a bug, or if I use Sequel/SQlite in a strange
way. Anyway, the code below shows the issue I'm encountering and the way
I've found to fix it... Is there something I get wrong?
require 'sequel'
db = Sequel.sqlite
db.use_timestamp_timezones=true # seen in another thread, does not change
anything
db.create_table(:test){
primary_key :id
column :latest_change, "timestamp with time zone", :default=>"now()".lit,
:null=>false
}
db[:test].insert(:latest_change => Time.now)
puts db[:test].first.inspect
# => {:id=>1, :latest_change=>"2012-08-03 17:19:23.294658"}
puts db[:test].first[:latest_change].class
# => String
# Explicit proc resolves the problem for me:
db.conversion_procs['timestamp with time zone'] =
db.method(:to_application_timestamp)
puts db[:test].first[:latest_change].class
# => Time
--
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/-/mgmvyw0t2-IJ.
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.