[Dbix-class] SELECT from $schema1, INSERT into $schema2 ?

Chisel Wright chisel at herlpacker.co.uk
Sun Mar 9 16:21:06 GMT 2008

On Sat, Mar 08, 2008 at 04:24:57PM +0000, Matt S Trout wrote:
> $result->result_source($schema2->source(ref $result));
> $result->in_storage(0);
> $result->insert;
> If you're sure that the record will either be identical in the other DB
> or not present, $result->discard_changes will figure out if it's in the DB
> or not. If you have changes as well, I guess
> $result->result_source($schema2->source(ref $result));
> my %save = $result->get_columns;
> $result->discard_changes;
> $result->set_column($_ => $save{$_}) for keys %save;
> $result->insert_or_update;
> would do the trick.

Thanks for the extra ideas .. if I get time at $orkplace I'll look into
it. At the moment it's not broke, so I ain't fixing it :)

Chisel Wright
e: chisel at herlpacker.co.uk
w: http://www.herlpacker.co.uk/

  One in a million chances happen nine times out of ten.

More information about the DBIx-Class mailing list