Hi Jeremy,
Unfortunately I was just able to upgrade my only serious app from Sequel 2.4
to recent version. I've found a problem with select_more. If You call
select_more on a cloned dataset then the opts[:select] changes on both the
original and the cloned dataset. It caused me problem when I joined to the
cloned dataset and selected some fields from the joined dataset. In this
case the original dataset contains such fields in the select list which
belongs to tables not included in the from list. (And throws an exception).This
bug was introduced in version 2.12.0.
You can see the problem running the following code:
DB = Sequel.sqlite
ds = DB[:table].select(:name)
p ds.opts
ds2 = ds.clone
puts ds.opts[:select].object_id
puts ds2.opts[:select].object_id
p ds2.select_more(:id).opts
p ds.opts
The problem can be solved cloning the opts[:select] array before
concatenating to it as below:
def select_more(*columns, &block)
select(*Array(@opts[:select]).clone.concat(columns), &block)
end
or similarly to the pre 2.12 versions:
def select_more(*columns, &block)
select(*(Array(@opts[:select]) + columns), &block)
end
Anyway thanks for this great framework!
Tamás
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---