[Koha-patches] [PATCH] minor cleanup, remove $sth->finish's. No documentation impact.

Joe Atzberger joe.atzberger at liblime.com
Thu May 29 15:59:25 CEST 2008


For details: see http://search.cpan.org/~timb/DBI-1.14/DBI.pm
"There's no need to call finish if you're about to destroy or re-execute the statement handle."
In all these cases the sth is falling out of scope, about to be destroyed.
---
 C4/Review.pm |    8 +-------
 1 files changed, 1 insertions(+), 7 deletions(-)

diff --git a/C4/Review.pm b/C4/Review.pm
index 163efc6..e08d24c 100644
--- a/C4/Review.pm
+++ b/C4/Review.pm
@@ -67,9 +67,7 @@ sub getreview {
       "SELECT * FROM reviews WHERE biblionumber=? and borrowernumber=?";
     my $sth = $dbh->prepare($query);
     $sth->execute( $biblionumber, $borrowernumber );
-    my $review = $sth->fetchrow_hashref();
-    $sth->finish();
-    return $review;
+    return $sth->fetchrow_hashref();
 }
 
 sub savereview {
@@ -80,7 +78,6 @@ sub savereview {
   (?,?,?,0,now())";
     my $sth = $dbh->prepare($query);
     $sth->execute( $borrowernumber, $biblionumber, $review);
-    $sth->finish();
 }
 
 sub updatereview {
@@ -89,7 +86,6 @@ sub updatereview {
     my $query = "UPDATE reviews SET review=?,datereviewed=now(),approved=0  WHERE borrowernumber=? and biblionumber=?";
     my $sth = $dbh->prepare($query);
     $sth->execute( $review, $borrowernumber, $biblionumber );
-    $sth->finish();
 }
 
 sub numberofreviews {
@@ -138,7 +134,6 @@ sub approvereview {
                WHERE reviewid=?";
     my $sth = $dbh->prepare($query);
     $sth->execute( 1, $reviewid );
-    $sth->finish();
 }
 
 =head2 deletereview
@@ -156,7 +151,6 @@ sub deletereview {
                WHERE reviewid=?";
     my $sth = $dbh->prepare($query);
     $sth->execute($reviewid);
-    $sth->finish();
 }
 
 1;
-- 
1.5.5.GIT




More information about the Koha-patches mailing list