
Can not run more than one intersection operation
Reported by Giao Phan | December 22nd, 2009 @ 03:21 PM | in 1.1
When you try to intersect a collection that was formed from
another intersection, it fails giving this:
/home/giao/git/dm-query-builder/vendor/gems/gems/dm-core-0.10.2/lib/dm-core/query.rb:1392:in
send': undefined method
intersection' for
#<DataMapper::Query::Conditions::EqualToComparison:0xb6fe95a0>
(NoMethodError)
from /home/giao/git/dm-query-builder/vendor/gems/gems/dm-core-0.10.2/lib/dm-core/query.rb:1392:in `other_conditions'
from /home/giao/git/dm-query-builder/vendor/gems/gems/dm-core-0.10.2/lib/dm-core/query.rb:1378:in `set_operation'
from /home/giao/git/dm-query-builder/vendor/gems/gems/dm-core-0.10.2/lib/dm-core/query.rb:448:in `&'
from /home/giao/git/dm-query-builder/vendor/gems/gems/dm-core-0.10.2/lib/dm-core/collection.rb:1173:in `send'
from /home/giao/git/dm-query-builder/vendor/gems/gems/dm-core-0.10.2/lib/dm-core/collection.rb:1173:in `set_operation'
from /home/giao/git/dm-query-builder/vendor/gems/gems/dm-core-0.10.2/lib/dm-core/collection.rb:113:in `&'
from like.rb:30
I've tried it with the like and equal operator.
Comments and changes to this ticket
-
Giao Phan December 22nd, 2009 @ 05:16 PM
Looks like query_conditions is supposed to return an AbstractOperation, but since NullOperation.intersection will end up returning a Comparison (after the minimize), that breaks. Here's a patch that will prevent minimize from returning a single operand, but I'm not sure if that's the correct thing. (Maybe query_conditions should wrap Comparisons?)
diff -rwub lib/dm-core/query/conditions/operation.rb /home/giao/git/dm-query-builder/vendor/gems/gems/dm-core-0.10.2/lib/dm-core/query/conditions/operation.rb
--- lib/dm-core/query/conditions/operation.rb 2009-12-16 16:41:49.000000000 -0800 +++ /home/giao/git/dm-query-builder/vendor/gems/gems/dm-core-0.10.2/lib/dm-core/query/conditions/operation.rb 2009-12-22 14:59:50.000000000 -0800 @@ -445,7 +445,7 @@prune_operands
-
one? ? first : self
-
self end
-
-
-
Martin Gamsjaeger (snusnu) October 29th, 2010 @ 04:55 PM
- State changed from new to resolved
- Milestone set to 1.1
- Assigned user set to Piotr Solnica (solnic)
- Milestone order changed from 0 to 0
That should be fixed in http://github.com/datamapper/dm-core/commit/189a649543227044dd49518...
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »