Using Sequel with the mysql2 adapter, I set "Sequel.datetime_class =
DateTime", yet I'm getting back a Time object from a query; why?
For example, in the following, the class of result[:start_time_dt] ends up
being Time, not DateTime:
----
Sequel.single_threaded = true
Sequel.application_timezone = :utc
Sequel.database_timezone = :local
Sequel.typecast_timezone = :local
Sequel.datetime_class = DateTime
events = DB[:mysql2_datetime_class_test_events]
start_time = DateTime.parse('2020-12-01 08:00:00 -06:00').new_offset(0)
id = events.insert(start_time_dt: start_time)
result = events.where(id: id).first
result[:start_time_dt].class
----
Environment:
* Ruby 2.0.0p648
* Sequel 5.39.0
* Mysql2 0.5.3
* MariaDB Connector/C 3.1.11
I saw the sequel-talk conversation "Time object returned from DB although
Sequel.datetime_class = DateTime" from 2012
https://groups.google.com/g/sequel-talk/c/ybfJsUxM4oM/m/IIcK_D9X-jEJ
but I was half hoping that the issue had been fixed since then.
Thank you!
Lewis
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/sequel-talk/1bb7b2cc-a8b4-4682-b0a5-0490619f6dcfn%40googlegroups.com.