What's the proper way to generate an order by like ORDER BY myfunction(col, ?, ?) DESC
with bind values in DBIx::Class
?
Currently I use literal SQL for this, but that's not optimal for several reasons.
$rs->search(undef, { order_by => \"myfunction(col, $v1, $v2) DESC" });
I did manage to get DBIx::Class
to generate the correct ORDER BY
. Here is the code:
$rs->search(undef, {
order_by => \[
'myfunction(mycol, ?, ?) DESC', map [dummy => $_], $v1, $v2
]
});