From 46e08b68bd9bebebe3c0b4a31e306f64b90ad380 Mon Sep 17 00:00:00 2001
From: Alexandre Morignot <erdnaxeli@cervoi.se>
Date: Sun, 15 Mar 2015 20:08:40 +0100
Subject: [PATCH] bugfix: don't fetch data on a sold out query

---
 lib/utils/db/query.pm | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/lib/utils/db/query.pm b/lib/utils/db/query.pm
index bfe00fc..633d7a8 100644
--- a/lib/utils/db/query.pm
+++ b/lib/utils/db/query.pm
@@ -70,9 +70,15 @@ sub _get_next {
     my $result = $self->_sth->{$chan}->fetch();
     return $result if ($result);
 
-    # there is no more data to fetch
+    # we come here only if there is no more data to fetch
+
+    # we take care of the db
     $self->_sth->{$chan} = undef;
     $self->_get_dbh($chan)->commit();
+
+    # we remove the query
+    $self->_queries->{$chan} = undef;
+
     return undef;
 }
 
-- 
GitLab