Skip Menu |

This queue is for tickets about the Rose-DB-Object CPAN distribution.

Report information
The Basics
Id: 24332
Status: rejected
Priority: 0/
Queue: Rose-DB-Object

People
Owner: Nobody in particular
Requestors: dan.harbin [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.758
Fixed in: (no value)



Subject: "insert" method does not auto-increment when used with an existing object
Environment: perl 5.8.5, mysql, RDBO v0.758, Linux 2.6.5 To reproduce: 1) create a table with an AUTO_INCREMENT column as the primary key, and some other column as data. Populate one row. 2) create an Rose::DB::Object for that table 3) load an RDBO object for the row you created in step 1 4) alter the data via the object, i.e. $obj->data('something different') 5) insert the new row with $obj->insert or $obj->save(insert => 1) You get a duplicate entry error for this new row. I expected: A new row inserted with the primary key incremented, and different data in the second column. Workaround: Manually create a new row with the "new" method. This can be painful if you want to copy another row, but change only one column's data.
From: JSIRACUSA [...] cpan.org
This is working as designed. Conceptually, each object is tied to one and only one row. If you want to copy a row and change one column, the clone_and_reset() helper method (or similar approach) is probably what you should use. http://search.cpan.org/dist/Rose-DB-Object/lib/Rose/DB/Object/Helpers.pm#clone_and_reset