Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Using search_where with an order_by

by barrycarlyon (Beadle)
on Jul 04, 2006 at 11:28 UTC ( [id://559146]=perlquestion: print w/replies, xml ) Need Help??

barrycarlyon has asked for the wisdom of the Perl Monks concerning the following question:

G'day Fellow Monks

I was told that to add a order by to a search you do

my whatever = db file->search(constraints, {order_by=>'column direction'} );

However this dosent work when using search_where, can anyone offer a solution?

Update: Class::DBI, for search
And Class::DBI::AbstractSearch for the search_where

Yours, Bazza

Barry Carlyon barry@barrycarlyon.co.uk

Replies are listed 'Best First'.
Re: Using search_where with an order_by
by Gilimanjaro (Hermit) on Jul 04, 2006 at 11:50 UTC

    Well, first of all you'll want to put the constraints between curly braces too if you use order_by or limit clauses, and secondly make sure you have a recent Class::DBI::AbstractSearch version; before version 0.05 the order_by option was named order.

    Also, you may want to check the documentation for Class::DBI::AbstractSearch and SQL::Abstract to make sure you're using them to their full potential.

Re: Using search_where with a and order_by
by gellyfish (Monsignor) on Jul 04, 2006 at 11:34 UTC

    Perl doesn't have any mechanism to "add a order by to a search" so you must be using some module, perhaps you could enlighten us with more detail in this regard.

    /J\

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://559146]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (7)
As of 2024-04-23 11:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found