From: Peter Rabbitson Date: Mon, 8 Jun 2009 11:14:08 +0000 (+0000) Subject: Commit failing test and thoughts on search arg deflation X-Git-Tag: v0.08106~19^2~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4707b40a794920d470053f2cefc6883044f1f7a2;p=dbsrgits%2FDBIx-Class.git Commit failing test and thoughts on search arg deflation --- diff --git a/lib/DBIx/Class/Storage/DBI.pm b/lib/DBIx/Class/Storage/DBI.pm index 666d318..f548355 100644 --- a/lib/DBIx/Class/Storage/DBI.pm +++ b/lib/DBIx/Class/Storage/DBI.pm @@ -1249,6 +1249,14 @@ sub _select_args { } } + # This would be the point to deflate anything found in $condition + # (and leave $attrs->{bind} intact). Problem is - inflators historically + # expect a row object. And all we have is a resultsource (it is trivial + # to extract deflator coderefs via $alias2source above). + # + # I don't see a way forward other than changing the way deflators are + # invoked, and that's just bad... + my @args = ('select', $attrs->{bind}, $ident, $bind_attrs, $select, $condition, $order); if ($attrs->{software_limit} || $sql_maker->_default_limit_syntax eq "GenericSubQ") { diff --git a/t/89inflate_datetime.t b/t/89inflate_datetime.t index ea7c930..19363d2 100644 --- a/t/89inflate_datetime.t +++ b/t/89inflate_datetime.t @@ -13,7 +13,7 @@ use DBICTest; my $schema = DBICTest->init_schema(); -plan tests => 53; +plan tests => 57; SKIP: { eval { require DateTime::Format::MySQL }; @@ -29,6 +29,14 @@ isa_ok($event->starts_at, 'DateTime', 'DateTime returned'); my $starts = $event->starts_at; is("$starts", '2006-04-25T22:24:33', 'Correct date/time'); +ok(my $row = + $schema->resultset('Event')->search({ starts_at => $starts })->single); +is(eval { $row->id }, 1, 'DT in search'); + +ok($row = + $schema->resultset('Event')->search({ starts_at => { '>=' => $starts } })->single); +is(eval { $row->id }, 1, 'DT in search with condition'); + # create using DateTime my $created = $schema->resultset('Event')->create({ starts_at => DateTime->new(year=>2006, month=>6, day=>18),