Thanks for the pointer. But unfortunately that method is private. I figured out how to use it by doing:
irb(main):179:0> t=Time.now => 2010-12-14 15:57:00 -0700 irb(main):180:0> db[].literal(t) => "TIMESTAMP '2010-12-14 22:57:00.283869 +00:00'" I forked your project and added this documentation to Sequel::Dataset#literal. On Dec 14, 3:46 pm, Jeremy Evans <[email protected]> wrote: > 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/...https://github.com/jeremyevans/sequel/blob/master/lib/sequel/adapters... > > 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.
