On Sun, Feb 4, 2018 at 8:39 AM, sri <kra...@gmail.com> wrote:
>
> 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
> inserts.
>

This helps a lot, thank you!  Am I following your suggestion correctly with
this:

my $db = $pg->db;

my $tx = $db->begin;
$results->hashes->each(sub{$db->insert('b', $_)});
$tx->commit;

-- 
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