On May 20, 2:12 pm, Eric <[email protected]> wrote:
> ok, that bought another round of confusion to me.  I am trying to use
> Sequel v.3.0, but still am on Ruby v.1.8.7.  I guess one day I will
> make the plunge to v.1.9.
>
> Why the use of a hash in the order clause?  What if I only had one
> element to sort case insensitive plus something else?  for example
> sorting by last name and then id?

It's not a hash, it's a block call.  You didn't use the syntax I gave
you.

> Emp.select( :id, :f_name ).order( { [lower( f_name )] }, :id )
>
> returns 'odd number list for hash' error.

As it should.  Try the following:

  Emp.select(:id, :f_name).order{[lower(f_name), id]}

> I just had another thought.  Which would be more efficient?  To let
> the database (even if SQLite) to do the string concatenation or do it
> after returning to Ruby?  I try to let databases do as much as
> possible, since they are already optimized to number crunching and
> analytics without me re-inventing the wheel.  But something as simple
> as this is probably a wash, but just looking for all ya'lls thoughts.
> As above:

Generally it's faster to do it in the database.  But if you have a
high load on the database and want to spread the processing to the
clients, you can do it in the app (that only makes sense if the
database server is different from the web app server).  Sequel makes
either method relatively easy.

Jeremy
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to