rahed <[EMAIL PROTECTED]> writes:
> select id,round((julianday(date2) - julianday(date1))*86400) as 'tdiff'
> from mytable;
I proceeded and created a private SQLite function myfunc.
my $dbh = $c->model('MyModelDB')->storage->dbh;
$dbh->func('myfunc',2,\&subtract,'create_function');
sub subtract {
my (
$difference,
$end,
$start,
);
($end,$start) = @_;
$difference = ($end-$start)*86400;
return $difference;
}
And in the search
select => {round=>{myfunc=>[{'julianday'=>'t_end_diag'},
{'julianday'=>'t_start_diag'},
],
};
This produces the required select. Can I go without a private function?
--
Radek
_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/[email protected]/