#688 ✓resolved
Paul Dlug

Exception using non-primitive keys in relationship

Reported by Paul Dlug | December 2nd, 2008 @ 12:26 PM | in 0.10.0

If the parent of a relationship (one-to-many in my test case) is a non-primitive primary key such as something from DM::Types calling create on the parent to create a child fails. The following exception is raised:

/Library/Ruby/Gems/1.8/gems/data_objects-0.9.9/lib/data_objects/quoting.rb:52:in quote_value': Don't know how to quote #<UUID:0x95fd26 UUID:13a27945-f7b2-4963-ab77-95abe5dfadb6> (RuntimeError)

from /Library/Ruby/Gems/1.8/gems/data_objects-0.9.9/lib/data_objects/quoting.rb:90:in `quote_array'
from /Library/Ruby/Gems/1.8/gems/data_objects-0.9.9/lib/data_objects/quoting.rb:90:in `map'
from /Library/Ruby/Gems/1.8/gems/data_objects-0.9.9/lib/data_objects/quoting.rb:90:in `quote_array'
from /Library/Ruby/Gems/1.8/gems/data_objects-0.9.9/lib/data_objects/quoting.rb:45:in `quote_value'
from /Library/Ruby/Gems/1.8/gems/data_objects-0.9.9/lib/data_objects/quoting.rb:27:in `escape_sql'
from /Library/Ruby/Gems/1.8/gems/data_objects-0.9.9/lib/data_objects/quoting.rb:26:in `gsub!'
from /Library/Ruby/Gems/1.8/gems/data_objects-0.9.9/lib/data_objects/quoting.rb:26:in `escape_sql'
from /Library/Ruby/Gems/1.8/gems/dm-core-0.9.8/lib/dm-core/adapters/data_objects_adapter.rb:60:in `execute_reader'
 ... 19 levels...
from /Library/Ruby/Gems/1.8/gems/dm-core-0.9.8/lib/dm-core/associations/one_to_many.rb:394:in `children'
from /Library/Ruby/Gems/1.8/gems/dm-core-0.9.8/lib/dm-core/associations/one_to_many.rb:400:in `assert_mutable'
from /Library/Ruby/Gems/1.8/gems/dm-core-0.9.8/lib/dm-core/associations/one_to_many.rb:268:in `create'
from dm-types-relationship-test.rb:33

Please see the attached test case for full details. This occurs with any non-primitive type I tested, not just UUID. It seems only the type of the key of the parent matters, probably something not calling dump on the type before serializing. This does not occur if you create the child object by itself passing in the parent (demonstrated in the test).

Tested with the latest sam/dm-core and dkubb/dm-core.

Comments and changes to this ticket

  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) December 2nd, 2008 @ 03:51 PM

    • State changed from “new” to “open”

    I can confirm this issue at my end. I've modified Paul's script slightly and attached it to this ticket.

    I just did a quick check over Query#bind_values, which is where the DO Adapter gets the bind values from, and earlier Query#dump_custom_value both appear to do the correct thing to extract the value from a custom property.

    If it's broken for all types, then I'd probably check to see if dump_custom_value is getting called and it's setting the correct value in the conditions clause, which is later used to get the bind values for the query.

  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) January 8th, 2009 @ 04:51 AM

    • State changed from “open” to “accepted”
    • Assigned user set to “Dan Kubb (dkubb)”
  • Jonathan Stott (namelessjon)

    Jonathan Stott (namelessjon) February 22nd, 2009 @ 03:40 PM

    • Tag changed from associations, dm-core, dm-types, relationships to associations, dm-core, dm-types, one_file_test, relationships

    Still an issue as of 02a93b11ce576361789340f78babf7bd4f796161.

    Attached test is updated for 0.10.0

  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) June 16th, 2009 @ 03:30 AM

    • State changed from “accepted” to “resolved”
    • Milestone set to 0.10.0

    I can confirm this is now resolved in dm-core/next. Attached is the script I used to verify the resolution.

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 »

People watching this ticket

Attachments

Pages