Bugzilla – Attachment 20237 Details for
Bug 10629
Inappropriate uses of $sth->finish() in C4::Branch.pm
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 10629 : Inappropriate uses of $sth->finish() in C4::Branch.pm
Bug-10629--Inappropriate-uses-of-sth-finish-in-C4B.patch (text/plain), 3.62 KB, created by
Kyle M Hall (khall)
on 2013-08-09 15:19:39 UTC
(
hide
)
Description:
Bug 10629 : Inappropriate uses of $sth->finish() in C4::Branch.pm
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2013-08-09 15:19:39 UTC
Size:
3.62 KB
patch
obsolete
>From 2d9c5047a3c9394c0c6dcb0e2500385effec68de Mon Sep 17 00:00:00 2001 >From: Kenza Zaki <kenza.zaki@biblibre.com> >Date: Tue, 23 Jul 2013 15:27:23 +0200 >Subject: [PATCH] Bug 10629 : Inappropriate uses of $sth->finish() in C4::Branch.pm > >Test plan : >Check if the regression tests still works >prove t/db_dependent/Branch.t >t/db_dependent/Branch.t .. 1/36 Using a hash as a reference is deprecated at t/db_dependent/Branch.t line 207. >t/db_dependent/Branch.t .. ok >All tests successful. >Files=1, Tests=36, 0 wallclock secs ( 0.03 usr 0.01 sys + 0.12 cusr 0.00 csys = 0.16 CPU) >Result: PASS > >Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz> > >From the man page > >finsh() >Indicate that no more data will be fetched from this statement handle >before it is either executed again or destroyed. >You almost certainly do not need to call this method. > >Adding calls to "finish" after loop that fetches all rows is a common >mistake, don't do it, it can mask genuine problems like uncaught fetch errors. > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > C4/Branch.pm | 10 ---------- > 1 files changed, 0 insertions(+), 10 deletions(-) > >diff --git a/C4/Branch.pm b/C4/Branch.pm >index 8b76771..c1e3587 100644 >--- a/C4/Branch.pm >+++ b/C4/Branch.pm >@@ -182,7 +182,6 @@ sub GetBranchName { > $sth = $dbh->prepare("Select branchname from branches where branchcode=?"); > $sth->execute($branchcode); > my $branchname = $sth->fetchrow_array; >- $sth->finish; > return ($branchname); > } > >@@ -278,7 +277,6 @@ sub ModBranch { > "insert into branchrelations (branchcode, categorycode) values(?, ?)" > ); > $sth->execute( $branchcode, $cat ); >- $sth->finish; > } > foreach my $cat (@removecats) { > my $sth = >@@ -286,7 +284,6 @@ sub ModBranch { > "delete from branchrelations where branchcode=? and categorycode=?" > ); > $sth->execute( $branchcode, $cat ); >- $sth->finish; > } > } > >@@ -422,7 +419,6 @@ sub GetBranchesInCategory { > while (my $branch = $sth->fetchrow) { > push @branches, $branch; > } >- $sth->finish(); > return( \@branches ); > } > >@@ -467,11 +463,9 @@ sub GetBranchInfo { > while ( my ($cat) = $nsth->fetchrow_array ) { > push( @cats, $cat ); > } >- $nsth->finish; > $data->{'categories'} = \@cats; > push( @results, $data ); > } >- $sth->finish; > return \@results; > } > >@@ -486,7 +480,6 @@ sub DelBranch { > my $dbh = C4::Context->dbh; > my $sth = $dbh->prepare("delete from branches where branchcode = ?"); > $sth->execute($branchcode); >- $sth->finish; > } > > =head2 ModBranchCategoryInfo >@@ -503,13 +496,11 @@ sub ModBranchCategoryInfo { > # we are doing an insert > my $sth = $dbh->prepare("INSERT INTO branchcategories (categorycode,categoryname,codedescription,categorytype,show_in_pulldown) VALUES (?,?,?,?,?)"); > $sth->execute(uc( $data->{'categorycode'} ),$data->{'categoryname'}, $data->{'codedescription'},$data->{'categorytype'},$data->{'show_in_pulldown'} ); >- $sth->finish(); > } > else { > # modifying > my $sth = $dbh->prepare("UPDATE branchcategories SET categoryname=?,codedescription=?,categorytype=?,show_in_pulldown=? WHERE categorycode=?"); > $sth->execute($data->{'categoryname'}, $data->{'codedescription'},$data->{'categorytype'},$data->{'show_in_pulldown'},uc( $data->{'categorycode'} ) ); >- $sth->finish(); > } > } > >@@ -546,7 +537,6 @@ sub DelBranchCategory { > my $dbh = C4::Context->dbh; > my $sth = $dbh->prepare("delete from branchcategories where categorycode = ?"); > $sth->execute($categorycode); >- $sth->finish; > } > > =head2 CheckBranchCategorycode >-- >1.7.2.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 10629
:
19868
|
19910
| 20237