【发布时间】:2014-03-30 04:58:56
【问题描述】:
选择 me.id、me.date_created、me.date_updated、me.yes、 me.name, me.description, me.currency, me.locked, me.skip, me.uri_part,me.user_id, 是 + 货币作为重量
根据我的想法,我有 ((weight
如何在 DBIx::Class 中生成该查询而不使用像这样的文字 SQL:
my $query = $rs->search({},
{
'+select' => \[
'yes + currency as weight',
],
rows => 1,
order_by => { -desc => [qw/weight name/] },
having => {
weight => { '<' => $self->yes + $self->currency },
},
});
use Data::Dumper;
warn Dumper($query->as_query);
我尝试使用 -as,但是,它似乎只对处理从函数生成的列有用,因为这样:
'+select' => {
'yes + currency', '-as' => 'weight'
}
产生错误
"匿名哈希中的奇数个元素在 /data/TGC/lib/TGC/DB/Result/Idea.pm 第 105 行,第 1000 行。 DBIx::Class::SQLMaker::_recurse_fields():选择参数格式错误 - 哈希中的键太多:SCALAR(0xbf14c40),weight"
【问题讨论】:
标签: perl alias dbix-class