[Dbix-class] Re: NULLS FIRST
Peter Rabbitson
rabbit+dbic at rabbit.us
Sun Aug 25 08:49:37 GMT 2013
On Sat, Aug 24, 2013 at 05:33:58PM -0700, Bill Moseley wrote:
> On Sat, Aug 24, 2013 at 6:50 AM, Dagfinn Ilmari Mannsåker <ilmari at ilmari.org
> > wrote:
>
> > Bill Moseley <moseley at hank.org> writes:
> >
> > > I have some code that builds up hash references of sort keys.
> > >
> > > order_by => [
> > > { -desc => 'value' },
> > > { -asc => 'modified_time' },
> > > ],
> > >
> > >
> > > Is there support for NULLS { FIRST | LAST } with that syntax?
> >
> > There isn't currently. There's rudimentary support in git branches of
> > SQL::Abstract¹ and DBIx::Class², but because several of the limit dialects
> > require mangling the ordering clause of the original query, this can't
> > really be done sensibly until the porting to Data::Query is done.
> >
>
> What I ended up doing was use a scalar reference. For example:
>
> order_by => [
> { -desc => 'foo' },
> \'bar DESC NULLS FIRST',
> ],
>
Yup, which is the right thing to do in this case and will keep working
in your app even after a first/last syntax is added.
Cheers
More information about the DBIx-Class
mailing list