Michael Higgins wrote:
> Hello, Cat-list-ers,
>
> Here's a pared-down version of my question, hoping it's an easy one:
>
> ERROR:
> "DBIx::Class::ResultSet::update(): Error executing 'UPDATE ...
> Duplicate entry '140949' for key 1 at
>
> QUESTION:
> How do we specify UPDATE ... blah WHERE (ID='UNIQUE')
>
> CODE:
> my $result = [$c->model('WhateverDB::Whatever')->update({id => $id},{
> this=>that,
> another=>something,
> });]
>
> How to update with the unique column... or do I just have to delete the old
> record and insert a new one from scratch?
>
> TIA,
>
Does not compute.
First, I'm going to assume id is your primary key. Why would you want to
change that?
Second, based on the error you've provided you already have another
record with the same $id you're trying to update this record to...
Aside from that, conceptually, you want to find, then alter something...
->find($oldid)->update({id => $newid});
Whether the db/dbix will alow you to move the primary key like that, I
can't say. I generally try to avoid evil magic.
-=Chris
signature.asc
Description: OpenPGP digital signature
_______________________________________________ List: [email protected] Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[email protected]/ Dev site: http://dev.catalyst.perl.org/
