There is a critical part in my application where I need to generate the SQL 
by myself.

It would be easier to process the results of this generated dynamic SQL if 
I could iterate over each row by index.

I mean, instead of having DB[sql].all to return something like [{tid: 23, 
tname: 'Some name'}, ...] I'd prefer to get something like: [[23, "Some 
name"], [...], ...].

Currently I'm doing something like below, but I'd like to know if there is 
some method that already does that and that I'm not aware of:

builder = QueryBuilder.new(params)
json = DB[builder.sql].map do |r|
  r = r.map{|k, v| v} # this is the trick I'm currently using
  builder.columns.map do |c|
    raw = r.shift
    case c[:type]
    when 'range' then [raw, r.shift]
    ...
    else raw
  end
end

-- 
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/-/kMv559lXShwJ.
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