From: Damyan Ivanov Date: Thu, 11 Nov 2021 20:06:45 +0000 (+0000) Subject: fix two instances of hanging open statements X-Git-Url: https://git.ktnx.net/?a=commitdiff_plain;h=9495a65bec714a18a6329b68b55567917bcc21f3;p=mpd-feeder.git fix two instances of hanging open statements when a cursor is exhausted with while (sth->fetch) {...} there is no problem. Single row fetches, however need an explicit sth->finish or the cursor remains open. this is not a big problem, but it is annoying to see the warnings when the statement is reused (due to caching) or the connection is shut down --- diff --git a/bin/mpd-feeder b/bin/mpd-feeder index 4c2c537..a170816 100755 --- a/bin/mpd-feeder +++ b/bin/mpd-feeder @@ -215,6 +215,8 @@ use Net::Async::MPD; my $sth = $db->prepare_cached("select $name from options"); $sth->execute; my @result = $sth->fetchrow_array; + $sth->finish; + undef $sth; return $result[0]; } @@ -353,6 +355,7 @@ SQL push @result, { song => $row[0], artist => $row[1], album => $row[2] }; } + undef $sth; return @result; }