On Dec 14, 1:40 pm, Jason Thomas <[email protected]> wrote:
> Somehow when I do the following query:
>
> db[:mytable].select(:time).where(:time =>t1...t2)  # where t1 and t1
> are Ruby Time objects
>
> Sequel converts it intelligently into:
>
> "SELECT \"TIME\" FROM \"MYTABLE\" WHERE ((\"TIME\" >= TIMESTAMP
> '2009-01-01 00:00:00.000000 -07:00') AND (\"TIME\" < TIMESTAMP
> '2009-06-01 00:00:00.000000 -06:00'))"
>
> I have to create my own custom query and when I pass my own Ruby Time
> objects into the query I get errors because Time.to_s does not formate
> the timezone correctly:
>
> irb(main):085:0> time = Time.parse("2009/1/1")
> => 2009-01-01 00:00:00 -0700
>
> What secret method are you calling to produce the following from Ruby
> Time:
> 2009-01-01 00:00:00.000000 -07:00

This is an open source project, please read the source:

https://github.com/jeremyevans/sequel/blob/master/lib/sequel/dataset/sql.rb#L575
https://github.com/jeremyevans/sequel/blob/master/lib/sequel/adapters/shared/oracle.rb#L166

Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
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