
Binding mismatch for certain queries
Reported by gix | January 5th, 2011 @ 11:55 AM | in 1.1
The attached test case shows how combining collections can trigger a binding mismatch in DO. This only happens with Ruby 1.8 (dm 1.0.2 and master), not with 1.9.
I'm not exactly sure which queries are affected (it seems to only occur if the collections haven't been loaded earlier). I stopped looking when I noticed that the culprit seems to be different splat semantics for nil:
gix@tyr:~/dev> rvm 1.8.7 ruby -e "def fun(*args); puts args.size; end; fun(*nil)"
1
gix@tyr:~/dev> rvm 1.9.2 ruby -e "def fun(*args); puts args.size; end; fun(*nil)"
0
DataMapper::Adapters::DataObjectsAdapter#read (dm-do-adapter-1.0.2/lib/dm-do-adapter/adapter.rb:130) creates the statement and bind values like this:
statement, bind_values = select_statement(query)
bind_values
is nil, and then passed to the
reader:
reader = command.execute_reader(*bind_values)
Comments and changes to this ticket
-
Martin Gamsjaeger (snusnu) January 16th, 2011 @ 03:40 PM
- State changed from new to confirmed
-
Martin Gamsjaeger (snusnu) January 16th, 2011 @ 05:40 PM
- State changed from confirmed to accepted
- Assigned user set to Martin Gamsjaeger (snusnu)
- Milestone set to 1.1
- Milestone order changed from 196323 to 0
-
Dan Kubb (dkubb) January 16th, 2011 @ 05:47 PM
- State changed from accepted to resolved
(from [de53eac58223804116dc3cd09f4c092f093afc85]) Handle different splat semantics for nil on 1.8 and 1.9
[#1468 state:resolved] https://github.com/datamapper/dm-do-adapter/commit/de53eac582238041...
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 »
People watching this ticket
Attachments
Referenced by
-
1468 Binding mismatch for certain queries [#1468 state:resolved] https://github.com/datamapper/dm-...