Make sure we call finish on that statement handle.
authorGreg Sabino Mullane <greg@endpoint.com>
Mon, 24 Dec 2012 05:05:23 +0000 (00:05 -0500)
committerGreg Sabino Mullane <greg@endpoint.com>
Mon, 24 Dec 2012 05:05:23 +0000 (00:05 -0500)
Start making statement handles private: should probably do much more such cleaning up.

Bucardo.pm

index 1d27008c6d09052bf1bdcb9e8c70b53a788f5c2f..ba48b5d324fa0d958414c527caf4cfe98005b7ff 100644 (file)
@@ -963,7 +963,7 @@ sub mcp_main {
             elsif ('log_message' eq $name) {
                 $self->glog('Checking for log messages', LOG_DEBUG);
                 $SQL = 'SELECT msg,cdate FROM bucardo_log_message ORDER BY cdate';
-                $sth = $maindbh->prepare_cached($SQL);
+                my $sth = $maindbh->prepare_cached($SQL);
                 $count = $sth->execute();
                 if ($count ne '0E0') {
                     for my $row (@{$sth->fetchall_arrayref()}) {
@@ -972,6 +972,9 @@ sub mcp_main {
                     $maindbh->do('TRUNCATE TABLE bucardo_log_message');
                     $maindbh->commit();
                 }
+                else {
+                    $sth->finish();
+                }
             }
 
             ## Request that a named sync get reloaded
@@ -994,7 +997,7 @@ sub mcp_main {
                         . q{COALESCE(EXTRACT(epoch FROM checktime),0) AS checksecs, }
                             . q{COALESCE(EXTRACT(epoch FROM lifetime),0) AS lifetimesecs }
                                 . q{FROM bucardo.sync WHERE name = ?};
-                    $sth = $maindbh->prepare($SQL);
+                    my $sth = $maindbh->prepare($SQL);
                     $count = $sth->execute($syncname);
                     if ($count eq '0E0') {
                         $sth->finish();