Re: [Dbix-class] Re: NULLS FIRST

2013-08-25 Thread Peter Rabbitson
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 ilm...@ilmari.org
  wrote:
 
  Bill Moseley mose...@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


___
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/dbix-class@lists.scsys.co.uk


Re: [Dbix-class] Re: NULLS FIRST

2013-08-24 Thread Bill Moseley
On Sat, Aug 24, 2013 at 6:50 AM, Dagfinn Ilmari Mannsåker ilm...@ilmari.org
 wrote:

 Bill Moseley mose...@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',
   ],


-- 
Bill Moseley
mose...@hank.org
___
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/dbix-class@lists.scsys.co.uk