[Catalyst] Sort - ORDER BY

Will Smith willbelair at yahoo.com
Tue Nov 8 21:43:43 CET 2005


thanks Matt, I've tried that, but this is what i've got:
 
[Tue Nov  8 15:35:10 2005] [catalyst] [error] Caught exception "DBD::SQLite::db
prepare_cached failed: near "
": syntax error(1) at dbdimp.c line 268 [for Statement "SELECT artistid
FROM   artist
WHERE
"] at C:/Perl/site/lib/Ima/DBI.pm line 391."
 
--------
 
and if i am not too greedy, do you mind to give me some hint on return a "top 10 records" . These could be doe easily with sql statement. But I am develop an app using pure catalyst, so it's a bit ticky with the syntax.
 
 


Matt S Trout <dbix-class at trout.me.uk> wrote:
On Tue, Nov 08, 2005 at 11:28:51AM -0800, Will Smith wrote:
> thanks, i use DBI::RetrieveAll, which gave me error (could not find the sql)
> then I use the DBI::Sweet , no error but the result is not right
> 
> use Class::DBI::Sweet;
> ...
> $c->stash->{myartist} = cd::M::CDBI::Artist->retrieve_all( order_by => 'name' );
> ....
> Then on my template I have:
> [% WHILE (artist= myartist.next) %]
> [% artist.name %]

> [% END %]
> 
> the result is not sorted. I just wonder where i am wrong.

Try

cd::M::CDBI::Artist->search({}, { order_by => 'name' });

-- 
Matt S Trout Specialists in Perl consulting, web development, and
Technical Director UNIX/Linux systems architecture and automation. Mail
Shadowcat Systems Ltd. mst (at) shadowcatsystems.co.uk for more information

+ Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +

_______________________________________________
Catalyst mailing list
Catalyst at lists.rawmode.org
http://lists.rawmode.org/mailman/listinfo/catalyst

		
---------------------------------
 Yahoo! FareChase - Search multiple travel sites in one click.  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rawmode.org/pipermail/catalyst/attachments/20051108/82e0a15e/attachment.htm


More information about the Catalyst mailing list