[Dbix-class] How to use order_by correctly
Justin Wheeler
dbic at datademons.com
Thu Apr 26 20:03:32 GMT 2007
$c->model('Schema::MyTable')->search({}, { order_by => 'field' })->all();
Justin
On Thu, 26 Apr 2007, RA Jones wrote:
> Hi all,
>
> How to change the order of rows returned from
> $c->model('Schema::MyTable')->all()?
>
> $c->model('Schema::MyTable')->all({order_by => 'field'}) is ignored, and
> $c->model('Schema::MyTable')->search({order_by => 'field'}) generates an
> error as the order_by phrase gets incorporated into the WHERE clause. Putting
> an undef before the hashref didn't do it either.
>
> I'm currently achieving a field sort post-db retrieval using Sort::Key, but
> would like to nail my error for future use. Thanks.
> --
> Richard Jones
> Leeds, UK
>
>
> _______________________________________________
> 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/dbix-class@lists.rawmode.org/
>
More information about the Dbix-class
mailing list