Hi
Consider the following: A config has many sections. A section has many
process runs. I want to find the latest process run from a config and
section combination:
my $rs = $scheduler->EpProcessRun->search(
{
'ep_config.config_name' => 'my_config',
'ep_section.section_name' => 'my_section',
},
{
select => [ { max => 'me.date_created' } ],
as => [ 'date_created' ],
'join' => {'ep_section' => ['ep_config']},
}
);
say $rs->first->get_column('date_created');
This works - but the date is text, whereas I was hoping it would be inflated
to a DateTime object (as they are with regular queries). The generated SQL
is
SELECT MAX(me.date_created)
FROM ep_process_run me
JOIN ep_section ep_section
ON ep_section.section_id = me.section_id
JOIN ep_config ep_config
ON ep_config.config_id = ep_section.config_id
WHERE ((ep_config.config_name = ? AND ep_section.section_name = ?))
I also tried
my $rs = $scheduler->EpProcessRun->search(
{
'ep_config.config_name' => 'my_config',
'ep_section.section_name' => 'my_section',
},
{
'join' => {'ep_section' => ['ep_config']},
}
);
say $rs->get_column('date_created')->max;
The generated SQL is exactly the same, and the date isn't inflated. Am I
doing something wrong, or have I hit a DBIx::Class limitation? I;m on
DBIx:Class v0.08123 on Win32
Dan
_______________________________________________
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/[email protected]