On 11 Dec 2006, at 00:42, Paul Makepeace wrote:
I have a schema: [publication <- publication_source -> source] and I'm
trying to update the source_uid in the publication_source join table
for a given publication. My strategy is to look for the row, if it
exists update the source_uid, or create the join table row.
my @ps = $publication->publication_source({ rank => $rank });
if (@ps) {
$ps[0]->source_uid($source_uid);
$ps[0]->update;
} else {
$publication->add_to_publication_source({ rank => $rank,
source_uid => $source_uid });
}
The problem comes that upon update the system attempts to identify
which row to update using the *new* value of source_uid. Witness:
UPDATE publication_source SET source_uid = ? WHERE (
publication_uid = ? AND rank = ? AND source_uid = ? ) (`282', `4355',
`2', `282')
So it's apparently not maintaining the old PK.
Correct. Scheduled to be fixed on -current before 08000
--
Matt S Trout, Technical Director, Shadowcat Systems Ltd.
Offering custom development, consultancy and support contracts for
Catalyst,
DBIx::Class and BAST. Contact mst (at) shadowcatsystems.co.uk for
details.
+ Help us build a better perl ORM: http://dbix-
class.shadowcatsystems.co.uk/ +
_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/[email protected]/