-
Notifications
You must be signed in to change notification settings - Fork 563
Description
I have inconsistency: when procedure is returning dates they are treated using local system timezone while using select_all method it is treated as UTC (which correct and expected)
Am I missing something? I would except all adapter data retrieval methods behave the same way
CREATE PROC dbo.test AS
SELECT GETUTCDATE() utcdate
irb(main):041:0> ActiveRecord::Base.execute_procedure("test")[0]["utcdate"].zone
Execute Procedure (0.0ms) EXEC test
=> "Middle East Standard Time"
irb(main):040:0> ActiveRecord::Base.connection.select_all("select getutcdate()".force_encoding("utf-8"))[0]["utcdate"].zone
(0.0ms) EXEC sp_executesql N'select getutcdate() as utcdate'
=> "UTC"
irb(main):001:0> TinyTds::Client.default_query_options
=> {:as=>:hash, :symbolize_keys=>false, :cache_rows=>true, :timezone=>:local, :empty_sets=>true}
updating timezone from local to utc solves the problem but I am not sure if it should not be set by the adapter itself to be consistent
the same issue is here #266
but I must say that ActiveRecord's timezone is left at utc so it is somehow not being propagated lower into execute_procedure tiny_tds query...
I am using tiny_tds 0.7.0, I am aware of 0.9.5 being close, maybe it will solve this issue?