On Thu, Sep 20, 2012 at 3:22 AM, Peter Rabbitson <rabbit+d...@rabbit.us>wrote:

>
> Precisely. The problem is that we can not invoke the correct IC::DT
> deflation routine to respect possible time_zone settings. The formatter is
> fine for use only as that - a formatter. There is no practical way to tie
> the IC::DT metadata to your search criteria. There is no change in behavior
> - DBIC has always done the wrong thing (simply stringifying the DT object).
> What changed is that now you are getting a warning about it.


Sorry, I'm being a bit slow here.

Quoting the Cookbook again:


  my $dtf = $schema->storage->datetime_parser;
  my $rs = $schema->resultset('users')->search(
    {
      signup_date => {
        -between => [
          $dtf->format_datetime($dt_start),
          $dtf->format_datetime($dt_end),
        ],
      }
    },
  );


So, if $dt_start is not floating (has a timezone) then
$dtf->format_datetime( $dt_start ) would be a sting that included the
timezone which is needed to specify a point in time to the database.

Is the problem that the above query is passed directly to SQL::Abstract
which doesn't have access to the storage object, and thus cannot get at the
formatter?

Couldn't something like Data::Visitor be used to find all the DateTIme
objects in the criteria and then run them through the formater?   search()
can get at the storage object, right?

If I pass in a floating DateTime then that's my own fault and maybe that's
where it should warn (or even throw and error).




-- 
Bill Moseley
mose...@hank.org
_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk

Reply via email to