[Dbix-class] Clone DBIx::Class::Row object to new connection

Gerhard Heift ml-dbix-class-20090107-b968 at gheift.de
Tue Jun 1 08:24:59 GMT 2010


Hello

I have a $row object and want to get a clone of it, which is bound to a new
database connection:

my $schema = Schema->connect(...);
my $row = $schema->resultset('table')->find(1);

my $clone = $row->clone_with_cloned_connection;

# this should be somthing like this:

my $clone_schema = $row->result_source->schema->clone;
$clone_schema->storage->dbh = $clone_schema->storage->dbh->clone;
$clone = $row->clone;
$clone->set_schema($clone_schema);

Is there any way I can implement this?

Thanks,
  Gerhard
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
Url : http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20100601/2a315f69/attachment.pgp


More information about the DBIx-Class mailing list