> Thanks for the feedback!  Is this a correct implementation of what you're 
> saying?
> my $db = $pg->db;
> my $results = $db->select('a', [qw/first last birthday age phone/], undef, 
> {limit => $limit, offset => 1});
> my $tx = $db->begin;
> while ( my $next = $results->hash ) {
>   $db->insert('b', $next);
> }
> $tx->commit;
Almost. You do not want more than one active statement handle per 
connection. The while loop
is pointless there anyway, because DBD::Pg does not support cursors. So all 
results will be sent
to DBD::Pg as soon as you call $results->hash for the first time anyway. 
Better to use
$results->hashes->each, which releases the statement handle and frees up 
the connection for


You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

Reply via email to