[Dbix-class] how to search by date?

Michael Higgins linux at evolone.org
Tue Jan 15 03:42:50 GMT 2008


On Tue, 15 Jan 2008 00:23:23 +0100
Tobias Kremer <list at funkreich.de> wrote:

> Am 15.01.2008 um 00:13 schrieb Michael Higgins:
> > Shouldn't this datetime cast/conversion thing be automagical?
> >
> >    eval { $rs = $schema->resultset('DB::DATA')->search(
> >                        {Name  => {'like', $name_like},
> >                     "the date" => \"= cast ('01/4/2008' as
> > datetime)" })};
> >
> > I just can't figure out, I'm sure, where the syntax is documented
> > for searching by datetime-type of column data via DBIx::Class.
> 
> 
> Use DateTime and the following DBIC component for automatic
> inflating/ deflating to/from your database:
> 
> http://search.cpan.org/dist/DBIx-Class/lib/DBIx/Class/InflateColumn/DateTime.pm
> 

Thanks, Tobias. 

However, 

DBIx::Class::InflateColumn::get_inflated_column(): Couldn't load
DateTime::Format::MySQL: Can't locate DateTime/Format/MySQL.pm 

[ CPAN ]

Then, 

Invalid date format: 2008-01-14 00:00:00.000 at /usr/lib/perl5/vendor_perl/5.8.8/DBIx/Class/InflateColumn/DateTime.pm line 76

It works on the setup side, in my query (for whatever reason it returns
today's orders), but I can't make ->mdy() call on my return row... :0-(

Any thoughts? Does this need a DateTime/Format/MSSQL.pm module, or
something? That seems doable, but if that's the case, wouldn't
DBIx-Class/lib/DBIx/Class/InflateColumn/DateTime.pm need to be changed
quite a bit? (I can't make heads or tails of how this calls MySQL.pm.)

So, IOW, I'm up the creek with no paddle over MSSQL-specific stuff yet
again?

Any thoughts appreciated. ;-)

-- 
 |\  /|        |   |          ~ ~  
 | \/ |        |---|          `|` ?
 |    |ichael  |   |iggins    \^ /
 michael.higgins[at]evolone[dot]org



More information about the DBIx-Class mailing list