Hi: I believe the PK::Auto class will deal with that; you just need to do the insert, and your database's sequence generator or similar will take care of ensuring unique user id's. You only need to use last_insert_id (or whatever the method was) to grab the last inserted id if you are interested -- it's not strictly necessary for the purposes of insertion.
Hope this answers your question. For future reference, I believe the Cookbook or the DocMap might be helpful for answering this type of question. Cheers, Jonathan On Tue, Mar 3, 2009 at 8:24 AM, Dermot <[email protected]> wrote: > Hi > > (sorry for the abortive email earlier, dammed tab key ) > > When creating a new row and also creating rows in a related has_many > or has_one resultset, how do you set the FK in the related table. > In this example, artist_id. > > > my $artist = { > name => 'the smiths', > cds => [ > {title => "hatful of hollow", artist_id => }, > {title => 'meat is murder', artist_id => }, > ]}; > > > Similarly, should I be using 'last_insert_id +1 ' on the artist table > to set it's PK or does DBIx::Class::Core take care of that? > TIA, > Dp. > > _______________________________________________ > List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class > IRC: irc.perl.org#dbix-class > SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/ > Searchable Archive: http://www.grokbase.com/group/[email protected] > _______________________________________________ List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class IRC: irc.perl.org#dbix-class SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/ Searchable Archive: http://www.grokbase.com/group/[email protected]
