Anthony Lincoln wrote:
> Having a little trouble grabbing the autoincremented primary key from a 
> row after its successful insertion.
> 
> if I do:
> 
>           undef $id;
>              my $change = $model->update_or_create({
>                  id => "$id",
>              },{ key => 'primary' }
>              );
> 
> Shouldn't I just be able to refer to the newly incremented id via 
> $change->id?  I've tried $change->update again, and $change->reset, but 
> I can't get hold of this id until I do a separate select.

"$id" is going to pass the empty string. Get rid of the quotes.

-- 
      Matt S Trout       Offering custom development, consultancy and support
   Technical Director    contracts for Catalyst, DBIx::Class and BAST. Contact
Shadowcat Systems Ltd.  mst (at) shadowcatsystems.co.uk for more information

+ 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]/

Reply via email to