#1468 ✓resolved
gix

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

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.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Attachments

Referenced by

Pages