[Dbix-class] Howto create multiple rows with INSERT INTO () SELECT FROM

Peter Rabbitson rabbit+dbic at rabbit.us
Mon Sep 20 09:12:49 GMT 2010


Joerg Braun wrote:
> I can update a bunch of rows with resultset->search(...)->update(...).
> 
> Is it possible to model with DBIC an SQL like
> 
> INSERT INTO <table> ( <cols>) SELECT <cols> FROM <table> WHERE <cond>;
> 

Not yet, but this is a feature we'd like to have. You can kick-start the
process by contributing an extra test to the test suite. Something like:

$rs->populate ([ \@column_names, $source_rs->as_query ]);

The repo can be found at
http://github.com/dbix-class/DBIx-Class
git://git.shadowcat.co.uk/dbsrgits/DBIx-Class.git

Cheers



More information about the DBIx-Class mailing list