On Tuesday, December 4, 2012 10:51:49 AM UTC-8, Charles Monteiro wrote:

> hi, I have the following code that I'm trying to represent in Sequel:
>
> SELECT col1, col2
> INTO var1  , var2
>  FROM my_table;
>
>
> I have been relying on "get" but that means breaking the above up into 2 
> calls i.e.
>
> var1 = database[:my_table].get :col1
> var2 = database[:my_table].get :col2
>
> the actual code more refactored :) i.e. my_table.get :col1 but that's not 
> relevant.
>
> what I want is one call that will return multiple values i.e something 
> like this would be ideal:
>
> var1 , var2 = database[:my_table].get :col1, col2
>
> However, the docs don't provide that as option.
>

Because of the way get is currently implemented, it can only return a 
single value.  It's possible to change that (similar to previous changes to 
map and select_map), but nobody has requested it yet.
 

> What is my next most succinct way of doing that ?
>

Probably:

  var1 , var2 = database[:my_table].select_map([:col1, col2]).first

Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sequel-talk/-/emoIPw1dzkEJ.
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